akhauriyash/Code-Regression huggingface dataset:
// Template
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <functional>
#include <numeric>
#include <list>
#include <set>
#include <map>
#include <algorithm>
#include <cmath>
#include <limits>
#include <iomanip>

using namespace std;
typedef long long ll;

#define REP(i, n) for(int i = 0;i < n;i++)
#define INF 1 << 30

int MOD = 1000000007;



int main(){
    std::ios_base::sync_with_stdio(false);

    int n,m; cin >> n >> m;
    std::vector<int> x(m);
    REP(i,m) cin >> x[i];

    sort(x.begin(), x.end());

    std::vector<int> diff;
    REP(i,m-1) diff.push_back(x[i+1]-x[i]);

    sort(diff.begin(), diff.end());
    reverse(diff.begin(), diff.end());

    ll ans = 0LL;
    for(int i=n-1; i<m-1; ++i) ans += diff[i];

    cout << ans << endl;



    return 0;
}


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

int main(){
    double N,K;
    cin >> N >> K;
    double ans = 0.0;
    double cnt = 1.0;
    for (int i = 1; i <= N; i++) {
        cnt = 1.0;
        int X = i;
        if(i >= K) {
            ans += 1.0/N;
        }
        else {
            while(X < K){
                X*=2;
                cnt*=2;
            }
            ans += (1.0/N)/cnt;
        }
    }
    cout << fixed << setprecision(12) << ans << endl;
}


Measured memory_bytes: 384
#include<iostream>
#include<string>
#include<vector>
#include<cmath>

using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(long long i=s;i<n;i++)
#define all(a) (a).begin(),(a).end()

typedef long long ll;
typedef long double ld;
typedef vector<ll> vll;
typedef vector<vll> vvll;
const double pi = acos(-1.0);
const ll mod = pow(10,9) + 7;
const ll INF = pow(2,31) - 1;

ll gcd(ll x,ll y)
{
    ll r;
    while((r = x % y) != 0)
    {
        x = y;
        y = r;
    }
    return y;
}

ll lcm(ll x,ll y)
{
    x /= gcd(x,y);
    y /= gcd(x,y);
    return (x*y);
}

int main()
{
	ll a,b,k;
	cin >> a >> b >> k;
	
	if(a >= k)cout << a-k << " " << b << endl;
	else {
		cout << 0 << " ";
		k -= a;
		if(b >= k)cout << b-k << endl;
		else cout << 0 << endl;
	}
	
	return 0;
}


Measured memory_bytes: 256
A,B=(int(x) for x in input().split())

#AとBの絶対値を求める
y=A-B

if abs(y)>1 and A>B:
    z=A*2-1
elif abs(y)>1 and A<B:
    z=B*2-1
elif A==B:
    z=A+B
elif abs(y)==1:
    z=A+B
else:
    'N/A'

print(z)

Measured memory_bytes: 2940
#include<stdio.h>

int main(){
  int a,b,c;
  scanf("%d %d %d",&a,&b,&c);
  if(a==b){
    if(b==c){
     printf("Yes\n");
   }
   else printf("No\n");
 }
  else {
    printf("No\n");
}
  return 0;
}


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

void Main() {
  string s;
  R s;
  if(s.size()%2) {
    pr("No");
    return;
  }
  for(int i=0; i<s.size(); i+=2) {
    if(s[i]!='h'||s[i+1]!='i') {
      pr("No");
      return;
    }
  }
  pr("Yes");
}

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


Measured memory_bytes: 256
N, K = map(int, input().split())
a = list(map(int, input().split()))

ans = []
flag = 1
for i in range(N):
    if a[i] < a[i + K]:
        print('Yes')
    else:
        print("No")
    flag += 1
    if flag == N-K+1:
        break

Measured memory_bytes: 31692
//{{{
#include <bits/stdc++.h>
using namespace std;
//types
typedef long long ll;
typedef pair<int,int> pii;
//input
bool SR(int &_x){return scanf("%d",&_x)==1;}bool SR(ll &_x){return scanf("%lld",&_x)==1;}
bool SR(double &_x){return scanf("%lf",&_x)==1;}bool SR(char *_s){return scanf("%s",_s)==1;}
bool RI(){return true;}
template<typename I,typename... T>bool RI(I &_x,T&... _tail){return SR(_x) && RI(_tail...);}
//output
void SP(const int _x){printf("%d",_x);}void SP(const ll _x){printf("%lld",_x);}
void SP(const double _x){printf("%.16lf",_x);}void SP(const char *s){printf("%s",s);}
void PL(){puts("");}
template<typename I,typename... T>void PL(const I _x,const T... _tail)
{SP(_x);if(sizeof...(_tail)) putchar(' ');PL(_tail...);}
//macro
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()
#define REP(i,n) for(int i=0;i<int(n);i++)
#define REP1(i,a,b) for(int i=(a);i<=int(b);i++)
#define pb push_back
#define mkp make_pair
#define F first
#define S second
//debug
#ifdef darry140
template<typename I>
void _DOING(const char *_s,I&& _x){cerr<<_s<<"="<<_x<<endl;}//without ','
template<typename I,typename... T>
void _DOING(const char *_s,I&& _x,T&&... _tail)//with ','
{
    int _c=0;
    static const char _bra[]="({[";
    static const char _ket[]=")}]";
    while(*_s!=',' || _c!=0)//eg. mkp(a,b)
    {
        if(strchr(_bra,*_s)) _c++;
        if(strchr(_ket,*_s)) _c--;
        cerr<<*_s++;
    }
    cerr<<"="<<_x<<", ";
    _DOING(_s+1,_tail...);
}
#define debug(...) do{\
    fprintf(stderr,"%s:%d - ",__PRETTY_FUNCTION__,__LINE__);\
    _DOING(#__VA_ARGS__,__VA_ARGS__);\
}while(0)
template<typename It>
ostream& _OUTC(ostream &_s,It _b,It _e)//container
{
    _s<<"{";
    for(auto _it=_b;_it!=_e;_it++) _s<<(_it==_b?"":" ")<<*_it;
    _s<<"}";
    return _s;
}
template<typename A,typename B>
ostream& operator <<(ostream&_s, const pair<A,B> &_p){return _s<<"("<<_p.F<<","<<_p.S<<")";}
template<typename A,typename B>
ostream& operator <<(ostream&_s, const map<A,B> &_c){return _OUTC(_s,ALL(_c));}
template<typename T>
ostream& operator <<(ostream&_s, const set<T> &_c){return _OUTC(_s,ALL(_c));}
template<typename T>
ostream& operator <<(ostream&_s, const vector<T> &_c){return _OUTC(_s,ALL(_c));}
#else
#define debug(...)
#endif
//}}}
ll doo(ll x,ll y)
{
    if(x<y) swap(x,y);
    if(x%y==0) return 2*y*(x/y)-y;
    return 2*y*(x/y)+doo(x%y,y);
}
int main()
{
    ll n,x;RI(n,x);
    if(2*x==n) PL(3*x);
    else if(2*x<n) PL(x+x+n+doo(x,n-2*x));
    else PL(n+doo(x,n-x));
    return 0;
}




































/*End Of File*/




Measured memory_bytes: 256
import sys
import numpy as np

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

H, W = lr()
A = [lr() for _ in range(H)]
B = [lr() for _ in range(H)]
diff = [[0] * W for _ in range(H)]
for i in range(H):
    for j in range(W):
        diff[i][j] = abs(A[i][j] - B[i][j])

X = (H+W) * 80
L = X + X + 1 #真ん中を0とする、最後に-X
dp = [[None] * W for _ in range(H)]
dp[0][0] = np.zeros(L, np.bool)
dp[0][0][X+diff[0][0]] = 1; dp[0][0][X-diff[0][0]] = 1 #非負整数のみでも良い
for h in range(H):
    for w, di in enumerate(diff[h]):
        if h == 0 and w == 0:
            continue
        x = np.zeros(L, np.bool)
        if h > 0:
            x[di:] |= dp[h-1][w][:L-di]
            x[:L-di] |= dp[h-1][w][di:]
        if w > 0:
            x[di:] |= dp[h][w-1][:L-di]
            x[:L-di] |= dp[h][w-1][di:]
        dp[h][w] = x

dp = dp[-1][-1]
possible = np.where(dp)[0] - X
answer = np.abs(possible).min()
print(answer)
# 07

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

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define FOR(i, a, b) for (int (i) = (a); (i) <= (b); (i)++)
#define ROF(i, a, b) for (int (i) = (a); (i) >= (b); (i)--)
#define REP(i, n) FOR(i, 0, (n)-1)
#define sqr(x) ((x) * (x))
#define all(x) (x).begin(), (x).end()
#define reset(x, y) memset(x, y, sizeof(x))
#define uni(x) (x).erase(unique(all(x)), (x).end());
#define BUG(x) cerr << #x << " = " << (x) << endl
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define _1 first
#define _2 second

const int maxn = 100010;

vector<int> G[maxn];
int deg[maxn], n, m, par[maxn];

int main(){
    int n, m;
    cin >> n >> m;
    FOR(i, 1, n + m -1){
        int u, v;
        cin >> u >> v;
        G[u].emplace_back(v);
        deg[v]++;
    }
    queue<int> q;
    FOR(i, 1, n){
        if(!deg[i]){
            q.push(i);
        }
    }
    assert(q.size() == 1);
    while(!q.empty()){
        int u = q.front();
        q.pop();
        for(int v : G[u]){
            deg[v]--;
            if(!deg[v]){
                par[v] = u;
                q.push(v);
            }
        }
    }
    FOR(i, 1, n){
        cout << par[i] << endl;
    }
}

Measured memory_bytes: 7040
n=int(input())
s = [0]*n
for i in range(n):
    s[i] = input()

from collections import Counter
c=Counter(s)

print( "AC x "+str(c["AC"]) )
print( "WA x "+str(c["WA"]) )
print( "TLE x "+str(c["TLE"]) )
print( "RE x "+str(c["RE"]) )

Measured memory_bytes: 78804
#include <iostream>
#define REP(i,n) for(int i=0;i<n;i++)
using namespace std;

int main() {
  int H,W;
  cin >> H >> W;
  char S[H+2][W+2];
  REP(i,H) REP(j,W) cin >> S[i][j];

  int dx[]={1,-1,0,0},dy[]={0,0,1,-1};
  bool ans = true;
  REP(i,H)
    REP(j,W) {
      if (S[i][j]=='#') {
        bool found=false;
        REP(k,4)
        {
          int i2 = i + dx[k];
          int j2 = j + dy[k];
          if (i2>=0 && i2<H && j2>=0 && j2<W && S[i2][j2]=='#')
            found=true;
        }
        if (!found){
          ans = false;
          //break;
        }
      }
      //if (!ans) break;
    }
  cout << (ans?"Yes":"No") << endl;
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#define MIN(x,y) ((x<y)?x:y)

int main(void){
    int N,K,X,Y,sum;
    scanf("%i", &N);
    scanf("%i", &K);
    scanf("%i", &X);
    scanf("%i", &Y);

    sum += MIN(N,K) * X;
    if (N>K) sum+= (N-K)*Y;

    printf("%i\n",sum);
    return 0;

}

Measured memory_bytes: 128
bingoSheet = [0 for x in range(9)]

for i in range(3):
    bingoRow = input().split()
    for j in range(3):
        bingoSheet[i*3 + j] = int(bingoRow[j])

bingoCount = int(input())

responses = []

for i in range(bingoCount):
    responses.append(int(input()))

hasBingo = False

step = 1
initialIndex = 0

for i in range(3):
    firstIndex = i*3
    subList = [bingoSheet[index] for index in [firstIndex, firstIndex+1, firstIndex+2]]
    if (all(elem in responses for elem in subList)):
        hasBingo = True
        break

for i in range(3):
    firstIndex = i
    subList = [bingoSheet[index] for index in [firstIndex, firstIndex+3, firstIndex+6]]
    if (all(elem in responses for elem in subList)):
        hasBingo = True
        break

subList = [bingoSheet[index] for index in [0, 4, 8]]
if (all(elem in responses for elem in subList)):
    hasBingo = True

subList = [bingoSheet[index] for index in [2, 4, 6]]
if (all(elem in responses for elem in subList)):
    hasBingo = True

if hasBingo:
    print('Yes')
    quit()

print('No')
quit()


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

int main(){
  int N;
  cin>>N;
  vector<pair<ll,int>> A(N);
  for(int i=0;i<N;i++){
    cin>>A.at(i).first;
    A.at(i).second=i;
  }

  sort(A.begin(),A.end());
  reverse(A.begin(),A.end());

  vector<vector<ll>> dp(N+2,vector<ll>(N+2,0));
  for(int i=0;i<N;i++){
    ll w=N-i;
    for(ll j=0;j+w<=N+1;j++){
      if(j==0){
        dp.at(j).at(j+w)=max<ll>(dp.at(j).at(j+w),dp.at(j).at(j+w+1)+A.at(i).first*((ll)abs(A.at(i).second-j-w+1)));
      }else if(j+w==N+1){
        dp.at(j).at(j+w)=max<ll>(dp.at(j).at(j+w),dp.at(j-1).at(j+w)+A.at(i).first*((ll)abs(A.at(i).second-j+1)));
      }else{
        dp.at(j).at(j+w)=max<ll>(dp.at(j).at(j+w),dp.at(j-1).at(j+w)+A.at(i).first*((ll)abs(A.at(i).second-j+1)));
        dp.at(j).at(j+w)=max<ll>(dp.at(j).at(j+w),dp.at(j).at(j+w+1)+A.at(i).first*((ll)abs(A.at(i).second-j-w+1)));
      }
    }
  }

  ll ans=0;
  for(int i=0;i<=N;i++){
    ans=max<ll>(ans,dp.at(i).at(i+1));
  }
  cout<<ans<<endl;
}


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

int main()
{
	int n;
	while(cin >> n){
		if(!n)
			break;
		int DP[31];
		DP[0] = 1;
		DP[1] = 1;
		DP[2] = 2;
		for(int i=3;i<=n;i++){
			DP[i] = DP[i-1]+DP[i-2]+DP[i-3];
		}
		int ans = DP[n]/10;
		if(DP[n]%10!=0)
			ans++;
		int answer = ans/365;
		if(ans%365!=0)
			answer++;
		cout << answer << endl;
	}
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
 
  vector<tuple<string,int,int>>A(N);
  for (int i = 0; i < N; i++) {
    cin >> get<0>(A.at(i)) >> get<1>(A.at(i));
    get<1>(A.at(i)) = 100 - get<1>(A.at(i));
    get<2>(A.at(i)) = i+1;
  }
  sort(A.begin(), A.end());

  for (int i = 0; i < N; i++) {
    cout << get<2>(A.at(i)) << endl;
  }
}

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

int main() {
  int n;
  cin >> n;
  vector<int> num(n);
  REP(i,n) num[i] = i+1;

  vector<int> P(n), Q(n);
  REP(i,n) cin >> P[i];
  REP(i,n) cin >> Q[i]; 
  int p_ans, q_ans;

  int cnt = 1;
  do {
    bool p_j = true, q_j = true;
    REP(i,n){
      if (P[i] != num[i]) p_j = false;
      if (Q[i] != num[i]) q_j = false;
    }
    if (p_j) p_ans = cnt;
    if (q_j) q_ans = cnt;
    cnt++;
  } while (next_permutation(num.begin(), num.end()));
  
  int ans = p_ans - q_ans;

  cout << abs(ans) << endl;
  return 0;
}


Measured memory_bytes: 3568
#include "bits/stdc++.h"

// Begin {{{
using namespace std;
#define all(x) x.begin(), x.end()
#define rep(i, n) for (i64 i = 0, i##_limit = (n); i < i##_limit; ++i)
#define reps(i, b, e) for (i64 i = (b), i##_limit = (e); i <= i##_limit; ++i)
#define repr(i, b, e) for (i64 i = (b), i##_limit = (e); i >= i##_limit; --i)
#define var(Type, ...) Type __VA_ARGS__; input(__VA_ARGS__)
using i64 = int_fast64_t;
using pii = pair<i64, i64>;
template <class T> using MaxHeap = priority_queue<T>;
template <class T> using MinHeap = priority_queue<T, vector<T>, greater<>>;
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
inline i64 sigma(i64 n) { return n * (1 + n) >> 1; }
inline i64 updiv(i64 n, i64 d) { return (n + d - 1) / d; }
constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int MOD = int(1e9) + 7;
#ifndef DEBUG
#define dump(...)
#endif

inline void input() {}
template <class Head, class... Tail>
inline void input(Head&& head, Tail&&... tail) {
    cin >> head;
    input(forward<Tail>(tail)...);
}

inline void outs() { cout << "\n"; }
template <class Head, class... Tail>
inline void outs(Head&& head, Tail&&... tail) {
    cout << head << (sizeof...(tail) ? " " : "");
    outs(forward<Tail>(tail)...);
}

template <class T>
inline void outs(vector<T> &vec) { for (auto &e : vec) cout << e << " \n"[&e == &vec.back()]; }

template <class T>
inline void outs(vector<vector<T>> &df) { for (auto &vec : df) outs(vec); }

inline void outl() { cout << "\n"; }
template <class Head, class... Tail>
inline void outl(Head&& head, Tail&&... tail) {
    cout << head << (sizeof...(tail) ? "\n" : "");
    outl(forward<Tail>(tail)...);
}

template <class T>
inline void outl(vector<T> &vec) { for (auto &e : vec) cout << e << "\n"; }

inline void outn() {}
template <class Head, class... Tail>
inline void outn(Head&& head, Tail&&... tail) {
    cout << head;
    outn(forward<Tail>(tail)...);
}

template <class T>
inline void outn(vector<T> &vec) { for (auto &e : vec) cout << e; }

template <class T>
inline vector<T> make_v(const T &initvalue, size_t sz) {
    return vector<T>(sz, initvalue);
}

template <class T, class... Args>
inline auto make_v(const T &initvalue, size_t sz, Args... args) {
    return vector<decltype(make_v<T>(initvalue, args...))>(sz, make_v<T>(initvalue, args...));
}
// }}} End

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    var(int, N, Q);
    vector<i64> a(N);
    rep(i, N) input(a[i]);
    while (Q--) {
        var(i64, x);
        i64 res = 0;
        i64 r = 0, sum = 0;
        rep(l, N) {
            while (r < N && sum + a[r] <= x) {
                sum += a[r];
                ++r;
            }
            res += r - l;
            if (l == r) ++r;
            else sum -= a[l];
        }
        outl(res);
    }
    return 0;
}



Measured memory_bytes: 3620
p = []
for i in range(5):
    p.append(input())
u = 10
v = 0
for i in range(5):
    if int(p[i][-1]) < u and int(p[i][-1]) != 0:
        u = int(p[i][-1])
        v = int(p[i])
q = []
r = 0
for i in range(5):
    if v != int(p[i]) or r == 1:
        if int(p[i][-1]) != 0:
            q.append(int(p[i]) + 10 - int(p[i][-1]))
        else:
            q.append(int(p[i]))
    else:
        r = 1
print(sum(q) + v)

Measured memory_bytes: 3064
n = gets.to_i
for m in 0 ... n
	input = gets.split(" ").map{ |a,v|; a.strip ? a.strip.to_i : a.to_i }.sort.reverse
	puts ((input[0] ** 2) == (input[1] ** 2 + input[2] ** 2)) ? "YES" : "NO"
end

Measured memory_bytes: 6116
from typing import List

# 人iの証言を人jに対する証言をリストで格納。1:正直者, 0:不親切, -1:言及なし
def io_info() -> List[List[int]]:
    N = int(input())
    res = [[-1] * N for _ in range(N)]
    for n in range(N):
        a = int(input())
        for _ in range(a):
            x, y = map(int, input().split())
            res[n][x-1] = y
    return res


def main():
    infos = io_info()
    n = len(infos)
    ans = 0
    for i in range(1 << n):
        d = [0] * n
        for j in range(n):
            # iのj+1ビット目が1かどうか,d[j]が正直なら1を割り当てる
            if (i >> j) & 1:
                d[j] = 1
        ok = True
        for j in range(n):
            if d[j]:
                for k in range(n):
                    if infos[j][k] == -1: continue
                    if infos[j][k] != d[k]: ok = False

        if ok: ans = max(ans, bin(i).count("1"))
    print(ans)



if __name__ == '__main__':
    main()


Measured memory_bytes: 10160
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

ll X, Y;
ll cnt = 0;

int main()
{
	cin >> X >> Y;

	ll tmp = X;

	while (tmp <= Y)
	{
		tmp *= 2;
		cnt++;
	}

	cout << cnt << endl;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-

# AtCoder Beginner Contest
# Problem C


def dfs(x: int):
    if visited[x]:
        return

    visited[x] = True

    for i in range(n):
        if graph[x][i]:
            dfs(i)


if __name__ == '__main__':
    n, m = list(map(int, input().split()))
    a = [0 for _ in range(m)]
    b = [0 for _ in range(m)]
    graph = [[0 for i in range(n)] for j in range(n)]

    # See:
    # https://img.atcoder.jp/abc075/editorial.pdf
    # https://www.youtube.com/watch?v=VJntQuR2zNI
    for i in range(m):
        line = list(map(int, input().split()))
        a[i] = line[0] - 1
        b[i] = line[1] - 1
        graph[a[i]][b[i]] = True
        graph[b[i]][a[i]] = True

    bridge_count = 0

    for j in range(m):
        graph[a[j]][b[j]] = False
        graph[b[j]][a[j]] = False

        visited = [False] * len(graph[0])
        dfs(0)

        if False in visited:
            bridge_count += 1

        graph[a[j]][b[j]] = True
        graph[b[j]][a[j]] = True

    print(bridge_count)


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

int main() {
    int h, w;
    cin >> h >> w;
    vector<string> line(h);
    for (int i = 0; i < h; i++) {
        cin >> line[i];
    }
    for (int j = 0; j < h; j++) {
        cout << line[j] << endl;
        cout << line[j] << endl;
    }
    return 0;
}


Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
#define  ft  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define  ll  long long
const int N=2e5+3;
ll a[N],vis[N];
int main()
{
    ft
    ll t,i,j,n,m,l,r;
    cin>>n>>m;
    for(i=1; i<=n; i++)
    {
        cin>>a[i];
        vis[i]=-1;
    }
    queue<ll>q;
    q.push(1);
    vis[1]=0;
    while(!q.empty())
    {
        l=q.front();
        q.pop();
        if((vis[l])==m)
        {
            cout<<l<<"\n";
            break;
        }
        r=a[l];
        if(vis[r]==-1)
        {
            vis[r]=vis[l]+1;
            q.push(r);
        }
        else
        {
            m-=vis[l]+1;
            l=vis[l]-vis[r]+1;
            m%=l;
            for(i=0; i<m; i++)
            {
                r=a[r];
            }
            cout<<r<<"\n";
        }
    }
    return 0;
}

Measured memory_bytes: 6768
#include <iostream>
#include <algorithm>
#include <utility>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <math.h>
#include <string.h>
#include <iomanip>
#include <numeric>
#include <cstdlib>
#include <cstdint>
#include <cmath>

using namespace std;

using ll = long long;
using pll = pair<ll, ll>;
using vl = vector<ll>;
using vll = vector<vl>;
using vpll = vector<pll>;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define Rep(i, n) for (long long i = 0; i< (long long)(n); i++)
#define RRep(i,n) for (long long i = ((long long)(n)-1); i>=0; i--)

struct Edge{
    int to;
    int weight;
    Edge(int t, int w) : to(t), weight(w){ }
};

using Graph = vector<vector<Edge>>;
using graph = vector<vector<int>>;

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;
}

template <class T>
T gcd(T a, T b){
    if( b==0 ) return a;
    return gcd(b, a%b);
}

template <class T>
T lcm(T a, T b){
    return (a*b)/gcd(a,b);
}

ll INF = 1e9+7;

vector<int> dx = {-1,0,1,0};
vector<int> dy = {0,-1,0,1};

int main(){
    ll n;
    cin >> n;
    vector<ll> a(n);
    Rep(i,n) cin >> a[i];
    deque<ll> dq;
    Rep(i,n){
        ll idx = lower_bound(dq.begin(),dq.end(),a[i]) -dq.begin();
        if(idx==0) dq.push_front(a[i]);
        else dq[idx-1] = a[i];
    }
    cout << dq.size() << endl;
}

Measured memory_bytes: 1792
/*** author: yuji9511 ***/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using lpair = pair<ll, ll>;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i=(m);i<(n);i++)
#define rrep(i,m,n) for(ll i=(m);i>=(n);i--)
#define printa(x,n) for(ll i=0;i<n;i++){cout<<(x[i])<<" \n"[i==n-1];};
void print() {}
template <class H,class... T>
void print(H&& h, T&&... t){cout<<h<<" \n"[sizeof...(t)==0];print(forward<T>(t)...);}
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << "\n"

void solve(){
    ll N,X,M;
    cin >> N >> X >> M;
    if(X == 0){
        print(0);
    }else if(X == 1){
        print(N);
    }else{
        vector<ll> v;
        map<ll,ll> mp;
        ll cur = X;
        ll pos = -1;
        ll length = -1;
        ll end_pos = -1;
        rep(i,0,N){
            if(mp[cur] > 0){
                // debug(i);
                pos = mp[cur];
                // debug(pos);
                // debug(cur);
                length = i - pos + 1;
                end_pos = i;
                break;
            }
            mp[cur] = i+1;
            v.push_back(cur);
            cur = cur * cur % M;
        }
        if(end_pos == -1){
            ll ans = 0;
            for(auto &e: v){
                ans += e;
            }
            print(ans);
            return;
        }
        // printa(v, v.size());
        ll ans = 0;
        rep(i,0,pos-1){
            ans += v[i];
        }
        ll repeat = 0;
        rep(i,pos-1, end_pos){
            repeat += v[i];
        }
        ll kaisuu = (N - (pos-1)) / length;
        ll amari = (N - (pos-1)) % length;
        ans += repeat * kaisuu;
        rep(i,pos-1,pos-1+amari){
            ans += v[i];
        }
        print(ans);

    }

    

}

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

Measured memory_bytes: 6692
#include<bits/stdc++.h>
using namespace std;
int a[100005],b[100005];
int main()
{
	int j,k,i;
	long long l;
	cin>>j>>k;
	l=j;
	for(i=2;i<=j;i++)
	{
		if(l==1) break;
		while(l%i==0)
		{
			l=l/i;
			a[i]++;
		}
	}
	l=k;
	for(i=2;i<=k;i++)
	{
		if(l==1) break;
		while(l%i==0)
		{
			l=l/i;
			b[i]++;
		}
	}
	for(i=1;i<=min(j,k);++i)
	{
		if(a[i]>b[i])
		{
			b[i]=0;
		}
		if(a[i]==b[i])
		{
			a[i]=0;
		}
		if(a[i]<b[i])
		{
			a[i]=0;
		}
	}
	l=1;
	for(i=1;i<=max(j,k);++i)
	{
		if(a[i]!=0)
		{
			while(a[i])
			{
				a[i]--;
				l=l*i;
			}
		}
		if(b[i]!=0)
		{
			while(b[i])
			{
				b[i]--;
				l=l*i;
			}
		}
	}
	cout<<l;
	return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e5+5;
multiset<pair<int,int>> s1;
vector<int> v1;
int arr[MAXN];
int par[MAXN];
int dp[MAXN];

int main(){
    int n,m;
    cin>>n>>m;
    string s;
    cin>>s;
    for(int i=0;i<=n;i++){
        if(s[i] == '0'){
            arr[i]=0;
        }else{
            arr[i]=1;
        }
    }
    dp[n] = 1;
    if(arr[n] == 1){
        cout<<-1<<endl;
        return 0;
    }
    s1.insert(make_pair(1,n));
    for(int i=n-1;i>=0;i--){

        if(i+m+1<=n){
            int ind = i+m+1;

            if(s1.find(make_pair(dp[ind],ind))!=s1.end()){
                s1.erase(s1.find(make_pair(dp[ind],ind)));
            }


        }

        if(arr[i] == 1){
            dp[i] = 1e9;
            s1.insert(make_pair(dp[i],i));

            continue;
        }
        auto it = s1.begin();

        dp[i] = (*it).first;

        if(dp[i]!=1e9){
            dp[i]++;
            par[i] = ((*it).second);
        }else{
            cout<<-1<<endl;
            return 0;
        }

        s1.insert(make_pair(dp[i],i));

    }
    int curr = 0;

    while(curr!=n){

        v1.push_back(curr-par[curr]);
        curr = par[curr];
    }


    for(int x:v1){
        cout<<-x<<" ";
    }
}


Measured memory_bytes: 6016
import sys
from math import ceil, floor, sqrt, sin, cos, pi, radians
from itertools import accumulate, permutations, combinations
from fractions import gcd # 最大公約数
from collections import deque, Counter
from operator import itemgetter
from heapq import heappop,heappush
sys.setrecursionlimit(10**7)
def lcm(x, y): return ((x * y) // gcd(x, y)) # 最小公倍数
# list(map(int, input().split()))

a, b, h, m = map(int, input().split())

pb = (60*h + m)*6 % 360
pa = (60*h + m)*0.5 % 360
p = abs(pa - pb)
print(sqrt(a*a + b*b - 2*a*b*cos(radians(p))))

Measured memory_bytes: 10804
# coding: utf-8
# Your code here!
 
import sys
 
#N, M = map(int, input().rstrip().split(' '))
S = [x for x in input()]
 
for i in range(1, len(S)):
    if S[i] == S[i-1]:
        print('Bad')
        sys.exit()
        
print('Good')

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

#define endl '\n'

void io(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cout.precision(15);
}
 
int main(int argc,char* argv[]) { 
    io() ;
    #ifndef ONLINE_JUDGE
       // freopen("inp.txt", "r", stdin) ;
        // freopen("out.txt", "w", stdout);
    #endif
    vector< pair<int,int> > A,B ;
    int n,m ;
    int x,y ;
    cin >> n >> m ;
    for(int i = 0 ; i < n ; i++){
        cin >> x >> y ;
        A.push_back({x,y}) ;
    }
    for(int i = 0 ; i < m ; i++){
        cin >> x >> y ;
        B.push_back({x,y}) ;
    }
    for(int i = 0 ; i < n ; i++){
        int dis = 1e9 ;
        int pt = -1 ;
        for(int j = 0 ; j < m ; j++){
            if(abs(A[i].first-B[j].first) + abs(A[i].second - B[j].second) < dis){
                pt = j ;
                dis = abs(A[i].first-B[j].first) + abs(A[i].second - B[j].second) ;
            }
        }
        cout << (pt + 1) << endl ;
    }
    return 0 ; 
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define mod 1000000007
int mul(int x,int y){
	return (int)((long long int)x*y%mod);
}
int fac(int x){
	int r = 1;
	for(int i=2; i<=x; i++)
		r=mul(r,i);
	return r;
}
int main(){
	int n,m;
	scanf("%d%d",&n,&m);
	if(n > m)swap(n,m);
	if(m-n < 2){
		printf("%d\n",mul(mul(fac(n),fac(m)),2-(m-n)));
	}
	else
		puts("0");
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
    int a,b,c=0,cb,r,i;
    cin>>a>>b;
    cb=b;
    while(cb) {
        c++;
        cb/=10;
    }
    for(i=1;i<=c;i++) {
        a*=10;
    }
    b=a+b;
    r=sqrt(b);
    if(r*r==b)
        cout<<"Yes";
    else
        cout<<"No";
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/adaptor/indexed.hpp>
#define FOR(i,k,n)  for(int i = (k);i < (n);++i)
#define REP(i,n)    FOR(i,0,n)
#define ALL(x) begin(x),end(x)

using namespace std;
using namespace boost::adaptors;
using namespace std::string_literals;
using ll = int64_t;
using vecint = vector<int>;
using vecll = vector<ll>;
using boost::irange;

pair<ll,ll> solve(const vector<vector<bool>>& rot45, ll n) {
  ll ans = 0;
  ll ans2 = 0;
  REP(i,n) {
    vector<vecint> sum;
    vecint cnt(n);
    sum.push_back(cnt);
    REP(j,n) {
      FOR(k,j+1,n) {
        if (rot45[i][j] && rot45[i][k]) ++cnt[k-j];
      }
      sum.push_back(cnt);
    }
    REP(j,n) {
      if (j == i) continue;
      int d = abs(i-j);
      REP(k,n) {
        if (!rot45[j][k]) continue;
        ans += sum[k][d] - sum[max(0, k-d+1)][d];
        ans2 += sum[k+1][d] - sum[k][d];
        if (k-d >= 0) ans2 += sum[k-d+1][d] - sum[k-d][d];
      }
    }
  }
  return make_pair(ans, ans2);
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll h,w;
  cin>>h>>w;
  vector<string> mat(h);
  for(auto&&l:mat)cin>>l;
  ll n = h+w;
  vector<vector<bool>> rot45(n, vector<bool>(n, false));
  vector<vector<bool>> rot315(n, vector<bool>(n, false));
  REP(i,h)REP(j,w) {
    if (mat[i][j] == '#') {
      rot45[i+j][i+w-1-j] = true;
      rot315[i+w-1-j][i+j] = true;
    }
  }
  auto p1 = solve(rot45, n);
  auto p2 = solve(rot315, n);
  cout<<p1.first + p2.first + p1.second<<endl;
  return 0;
}


Measured memory_bytes: 2028
#include<stdio.h>

int n,x;

int main(){
    while(scanf("%d",&n)!=EOF){
        x=1;
        while(n!=0){
            if(n%2==1)printf("%d%c",x,(n/2==0)?'\n':' ');
            n=n/2;x=x*2;
        }
    }
    return 0;
}


Measured memory_bytes: 2044
/*                         _
                        _ooOoo_
                       o8888888o
                       88" . "88
                       (| -_- |)
                       O\  =  /O
                    ____/`---'\____
                  .'  \\|     |//  `.
                 /  \\|||  :  |||//  \
                /  _||||| -:- |||||_  \
                |   | \\\  -  /'| |   |
                | \_|  `\`---'//  |_/ |
                \  .-\__ `-. -'__/-.  /
              ___`. .'  /--.--\  `. .'___
           ."" '<  `.___\_<|>_/___.' _> \"".
          | | :  `- \`. ;`. _/; .'/ /  .' ; |
          \  \ `-.   \_\_`. _.'_/_/  -' _.' /
===========`-.`___`-.__\ \___  /__.-'_.'_.-'================

                  Please give me AC.
*/

#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <string>
#include <sstream>
#include <complex>
#include <bitset>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <chrono>
#include <random>

using namespace std;

using int64 = long long;
using uint64 = unsigned long long;
using vi = vector<int>;
using vl = vector<int64>;
using pii = pair<int, int>;
using pll = pair<int64, int64>;

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(v) (v).begin(), (v).end()
#define print(x) cout << (x) << '\n'
#define print2(x, y) cout << (x) << ' ' << (y) << '\n'
#define print3(x, y, z) cout << (x) << ' ' << (y) << ' ' << (z) << '\n'
#define printn(v) rep(i, (v).size() - 1) cout << (v)[i] << ' '; cout << (v)[n - 1] << '\n';
#define debug(x) cerr << #x << ": " << (x) << '\n'
#define debug2(x, y) cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << '\n'
#define debug3(x, y, z) cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << ", " << #z << ": " << (z) << '\n'
#define dbg(v) for (size_t _ = 0; _ < v.size(); ++_){cerr << #v << "[" << _ << "] : " << v[_] << '\n';}
// constant
const int INF = (1<<30) - 1;
const int64 INF64 = (1LL<<62) - 1;

template<typename T> T gcd(T a, T b) {
    if (a < b) return gcd(b, a);
    T r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}

template<typename T> T lcm(const T a, const T b) {
    return a / gcd(a, b) * b;
}

template<typename T> bool chmin(T& a, const T& b) {
    if (a > b) return a = b, true; else return false;
}

template<typename T> bool chmax(T& a, const T& b) {
    if (a < b) return a = b, true; else return false;
}

// End of template.

int main() {
    cout << fixed << setprecision(15);
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    // cin.read(buf, sizeof buf); // 注意: ./a.out < in か pbp | ./a.out で入力すること

    int n, k, cnt[110] = {};
    cin >> n >> k;
    rep(i, k) {
        int d;
        cin >> d;
        rep(j, d) {
            int a;
            cin >> a;
            a--;
            cnt[a] += 1;
        }
    }

    int ans = 0;
    rep(i, n) ans += cnt[i] == 0;
    print(ans);

    return 0;
}



Measured memory_bytes: 3636
#include "bits/stdc++.h"

using namespace std;
typedef long long ll;
const ll inf = (1 << 30) - 1;
const ll infll = (1LL << 61) - 1;
const ll mod = 1e9 + 7;
#define REP(i, o, n) for (ll i = o; i < n; i++)
#define rep(i, n) REP(i, 0, n)

ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }

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

ll f(ll x, ll c, ll d) {
    ll res = x;
    res -= x / c;
    res -= x / d;
    res += x / lcm(c, d);
    return res;
}

void actual() {
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    ll ans = 0;

    ans = f(b, c, d) - f(a - 1, c, d);
    cout << ans << endl;
}


int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    actual();
    return 0;
}

Measured memory_bytes: 256
import math

n = int(input().rstrip())
a = list(map(int,input().rstrip().split()))
NUM = 1_000_005
aa = [0]*NUM
pgcd = True
sgcd = a[n-1]
aa[a[n-1]]+=1
for i in range(0,n-1):
    sgcd = math.gcd(sgcd, a[i])
    aa[a[i]]+=1

for i in range(2,NUM):
    tmp = sum(aa[i::i])
    if tmp >= 2:
        pgcd = False
        break
        
if sgcd!=1:
    print('not coprime')
elif pgcd:
    print('pairwise coprime')
else:
    print('setwise coprime')

Measured memory_bytes: 132804
#include <stdio.h>
#include <string.h>
int main(void)
{
    char a;
    scanf("%c", &a);
    if(strncmp(&a, "a", 1)==0||strncmp(&a, "i", 1)==0||strncmp(&a, "u", 1)==0||strncmp(&a, "e", 1)==0||strncmp(&a, "o", 1)==0)
    {
        printf("vowel");
    }
    else
    {
        printf("consonant");
    }
    return 0;
    
}

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

using namespace std;

#define SZ(x) (int)(x.size())

using ll = long long;
using ld = long double;
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
const double eps = 1e-10;
const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll<<50;

template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);

  vector<string> s3 = {"aab", "d.b", "dcc"};
  vector<string> s4 = {"aacd", "bbcd", "efgg", "efhh"};
  vector<string> s5 = {"abc..", "abc..", "gghdd", "j.hee", "jiiff"};
  vector<string> s7 = {"aabbcc.", "dd.dd.a", "..d..da", "..d..db", "dd.dd.b", "..d..dc", "..d..dc"};

  int n; cin >> n;
  vector<vector<char>> ans(n, vector<char>(n, '.'));
  if(n % 3 == 0) {
    for(int i=0;i<n;i+=3) {
      for(int j=0;j<3;++j) {
        for(int k=0;k<3;++k) {
          ans[i+j][i+k] = s3[j][k];
        }
      }
    }

    for(int i=0;i<n;++i) {
      for(int j=0;j<n;++j) {
        cout << ans[i][j];
      }
      cout << endl;
    }
    return 0;
  }

  if(n == 7) {
    for(int i=0;i<7;++i) {
      cout << s7[i] << endl;
    }
    cout << endl;
    return 0;
  }
  if(n == 11) {
    for(int i=0;i<4;++i) {
      for(int j=0;j<4;++j) {
        ans[i][j] = s4[i][j];
      }
    }
    for(int i=0;i<7;++i) {
      for(int j=0;j<7;++j) {
        ans[4+i][4+j] = s7[i][j];
      }
    }
    for(int i=0;i<n;++i) {
      for(int j=0;j<n;++j) {
        cout << ans[i][j];
      }
      cout << endl;
    }
    return 0;
  }

  int x4 = -1, x5 = -1;
  for(int i=0;i<=n;++i) {
    if(n - 4 * i >= 0 && (n - 4 * i) % 5 == 0) {
      x4 = i;
      x5 = (n - 4*i) / 5;
      break;
    }
  }
  if(x4 < 0 || x5 < 0) {
    cout << -1 << endl;
    return 0;
  }
  
  int pos = 0;
  for(int i=0;i<x4;++i) {
    for(int j=0;j<4;++j) {
      for(int k=0;k<4;++k) {
        ans[pos+j][pos+k] = s4[j][k];
      }
    }
    pos += 4;
  }
  for(int i=0;i<x5;++i) {
    for(int j=0;j<5;++j) {
      for(int k=0;k<5;++k) {
        ans[pos+j][pos+k] = s5[j][k];
      }
    }
    pos += 5;
  }

  for(int i=0;i<n;++i) {
    for(int j=0;j<n;++j) {
      cout << ans[i][j];
    }
    cout << endl;
  }


  

}


Measured memory_bytes: 2304
#include <iostream>
#include <cstdio>

#define MOD 1000000007
using namespace std;

int main(void){
    int n;
    long long c[10005], ans=1, t;
    cin >> n;

    for(int i=2; i<=n; i++){
        t = i;
        for(int j=2; t > 1;j++){
            while(t%j == 0){
                t = t / j;
                c[j]++;
            }
        }
    }

    for(int i=2; i<=n; i++){
        ans = ans * (c[i] + 1) % MOD;
    }

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

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		try (Scanner sc = new Scanner(System.in)) {
			int x = sc.nextInt();
			int a = sc.nextInt();
			int b = sc.nextInt();

			if (Math.abs(x - a) < Math.abs(x - b)) {
				System.out.println("A");
			} else {
				System.out.println("B");
			}
		}
	}
}

Measured memory_bytes: 23892
#include <bits/stdc++.h>
using namespace std;
int main() {
    string W;
    cin >> W;
    const int MAXI = 'z' - 'a' + 1;
    int count['z' - 'a' + 1];
    fill(&count[0], &count[MAXI], 0);
    for(char &c: W) {
        count[c - 'a']++;
    }
    bool isEven = true;
    for(int i = 0; i < MAXI; i++) {
        if(count[i] % 2 == 1) {
            isEven = false;
            break;
        }
    }
    if(isEven) {
        cout << "Yes";
    } else {
        cout << "No";
    }
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
using namespace std;
int n,l,r,vl,vr;
int ask(int x){
	printf("%d\n",x%n);
	fflush(stdout); char s[10];
	scanf("%s",s); if(s[0]=='V') exit(0); else return s[0]=='M';
}
int main(){
	scanf("%d",&n); l=0; r=n/2; vl=ask(l); vr=ask(r);
	if((l+r+vl+vr)%2==0){
		swap(l,r); swap(vl,vr); r+=n;
	}
	for(;;){
		int mid=(l+r)/2,vm=ask(mid);
		if((l+mid+vl+vm)%2){
			r=mid; vr=vm;
		}else{
			l=mid; vl=vm;
		}
	}
}

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

using namespace std;
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
constexpr int dx[] = {1, 0, -1, 0, 1, 1, -1, -1};
constexpr int dy[] = {0, -1, 0, 1, 1, -1, -1, 1};

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){os << "["; for (const auto &v : vec) {os << v << ","; } os << "]"; return os; }
template <typename T, typename U> ostream &operator<<(ostream &os, const pair<T, U> &p) {os << "(" << p.first << ", " << p.second << ")"; return os;}

bool check(int j, int W) {
    bool ok = true;
    for (int k = 0; k + 1 < (W - 1); k++) {
        if ((j >> k & 1) && ((j >> (k + 1)) & 1)) ok = false;
    }
    return ok;
}

void solve() {
    int H, W, K;
    const int mod = 1e9 + 7;
    cin >> H >> W >> K;

    vector<vector<int>> dp(H + 1, vector<int>(W));
    dp[0][0] = 1;
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            for (int k = 0; k < 1 << (W - 1); k++) {
                if (!check(k, W)) continue;
                int pos = j;

                if (k >> j & 1) pos++;
                else if (j >= 1 && k >> (j - 1) & 1) pos--;
                
                dp[i + 1][pos] += dp[i][j];
                dp[i + 1][pos] %= mod;
            }
        }
    }
    cout << dp[H][K - 1] << endl;
}

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

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<queue>
using namespace std;
#define rg register
#define il inline
int read(){
	int x=0, p=1; char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-') p=0; ch=getchar();}
	while(ch>='0'&&ch<='9') x=(x<<1)+(x<<3)+(ch^48), ch=getchar();
	return p?x: -x;
}
#define _ 100010
int n, m, q, hd[_], cnt, ri[_], col[_];
struct Edge{int nxt, to;}e[_<<1];
il void add(int u, int v){
	e[++cnt]=(Edge){hd[u], v}, hd[u]=cnt;
}
struct Query{int u, d, c;}a[_];
struct Node{int u, d;};
queue<Node> Q;
void bfs(int st, int d, int c){
	Q.push((Node){st, d});
	while(Q.size()){
		Node x=Q.front(); Q.pop();
		if(!col[x.u]) col[x.u]=c;
		if(!x.d) continue;
		if(x.d<=ri[x.u]) continue;//与u距离不大于ri[u]的点都已经被染过色了。
		ri[x.u]=x.d;//更新u的影响范围。
		for(rg int i=hd[x.u]; i; i=e[i].nxt)
			Q.push((Node){e[i].to, x.d-1});
	}
}
int main(){
	n=read(), m=read();
	int u, v;
	for(rg int i=1; i<=m; ++i)
		u=read(), v=read(), add(u, v), add(v, u);
	
	q=read();
	for(int i=1; i<=q; ++i)
		a[i].u=read(), a[i].d=read(), a[i].c=read();
	
	for(int i=q; i; --i) bfs(a[i].u, a[i].d, a[i].c);//倒序染色，保证每个点只被染一次。
	for(rg int i=1; i<=n; ++i) printf("%d\n", col[i]);
}


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

using namespace std;

int main()
{
	int n, m, l;
	cin >> n >> m >> l;
	long long int A[n][m], B[m][l];
	for (int i = 0; i < n; i++){
		for (int j = 0; j < m; j++){
			cin >> A[i][j];
		}
	}

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

	long long int C[n][l];

	for (int i = 0; i < n; i++){
		for (int j = 0; j < l; j++){
			long long int tmp = 0;
			for (int k = 0; k < m; k++){
				tmp += A[i][k] * B[k][j];
			}
			C[i][j] = tmp;
		}
	}

	for (int i = 0; i < n; i++){
		for (int j = 0; j < l; j++){
			if (j < l-1) cout << C[i][j] << " ";
			else cout << C[i][j];
		}
		cout << endl;
	}
}


Measured memory_bytes: 3256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int (i)=0;(i)<(n);i++)
#define INF 1001001001
#define LLINF 1001001001001001001
#define MOD 1000000007
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; }
#define ALL(v) v.begin(), v.end()
typedef long long ll;

int main(){
    int x,n,m=101,ans=0;
    cin >> x >> n;
    int p[n];
    rep(i,n)cin >> p[i];
    int num[100];
    rep(i,102)num[i] = i;

    for(int i=0;i<n;i++){
        num[p[i]]=-1;
    }
    
    
    for(int i=0;i<102;i++){
        if(num[i]!=-1){
            int tem = abs(num[i]-x);
            if(tem<m){
                m=tem;
                ans = i;
            }

        }
    }

    cout << ans << endl;
    return 0;

}


Measured memory_bytes: 3640
#include<cstdio>
#include<algorithm>
#define int long long
int n,a[2005],b[2005],ans=0,cnt[2005];
int solve(int l,int r){return b[r]-b[l-1];}
signed main()
{
	scanf("%lld",&n);
	for (int i=1;i<=n;i++)
	    scanf("%lld",&a[i]),cnt[a[i]]++;
	for (int i=1;i<=2000;i++) b[i]=cnt[i]+b[i-1];
	std::sort(a+1,a+n+1);
	for (int i=1;i<=1000;i++)
	{
		ans=ans+cnt[i]*(cnt[i]-1)*(cnt[i]-2)/3/2/1;
		for (int j=i+1;j<=1000;j++)
	        ans=ans+cnt[i]*cnt[j]*solve(j+1,i+j-1)+(i+i>j?cnt[i]*(cnt[i]-1)/2/1*cnt[j]:0)+cnt[j]*(cnt[j]-1)/2/1*cnt[i];
	}
	printf("%lld\n",ans);
//	return 0;
}

Measured memory_bytes: 256
#include <iostream>

int main()
{
    int N;
    std::cin >> N;
    char c[N];
    for(int i=0; i<N; i++){
        std::cin >> c[i];
    }

    int l=0, r=N-1;
    int ans = 0;
    while(1){
        while(c[l] == 'R'){
            if(l >= N){
                break;
            }
            l++;
        };
        while(c[r] == 'W'){
            if(r <= -1){
                break;
            }
            r--;
        }
        if( l >= r){
            break;
        }
        ans++;
        l++;
        r--;
    }
    std::cout << ans << std::endl;
    //int end;
    //std::cin >> end;
    return 0;
}

Measured memory_bytes: 3768
#include <stdio.h>

int main(){
	int r,c;
	int i,j;
	int A[1000][1000];

	scanf("%d", &r);
	scanf("%d", &c);
	for(i=0; i<r; i++){
		for(j=0; j<c; j++){
			scanf("%d",&A[i][j]);
		}
	}
	for( i=0; i<r; i++){
		for( j=0; j<c; j++){
			A[i][c] += A[i][j];
		}
	}
	for( j=0; j<=c; j++){
		for( i=0; i<r; i++){
			A[r][j] += A[i][j];
		}
	}
	for(i=0; i<r+1; i++){
		for(j=0; j<c+1; j++){
			printf("%d", A[i][j]);
			if(j!=c)
				printf(" ");
		}
		printf("\n");
	}

	return 0;
}

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

int main()
{
	double a,b,h,m;
	cin>>a>>b>>h>>m;

	double k = abs(h*30+m/2-m*6);
	k = min(k,360-k);
	double pi = acos(-1.0);
	cout<<fixed<<setprecision(15)<<sqrt(abs(a*a+b*b-a*b*2*cos(k/180.0*pi)));
	return 0;
}

Measured memory_bytes: 4172
S = input()
n = len(S)

if n % 2 == 0:
    S0 = "01" * (n//2)
    S1 = "10" * (n//2)
else:
    S0 = "0" + "10" * (n//2)
    S1 = "1" + "01" * (n//2)

c0 = sum(1 for s, s0 in zip(S, S0) if s != s0)
c1 = sum(1 for s, s1 in zip(S, S1) if s != s1)

print(min(c0, c1))

Measured memory_bytes: 3444
N,X = map(int,input().split())
alist = [2**(i+2)-3 for i in range(N+1)]
cntlist = [2**(i+1)-1 for i in range(N+1)]
cnt = 0
i = 0

while True:
    i += 1
    if X <= N-i+1:
        break
    elif alist[-i] - (N-i+1) <= X:
        cnt += cntlist[-i]
        break
    elif alist[-i]//2 +1 < X: # 左
        cnt += cntlist[-i]//2 +1
        X -= alist[-i]//2 +1
    elif X == alist[-i]//2 +1: # 真ん中
        cnt += cntlist[-i]//2 + 1
        break
    elif X < alist[-i]//2 +1: # 右
        X -= 1

print(cnt)

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <cstring>

int N, K;
int R, S, P;

using namespace std;

int get_score(char hand) {
  int ret = 0;
  switch(hand) {
    case 'r':
      ret = P;
      break;
    case 's':
      ret = R;
      break;
    case 'p':
      ret = S;
      break;
  }
  return ret;
}

int main() {
  string T;
  int score = 0;

  cin >> N >> K;
  cin >> R >> S >> P;
  cin >> T;

  int flg[N];
  memset(flg, 0, sizeof(flg));

  for (int i = 0; i < N; i++) {
    if (i >= K && T[i] == T[i-K] && flg[i-K]) continue;
    score += get_score(T[i]);
    flg[i] = 1;
  }
  cout << score << endl;

  return 0;
}


Measured memory_bytes: 896
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long a = sc.nextLong();
        long b = sc.nextLong();
        long c = sc.nextLong();
        long d = sc.nextLong();
        long ans = b / c - (a - 1) / c + b / d - (a - 1) / d - (b / lcm(c, d) - (a - 1) / lcm(c, d));
        System.out.println(b - a + 1 - ans);
    }

    static long lcm(long x, long y) {
        return x * y / gcd(x, y);
    }

    static long gcd(long x, long y) {
        if (x < y)
            return gcd(y, x);
        if (y == 0)
            return x;
        return gcd(y, x % y);
    }
}


Measured memory_bytes: 21844