akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <utility>
#include <numeric>
#include <functional>
#include <stdio.h>
#include <math.h>
#include <string>
#include <algorithm>
#include <deque>
#include <queue>
#include <map>

#define rep(i, m, n) for (int (i)(m); (i)<(n); ++(i))
#define repr(i, m, n) for (int (i)(m - 1); (i)>=(n); --(i))
#define repv(i, v) for (unsigned (i)(0); (i)<(v.size()); ++(i))
#define all(v) (v).begin(), (v).end()
#define sortv(v) sort(all(v))
#define sortgi(v) sort(all(v), greater<int>())
#define sortgd(v) sort(all(v), greater<double>())
#define sortgll(v) sort(all(v), greater<ll>())
#define debug(x) cerr << #x << ": " << x << '\n'

using namespace std;
using pii = pair<int, int>;
using pss = pair<string, string>;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vd = vector<double>;
using vvd = vector<vd>;
using vs = vector<string>;
using ll = long long;
using pllll = pair<ll, ll>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvvb = vector<vvb>;
using vpii = vector<pii>;
using pqi = priority_queue<int>;
using pqd = priority_queue<double>;
using pqll = priority_queue<ll>;
using pqvi = priority_queue<vi>;
using pqvll = priority_queue<vll>;

template<class T>
void accum(vector<vector<T> > &v) {
	for (signed i(1); i < v.size(); ++i) {
		for (signed j(1); j < v.size(); ++j) {
			v[i][j] = v[i][j] + v[i][j - 1];
		}
	}
	for (signed i(1); i < v.size(); ++i) {
		for (signed j(1); j < v.size(); ++j) {
			v[j][i] = v[j][i] + v[j - 1][i];
		}
	}
}


int main() {
	int N, M, Q;
	scanf("%d %d %d", &N, &M ,&Q);
	vvi lr(N + 1, vi(N + 1, 0)); 
	rep(i, 0, M) {
		int l, r;
		scanf("%d %d", &l, &r);
		++lr[l][r];
	}
	accum(lr);
	rep(i, 0, Q) {
		int p, q;
		scanf("%d %d", &p, &q);
		printf("%d\n", lr[q][q] - lr[p-1][q] - lr[q][p-1] + lr[p-1][p-1]);
	}
}


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

typedef long long ll;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<vector<vector<ll>>> vvvll;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<vector<vector<bool>>> vvvb;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<vpll> vvpll;
typedef vector<double> vd;
typedef vector<vd> vdd;

#define FOR(i,x,y) for(ll i=(ll)x; i<(ll)y; ++i)
#define REP(i,y) FOR(i, 0, y)
#define RFOR(i,x,y) for(ll i=(ll)x; i>=(ll)y; --i)
#define RREP(i,x) RFOR(i, x, 0)
#define ALL(a) a.begin(), a.end()
#define pb push_back
#define debug_print(x...) cerr << "line " << __LINE__ << " : "; debug_print_in(x);

template <typename First>
void debug_print_in(First first){
  cerr << first << endl;
  return;
}

template <typename First, typename... Rest>
void debug_print_in(First first, Rest... rest){
  cerr << first << " ";
  debug_print_in(rest...);
  return;
}

void IN(void){
  return;
}

template <typename First, typename... Rest>
void IN(First& first, Rest&... rest){
  cin >> first;
  IN(rest...);
  return;
}

template <typename First>
void OUT(First first){
  cout << first << endl;
  return;
}

template <typename First, typename... Rest>
void OUT(First first, Rest... rest){
  cout << first << " ";
  OUT(rest...);
  return;
}

template<class t, class u> void chmax(t&a,u b){if(a<b)a=b;};
template<class t, class u> void chmin(t&a,u b){if(a>b)a=b;};
int popcount(int t){return __builtin_popcount(t);} //GCC
int popcount(ll t){return __builtin_popcountll(t);} //GCC

template <typename T>
void vec_print(vector<T> VEC){
  REP(i, VEC.size()){
    cerr << VEC[i] << " ";
  }
  cerr << endl;
};

template <typename T>
void mat_print(vector<vector<T> > MAT){
  REP(i,MAT.size()){
    REP(j,MAT[i].size()){
      cerr << MAT[i][j] << " ";
    }
    cerr << endl;
  }
};

constexpr int INF = (1<<30);
constexpr ll INFLL = 1LL<<62;
constexpr long double EPS = 1e-12;
constexpr ll MOD = (ll)((1E+9)+7);

int main(){
  cin.tie(0); // cut the cin and cout (default, std::flush is performed after std::cin)
  ios::sync_with_stdio(false); // cut the iostream and stdio (DON'T endl; BUT "\n";)

  ll A, B, C, K;
  IN(A,B,C);
  IN(K);

  ll k = 0;
  while(A>=B){
    B *= 2;
    k++;
  }
  while(B>=C){
    C *= 2;
    k++;
  }

  if(k<=K){
    OUT("Yes");
  }else{
    OUT("No");
  }

  return 0;
}

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

using namespace std;
typedef long long ll;

inline int at(ll x, int k){ return (x >> k) & 1; }
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define rrep(i,a,b) for(ll i=a;i>=b;i--)


int main() {
	string s,t;
	cin >> s >> t;
	if(s==t.substr(0,s.size())&&s.size()+1==t.size()){
		cout << "Yes"<< endl;
	}
	else{
		cout << "No"<< endl;
	}

}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
typedef long long int LL;
typedef unsigned long long int ULL;
using namespace std;

// 插入此處

LL dist[1005];
LL a[2005], b[2005], c[2005];
LL INF = 1LL << 60;

int main() {
    int n, m;
    cin >> n >> m;
    for (int i = 0; i < m; i++) {
        cin >> a[i] >> b[i] >> c[i];
        c[i] = -c[i];
    }
    for (int i = 1; i <= n; i++) {
        dist[i] = INF; 
    }
    dist[1] = 0;
    for (int i = 0; i < n - 1; i++) {
        for (int j = 0; j < m; j++) {
            if (dist[a[j]] == INF) {
                continue;
            } 
            if (dist[b[j]] > dist[a[j]] + c[j]) {
                dist[b[j]] = dist[a[j]] + c[j];
            }
        }
    }
    LL ans = dist[n];
    for (int j = 0; j < m; j++) {
        if (dist[a[j]] == INF) {
            continue;
        } 
        if (dist[b[j]] > dist[a[j]] + c[j]) {
            dist[b[j]] = dist[a[j]] + c[j];
        }
    }
    if (ans != dist[n]) {
        cout << "inf" << endl;
    } else {
        cout << -ans << endl;
    }
}


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

Measured memory_bytes: 256
x = int(input())

if x <= 599:print(8)
elif x <= 799:print(7)
elif x <= 999:print(6)
elif x <= 1199:print(5)
elif x <= 1399:print(4)
elif x <= 1599:print(3)
elif x <= 1799:print(2)
elif x <= 1999:print(1)
else: print("pya")

Measured memory_bytes: 9120
//
// Created by 佐竹俊哉 on 2019/11/11.
//

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

typedef pair<int, int> pii;
typedef long long ll;
template<class T> using V = vector<T>;
template<class T> using VV = V<V<T>>;

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()
#define dump(x) cout << #x << " = " << (x) << endl
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n-1); }

template<class T, class U> void chmin(T& t, const U& u) { if (t > u) t = u; }
template<class T, class U> void chmax(T& t, const U& u) { if (t < u) t = u; }

template<class T, class U>
ostream& operator<<(ostream& os, const pair<T, U>& p) {
    os<<"("<<p.first<<","<<p.second<<")";
    return os;
}

template<class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
    os<<"{";
    rep(i, v.size()) {
        if (i) os<<",";
        os<<v[i];
    }
    os<<"}";
    return os;
}

int main() {
    int A, B;
    cin >> A >> B;
    int ans = -1;
    if (A <= 9 && B <= 9) ans = A * B;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {

    public static void main(String args[]) {

        // 入力
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        Long[] a = new Long[n];
        Arrays.setAll(a, i -> Long.parseLong(sc.next()));
        sc.close();

        // 主処理
        long left = 0;
        int leftIndex = 0;
        long right = 0;
        int rightIndex = n - 1;
        while (leftIndex != rightIndex) {
            if (left < right) {
                left += a[leftIndex];
                leftIndex++;
            } else {
                right += a[rightIndex];
                rightIndex--;
            }
        }
        if (left < right) {
            left += a[leftIndex];
        } else {
            right += a[rightIndex];
        }

        long result = Math.abs(left - right);

        // 出力
        System.out.println(result);
    }
}


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

using namespace std;

int main() {
	int a, b;
	scanf("%d %d", &a, &b);
	a = a == 1? 14: a;
	b = b == 1? 14: b;
	printf(a > b? "Alice": (b > a? "Bob": "Draw"));
}

Measured memory_bytes: 256
n = int(input())
count = 1

if n == 1:
    print(1.0000000000)
elif n == 0:
    print(0.0000000000)
elif n % 2 == 0:
    print(0.5000000000)
else:
    for i in range(1, n):
        if i % 2 == 1:
            count+=1
    print(count/n)

Measured memory_bytes: 2940
/*Hey, What's up?*/

#include<bits/stdc++.h>
using namespace std;
#define pi acos(-1.0)
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
string s;
int main()
{
    fastio;
    long long a=0,b=0,c,d,e,f=0,l,g,m,n,k,i,j,t,p,q;
    cin>>s;
    sort(s.begin(),s.end());
    if(s[0]==s[1]&&s[2]==s[3]&&s[1]!=s[2])cout<<"Yes\n";
    else cout<<"No\n";
    return 0;
}


Measured memory_bytes: 256
/**
 *      purpose : 
 *      author  : kyomukyomupurin
 *      created : 
**/

// input/output
#include <fstream>
#include <iostream>
#include <sstream>
// container class
#include <array>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
// math, algorithm
#include <algorithm>
#include <cmath>
#include <complex>
#include <numeric>
// etc
#include <bitset>
#include <cassert>
#include <cctype>
#include <cstring>
#include <chrono>
#include <ext/random>
#include <ext/rope>
#include <functional>
#include <iomanip>
#include <random>
#include <utility>
// using-directive
using namespace std;
// alias template
using int64 = long long;
using ull = unsigned long long;
using vi = std::vector<int>;
using vl = std::vector<int64>;
using pii = std::pair<int, int>;
using pll = std::pair<int64, int64>;
// text macro replacement
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(_) (_).begin(), (_).end()
#define rall(_) (_).rbegin(), (_).rend()
#define print(_) std::cout << (_) << '\n'
#define debug(_) std::cerr << #_ << ": " << (_) << '\n'
// variadic template
template<typename T> inline void chmin(T &a, T b) {if (a > b) a = b; return;}
template<typename T> inline void chmax(T &a, T b) {if (a < b) a = b; return;}
template<typename T> std::ostream& operator<<(std::ostream& os, const std::vector<T>& vec) {
  os << '{';
  for (size_t i = 0; i < vec.size(); ++i) {
    os << vec[i];
    if (i != vec.size() - 1) os << ',';
  }
  os << '}';
  return os;
}
template<typename T, typename U> std::ostream& operator<<(std::ostream& os, const std::pair<T, U>& p) {
  return os << '{' << p.first << " " << p.second << '}';
}
// constant
constexpr int INF = std::numeric_limits<int>::max() / 2;  // 1.073741823e9
constexpr int64 INF64 = std::numeric_limits<int64>::max() / 2;  // 4.611686018427387903e18
constexpr int MOD = 1000000007;

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

  int n; cin >> n;
  vector<int> l(n);
  for (int i = 0; i < n; ++i) cin >> l[i];
  sort(l.begin(), l.end());
  //debug(l);
  int ans = 0;
/*
  for (int i = 0; i < n - 1; ++i) {
    for (int j = i + 1; j < n; ++j) {
      int mx = l[i] + l[j];
      int pos = distance(l.begin(), lower_bound(l.begin(), l.end(), mx));
      ans += pos - j - 1;
    }
  }
*/

  for (int i = 0; i < n - 1; ++i) {
    for (int j = i + 1; j < n; ++j) {
      int mx = l[i] + l[j];
      int cnt = 0;
      for (int k = j + 1; k < n; ++k) {
        if (l[k] > mx) break;
        cnt += l[k] < mx;
      }
      ans += cnt;
    }
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<sstream>
#include<cstdlib>
#include<cmath>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<string>
#include<numeric>
#include<set>
using namespace std;

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

  vector<int> h(n);
  for(int i = 0; i < n; i++) cin >> h[i];

  int left, right;
  left = right = 0;
  priority_queue<int> que;
  que.push(0);

  while(right < n-1){
    if(h[right] >= h[right+1]){
      right++;
      if(right == n-1)
	que.push(right - left);
    }
    else{
      que.push(right-left);
      right++;
      left = right;
    }
  }

  cout << que.top() << endl;
  
  return 0;
}

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

bool isprime(int n)
{
    for (int i = 2; i * i <= n; i++) {
        if (n%i == 0) return false;
    }
    return true;
}

int main()
{
    int n;
    cin >> n;
    while (!isprime(n)) n++;
    cout << n << "\n";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
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 rep(i, n) for (int i = 0; i < (int)n; i++)
#define all(x) (x).begin(), (x).end() //sortなどの引数を省略したい
#define F first
#define S second

typedef long long ll;
const ll MOD = 1e9 + 7;
const int inf = 1000000;
const int minf = -1000000;
const ll lnf = 1e12;
const ll mlnf = -1e12;
const double e = 1e-10;

void debug_vector(vector<int>& v)
{
        int n = v.size();
            for (int i = 0; i < n; i++) {
                        cout << v[i] << " ";
                            }
                cout << endl;
}


//////////////////////
//// coding start ////
//////////////////////

// global variety


void solve();

int main(void)
{
        cin.tie(0);
            ios::sync_with_stdio(false);
                solve();
                    return 0;
}
void solve(){
    string N;
    cin >> N;
    string ans = "No";
    rep(i, 3) {
        if (N[i] == '7'){
            ans = "Yes";
        }
    }
    cout << ans << endl;
}



Measured memory_bytes: 3640
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<string>
#include<vector>
#include<stack>
#include<bitset>
#include<cstdlib>
#include<cmath>
#include<set>
#include<list>
#include<deque>
#include<map>
#include<queue>
using namespace std;
typedef long long ll;

int main(){
    ll n,d;
    while(cin>>n>>d){
        ll x[200005],y[200005];
        ll cnt=0;
        for(ll i=0;i<n;i++){
            cin>>x[i]>>y[i];
            if(x[i]*x[i]+y[i]*y[i]<=d*d){
                cnt++;
            }
        }
        cout<<cnt<<endl;
    }
    return 0;
}

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

using namespace std;

int a, b;

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

    cin >> a >> b;
    cout << (a - b * 2 < 0 ? 0 : a - b * 2) << '\n';

    return 0;
}

Measured memory_bytes: 3648
n, a, b = map(int, input().split())

ans = []

if abs(a - b) % 2 == 0:
    ans.append(abs(a - b) // 2)
else:
    m = min(a-1, n-b)
    ans.append(m + 1 + abs((a-m) - (b-m)) // 2)
    ans.append(min(b-1, n-a))

ans = min(ans)

print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define mod 1000000007

#define ll long long
#define EPS 0.00000000000001
#define ld long double
#define inf 1e6
#define N 1004

int32_t main()
{
    IOS;

    int h,w;
    cin >> h >> w;
    char v[h][w];
    for(int i = 0;i < h;i++)
    {
        for(int j = 0;j < w;j++)
        {
            cin >> v[i][j];
        }
    }
    vector<vector<int>> dist(h * w,vector<int>(h * w,inf));
    for(int i = 0;i < h;i++)
    {
        for(int j = 0;j < w;j++)
        {
            if(v[i][j] == '.')
            {
                int cur = i * w + j;
                dist[cur][cur] = 0;
                if(i + 1 < h and v[i + 1][j] == '.')
                {
                    int node = (i + 1) * w + j;
                    dist[cur][node] = dist[node][cur] = 1;
                }
                if(j + 1 < w and v[i][j + 1] == '.')
                {
                    int node = (i) * w + j + 1;
                    dist[cur][node] = dist[node][cur] = 1;
                }
            }
        }
    }
    for(int k = 0;k < h * w;k++)
    {
        for(int i = 0;i < h * w;i++)
        {
            for(int j = 0;j < h * w;j++)
            {
                dist[i][j] = min(dist[i][j],dist[i][k] + dist[k][j]);
            }
        }
    }
    int ans = 0;
    for(int i = 0;i < h * w;i++)
    {
        for(int j = 0;j < h * w;j++)
        {
            if(dist[i][j] != inf)
                ans = max(ans,dist[i][j]);
        }
    }
    cout << ans;


    return 0;

}
 


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

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)

using ll = long long;
using ld = long double;
ll INF = LLONG_MAX;

using vi = vector<int>;
using vll = vector<ll>;
using pii = pair<int, int>;

namespace output {
	void pr(int x) { cout << x; }
	void pr(long x) { cout << x; }
	void pr(ll x) { cout << x; }
	void pr(unsigned x) { cout << x; }
	void pr(unsigned long x) { cout << x; }
	void pr(unsigned long long x) { cout << x; }
	void pr(float x) { cout << x; }
	void pr(double x) { cout << x; }
	void pr(ld x) { cout << x; }
	void pr(char x) { cout << x; }
	void pr(const char* x) { cout << x; }
	void pr(const string& x) { cout << x; }
	void pr(bool x) { pr(x ? "true" : "false"); }
	template<class T> void pr(const complex<T>& x) { cout << x; }
	
	template<class T1, class T2> void pr(const pair<T1,T2>& x);
	template<class T> void pr(const T& x);
	
	template<class T, class... Ts> void pr(const T& t, const Ts&... ts) { 
		pr(t); pr(ts...); 
	}
	template<class T1, class T2> void pr(const pair<T1,T2>& x) { 
		pr("{",x.f,", ",x.s,"}"); 
	}
	template<class T> void pr(const T& x) { 
		pr("{"); // const iterator needed for vector<bool>
		bool fst = 1; for (const auto& a: x) pr(!fst?", ":"",a), fst = 0; 
		pr("}");
	}
	
	void print() { pr("\n"); } // print w/ spaces
	template<class T, class... Ts> void print(const T& t, const Ts&... ts) { 
		pr(t); if (sizeof...(ts)) pr(" "); print(ts...); 
	}
}

using namespace output;

int main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	ll A, V, B, W, T;
	cin >> A >> V >> B >> W >> T;
	
	bool ans = false;
	if (A <= B) {
		ans = (A + V * T >= B + W * T);
	} else {
		ans = (A - V * T  <= B - W * T);
	}
	if (ans) {
		print("YES");
	} else {
		print("NO");
	}
}

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

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vint;
typedef vector<double> vd;
typedef vector<ll> vll;
typedef vector<string> vstr;
typedef vector<vector<int>> vvint;
typedef vector<pair<int, int>> vpii;
typedef vector<pair<ll, ll>> vpll;
typedef priority_queue<int, vector<int>, greater<int>> spqint; //小さい順に取り出し
typedef priority_queue<ll, vector<ll>, greater<ll>> spqll;     //小さい順に取り出し
typedef priority_queue<int, vector<int>, less<int>> bpqint;    //大きい順に取り出し
typedef priority_queue<ll, vector<ll>, less<ll>> bpqll;        //大きい順に取り出し

#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define FOR(i, a, b) for (ll i = (ll)a; i < (ll)b; i++)
#define IREP(i, v) for (auto i = (v).begin(); i != (v).end(); i++)
#define FI first
#define SE second
#define MP make_pair
#define MT make_tuple
#define PB push_back
#define PF push_front
#define TS to_string
#define BS binary_search
#define LB lower_bound
#define UB upper_bound
#define NP next_permutation
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) (ll) x.size()
#define SP(x) setprecision((ll)x)


int INF = 1e9;
int NIL = -1;
ll MOD = 1000000007;
ll LINF = 1e18;
double EPS = 1e-9;
double PI = M_PI;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } //最大公約数
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }     //最小公倍数

void yes(){ cout << "Yes" << endl;}
void no(){ cout << "No" << endl;}
//-----------------------------------------
vector<long long> factor_array(long long n){
    vector<long long> res ;
    for(long long i=1;i*i<=n;i++){
        if(n%i==0){
            res.push_back(i) ;
            if(i*i!=n){
                res.push_back(n/i) ;
            }
        }
    }
    sort(res.begin(),res.end()) ;
    return res ;
}
//-----------------------------------------
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    std::chrono::system_clock::time_point start,end;
    start = std::chrono::system_clock::now();
    int n ;
    cin >> n ;
    vint a(n+1) ;
    REP(i,n){
        cin >> a[i+1] ;
    }
    vint cnt(n+1,0) ;
    set<int> ans ;
    for(int i=n;i>0;i--){
        if(cnt[i]%2!=a[i]){
            ans.insert(i) ;
            vll b = factor_array(i) ;
            REP(j,SZ(b)){
                cnt[b[j]]++ ;
            }
        }
    }
    cout << SZ(ans) <<endl;
    IREP(i,ans){
        cout << (*i) <<" ";
    }
    cout <<endl;




    end = std::chrono::system_clock::now();
    auto elapsed = std::chrono::duration_cast< std::chrono::milliseconds >(end - start).count();
    //std::cout << elapsed <<"ms"<< std::endl;

    

    return 0;
}



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

int main(void) {
  int n, ans = 0;
  string s;
  cin >> n >> s;
  for (int i = 0; i < n - 2; i++) {
    if (s[i] == 'A' && s[i + 1] == 'B' && s[i + 2] == 'C') {
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}


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

import sys
import os
import math

m = int(input())
n = int(input())

# Manage people who entered earlier than me in a list
G = [[] for i in range(m)]

for i in range(n):
    x, y = map(int, input().split())
    x -= 1
    y -= 1
    G[y].append(x)

printed = [False] * m

while printed.count(False) > 1:

    # Delete node with degree 0
    for i, node in enumerate(G):
        if not printed[i] and len(node) == 0:
            print(i+1)
            printed[i] = True

            # Erase his existence
            for node in G:
                if i in node:
                    node.remove(i)

# cat
if False in printed:
    i = printed.index(False)
    print(i+1)

Measured memory_bytes: 7784
n,k = map(int,input().split())
a = [0]+list(map(int,input().split()))
visited = [0]*(n+1)
turn = [0]*(n+1)
visited[1] = 0
nxt = 1
i = 1
while True:
  if visited[a[nxt]]:
    nxt2 = a[nxt]
    break
  turn[a[nxt]] = i
  visited[nxt] = 1
  i += 1
  nxt = a[nxt]

loop = i-turn[nxt2]
if turn[nxt2] == 0:
  loop = i
  start = 0
start = turn[nxt2]
#print(turn,i)
#print(start,loop)
if start == 0 and k % loop == 0:
  print(1)
  quit()
if k < i:
  print(turn.index(k))
else:
  print(turn.index(((k-start)%loop)+start))

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

#define f(i,a,b) for( ll i = a; i < b ; i++ ) 
#define af(i,a,b) for( ll i = a; i >= b ; i--)
#define rep(i,a,b,k) for(ll i = a; i < b ; i+= k )
#define arep(i,a,b,k) for( ll i = a; i >= b ; i-= k)
#define ones(x) (ll) __builtin_popcount(x)
#define fs first
#define sc second
#define pb push_back
#define po pop_back
#define mp make_pair	
#define sz(a) (ll) a.size()
#define all(a) a.begin(), a.end()
#define sor(a) sort( a.begin(), a.end() )
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL)
#define ller ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr)
#define yes cout<<"YES\n"
#define no cout<<"NO\n"
#define PI 3.1415926535
using namespace std;
typedef long long ll;
typedef long double ld;	
typedef pair<ll,ll> ii ;
typedef vector<ll>  vi ;
typedef vector<ii> vii ;
	 
const ll MAX = 10000000;
const ll inf = 5e18-1;


int main() {
	fastio;
	string s;
	ll k;
	cin>>k>>s;
	if(sz(s)<=k) cout<<s<<endl;
	else cout<<s.substr(0,k)<<"..."<<endl;

	return 0;
	}

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

using namespace std;
typedef long long ll;

#define REP(i, N) for (int i = 0; i < (int)N; i++)

#define M 20
#define N 50001

int d[M];
int DP[M][N];

int main () {
  int n, m;

  cin >> n >> m;
  REP(i,M) cin >> d[i];

  for(int x = 0; x <= n; x++) {
    for(int i = 0; i < m; i++) DP[i][x] = N;
  }
  for(int k = 0, kMax = n / d[0]; k <= kMax; k++) DP[0][k*d[0]] = k;

  for(int i = 1; i < m; i++) {
    for(int x = 0; x <= n; x++) {
      DP[i][x] = DP[i-1][x];
      if(x - d[i] >= 0)DP[i][x] = min(DP[i][x], DP[i][x- d[i]] + 1);
    }
  }

  cout << DP[m-1][n] << endl;

  return 0;
}

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

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)

using ll = long long;
using ld = long double;
ll INF = LLONG_MAX;

using vi = vector<int>;
using vll = vector<ll>;
using pii = pair<int, int>;

namespace output {
	void pr(int x) { cout << x; }
	void pr(long x) { cout << x; }
	void pr(ll x) { cout << x; }
	void pr(unsigned x) { cout << x; }
	void pr(unsigned long x) { cout << x; }
	void pr(unsigned long long x) { cout << x; }
	void pr(float x) { cout << x; }
	void pr(double x) { cout << x; }
	void pr(ld x) { cout << x; }
	void pr(char x) { cout << x; }
	void pr(const char* x) { cout << x; }
	void pr(const string& x) { cout << x; }
	void pr(bool x) { pr(x ? "true" : "false"); }
	template<class T> void pr(const complex<T>& x) { cout << x; }
	
	template<class T1, class T2> void pr(const pair<T1,T2>& x);
	template<class T> void pr(const T& x);
	
	template<class T, class... Ts> void pr(const T& t, const Ts&... ts) { 
		pr(t); pr(ts...); 
	}
	template<class T1, class T2> void pr(const pair<T1,T2>& x) { 
		pr("{",x.f,", ",x.s,"}"); 
	}
	template<class T> void pr(const T& x) { 
		pr("{"); // const iterator needed for vector<bool>
		bool fst = 1; for (const auto& a: x) pr(!fst?", ":"",a), fst = 0; 
		pr("}");
	}
	
	void print() { pr("\n"); } // print w/ spaces
	template<class T, class... Ts> void print(const T& t, const Ts&... ts) { 
		pr(t); if (sizeof...(ts)) pr(" "); print(ts...); 
	}
}

using namespace output;

int main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	string S; cin >> S;
	int N = S.size();
	FOR(i, 'a', 'z'+1) {
		int lo = 0;
		int hi = 0;
		while (lo < N && S[lo] != i) ++lo;
		while (lo < N) {
			while (hi != N && (hi <= lo || S[hi] != S[lo])) ++hi;

			if (hi == N) break;

			if (hi - lo <= 2) {
				print(lo + 1, hi + 1); return 0;
			}
			lo = hi;
		}
	}
	print(-1, -1);
}

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

vector<int>V[20];
int check[20];

int main()
{
    int n,m,x,c[20],a;
    cin >> n >> m >> x;
    for (int j=0; j<n; j++)
    {
        cin >> c[j];
        for (int i=0; i<m; i++)
        {
            cin >> a;
            V[j].push_back(a);
        }
    }
    int ans = 12345678;
    int all = 1<<n;
    bool T;
    for(int mask=0; mask<all; mask++)
    {
        for (int i=0;i<=m;i++)
            check[i]=0;
        T=false;
        int cost=0;
        for(int i=0; i<n; i++)
        {
            if((mask>>i)&1)
            {
                cost+=c[i];
                for(int j=0; j<m; j++)
                    check[j]+=V[i][j];
            }
        }
        for (int i=0; i<m; i++)
        {
            if (check[i]<x)
                T=true;
        }
        if (!T)
            ans=min(ans,cost);
    }
    if (ans==12345678)cout << -1 << endl;
    else cout << ans << endl;
}


Measured memory_bytes: 3648
from math import gcd
K=int(input())
g=0
for a in range(1,K-1):
  for b in range(a+1,K):
    for c in range(b+1,K+1):
      g+=gcd(gcd(a,b),c)*6
for  d in range(1,K):
  for e in range(d+1,K+1):
    g+=gcd(d,e)*6
g+=K*(K+1)//2
print(g)

Measured memory_bytes: 9180
#define _GLIBCXX_DEBUG //エラーを出すためのおまじない
#include <bits/stdc++.h>
using namespace std;
#define coYES cout << "YES" << endl
#define coNO cout << "NO" << endl
#define coYes cout << "Yes" << endl
#define coNo cout << "No" << endl
#define coyes cout << "yes" << endl
#define cono cout << "no" << endl
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
  int n;
  cin >> n;
  int max = -1;
  int max_num = -1;
  rep(i, n) {
    //cout << i << endl;
    int k = i+1;
    int count = 0;
    int kk = i+1;
    rep(j, 100000) {
      if (k % 2 == 1) {
        break;
      }
      k /= 2;
      count++;
    }
    //cout << count << endl;
    if (count > max) {
      max = count;
      max_num = kk;
    }
    //cout << max << " " << max_num << endl;
  }
  cout << max_num << endl;
}


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

int n,l,sum;

int main(){
    scanf ("%d %d",&n,&l);
    sum = (l+l+n-1)*n/2;
    if (n+l-1 >= 0 && 0 >= l){
        printf ("%d\n",sum);
    }else if (0 > n+l-1){
        printf ("%d\n",sum-(n+l-1));
    }else{
        printf ("%d\n",sum-l);
    }
}


Measured memory_bytes: 384
#include "bits/stdc++.h"
using namespace std;

typedef long long ll;

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

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

	string t;
	for (int i = 0; i < s.length(); i++) {
		if (s[i] != 'x') t.push_back(s[i]);
	}
	vector<int> a; int idx=0;
	for (int i = 0; i < t.length(); i++) {
		while (1) {
			if (s[idx] == t[i]) {
				a.push_back(idx);
				idx++;
				break;
			}
			idx++;
		}
	}
	//REP(i,a.size()) cout << a[i] <<" "; cout << endl;

	if (a.size() == 0) {
		cout << 0 << endl;
		return 0;
	}

	// tが回文であるかの判定
	int f=0, l=t.length()-1;
	bool flag=true;
	while (1) {
		if (t[f] != t[l]) {
			flag = false;
			break;
		}
		f++; l--;
		if(l<f) break;
	}
	if (!flag) {
		cout << -1 << endl;
		return 0;
	}

	if (a.size() == 1) {
		int xcnt1 = 0, xcnt2 = 0;
		int b = a[0];
		for (int i = 0; i < b; i++) {
			if (s[i] == 'x') xcnt1++;
		}
		for (int i = b; i < s.length(); i++) {
			if(s[i]=='x') xcnt2++;
		}
		cout << abs(xcnt1-xcnt2) << endl;
		return 0;
	}

	// inserting 'x'
	string s1, s2;
	int b = a[a.size()/2], c = a[a.size()/2-1];

	//cout << b <<" "<< c << endl;
	if (a.size() % 2 == 0){
		int d = (b+c)/2;
		//cout << d << endl;
		if ((b-c) % 2 == 0) {
			for (int i = d - 1; i >= 0; i--) {
				s1.push_back(s[i]);
			}
			for (int i = d + 1; i < s.length(); i++) {
				s2.push_back(s[i]);
			}
		}
		else {
			for (int i = d; i >= 0; i--) {
				s1.push_back(s[i]);
			}
			for (int i = d + 1; i < s.length(); i++) {
				s2.push_back(s[i]);
			}
		}
	}
	else {
		for (int i = b - 1; i >= 0; i--) {
			s1.push_back(s[i]);
		}
		for (int i = b + 1; i < s.length(); i++) {
			s2.push_back(s[i]);
		}
	}
	//cout << s1 <<" "<< s2 << endl;
	vector<int> s1c(s.length(),0), s2c(s.length(),0);
	int indx=0;
	for (int i = 0; i < s1.length(); i++) {
		if (s1[i] == 'x') {
			s1c[indx]++;
		}
		else {
			indx++;
		}
	}
	indx=0;
	for (int i = 0; i < s2.length(); i++) {
		if (s2[i] == 'x') {
			s2c[indx]++;
		}
		else {
			indx++;
		}
	}

	int ans=0;
	for (int i = 0; i < s.length(); i++) {
		ans += abs(s1c[i]-s2c[i]);
	}
	cout << ans << endl;
}



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

int main()
{
    vector<vector<int>> A(3, vector<int>(3, 0));
    rep(i, 3)
    {
        rep(j, 3)
        {
            cin >> A.at(i).at(j);
        }
    }
    int N;
    cin >> N;
    vector<int> b(N);
    rep(i, N)
    {
        cin >> b.at(i);
    }
    rep(k, N)
    {
        rep(i, 3)
        {
            rep(j, 3)
            {
                if (A.at(i).at(j) == b.at(k))
                {
                    A.at(i).at(j) = 1;
                }
            }
        }
    }
    if (A.at(0).at(0) == 1 & A.at(0).at(1) == 1 & A.at(0).at(2) == 1)
    {
        cout << "Yes" << endl;
    }
    else if (A.at(1).at(0) == 1 & A.at(1).at(1) == 1 & A.at(1).at(2) == 1)
    {
        cout << "Yes" << endl;
    }
    else if (A.at(2).at(0) == 1 & A.at(2).at(1) == 1 & A.at(2).at(2) == 1)
    {
        cout << "Yes" << endl;
    }
    else if (A.at(0).at(0) == 1 & A.at(1).at(0) == 1 & A.at(2).at(0) == 1)
    {
        cout << "Yes" << endl;
    }
    else if (A.at(0).at(1) == 1 & A.at(1).at(1) == 1 & A.at(2).at(1) == 1)
    {
        cout << "Yes" << endl;
    }
    else if (A.at(0).at(2) == 1 & A.at(1).at(2) == 1 & A.at(2).at(2) == 1)
    {
        cout << "Yes" << endl;
    }
    else if (A.at(0).at(0) == 1 & A.at(1).at(1) == 1 & A.at(2).at(2) == 1)
    {
        cout << "Yes" << endl;
    }
    else if (A.at(0).at(2) == 1 & A.at(1).at(1) == 1 & A.at(2).at(0) == 1)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
}

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

using namespace std;

struct Info{
  string s;
  int p;
  int orig_num;

  bool operator<(const Info &another) const{
    return (s == another.s) ? (p > another.p) : s < another.s;
  }
};

struct InfoB{
  int num;  // 紹介順
  int orig_num;
  bool operator<(const InfoB &another) const{
    return orig_num < another.orig_num;
  }
};
int main(){
  int n;
  vector <Info> ifo;
  cin >> n;
  cin.ignore();
  Info infom;
  for (int i = 0; i < n; i++){
    cin >> infom.s >> infom.p;
    infom.orig_num = i;
    cin.ignore();
    ifo.push_back(infom);
  }
  sort(ifo.begin(), ifo.end());

  for (int i = 0; i < n; i++){
    //cout << ifo[i].s << " " << ifo[i].p << endl;
    cout << ifo[i].orig_num + 1 << endl;
  }

  return 0;
  
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int a[256],n;
  for(int i=0;i<10;i++)a['0'+i]=i;
  for(int i=0;i<26;i++)a['a'+i]=10+i;
  for(int i=0;i<26;i++)a['A'+i]=36+i;
  cin>>n;
  int b,an1=0,an2=0;
  while(n--){
    int num=0;
    string s;
    cin>>b>>s;
    for(int i=s.size()-1,k=1;i>=0;i--,k*=b)num+=k*a[s[i]];
    int t=0;
    while(num){
      if(num%2)t++;
      else{
	if(t==1)an1++;
	if(t>=2)an2++;
	t=0;      
      }
      num/=2;
    }
      if(t==1)an1++;
      if(t>=2)an2++;
  }
  if(an2>0||an1%2)cout<<"win"<<endl;
  else cout <<"lose"<<endl;
  return 0;
}

Measured memory_bytes: 1200
#include <iostream>
#include <algorithm>
#include <complex>
#include <cstdio>
#include <vector>
using namespace std;
typedef complex<double> P;

struct L : public vector<P> {
  L() {}
  L(P a, P b) {
    push_back(a);
    push_back(b);
  }
};

const int MAX_N = 15;
const int INF = 1<<29;
int N;
L Ls[MAX_N];
double T[1<<MAX_N][MAX_N][2];
double G[MAX_N][2][MAX_N][2];

void make() {
  for(int i = 0; i < N; ++i) {
    for(int ii = 0; ii < 2; ++ii) {
      for(int j = 0; j < N; ++j) {
	for(int jj = 0; jj < 2; ++jj) {
	  if(i == j) G[i][ii][j][jj] = INF;
	  else G[i][ii][j][jj] = abs(Ls[j][jj] - Ls[i][ii]);
	}
      }
    }
  }
}

double sum() {
  double res = 0;
  for(int i = 0; i < N; ++i) {
    res += abs(Ls[i][1] - Ls[i][0]);
  }
  return res;
}

double solve() {
  make();
  fill(T[0][0], T[1<<MAX_N][0], INF);
  for(int i = 0; i < N; ++i)
    for(int ii = 0; ii < 2; ++ii)
      T[1<<i][i][ii] = 0;

  for(int S = 1; S < (1<<N); ++S) {
    for(int i = 0; i < N; ++i) {
      if(S & (1<<i)) continue;
      int nS = S | (1<<i);
      for(int ii = 0; ii < 2; ++ii) {
	for(int j = 0; j < N; ++j) {
	  for(int jj = 0; jj < 2; ++jj) {
	    T[nS][i][ii] = min(T[nS][i][ii], T[S][j][jj] + G[j][1-jj][i][ii]);
	  }
	}
      }
    }
  }
  double mini = INF;
  for(int i = 0; i < N; ++i) {
    mini = min(mini, min(T[(1<<N)-1][i][0],T[(1<<N)-1][i][1]));
  }
  return sum() + mini;
}

int main() {
  int t = 1;
  while(cin >> N && N) {
    for(int i = 0; i < N; ++i) {
      P s, d;
      cin >> s.real() >> s.imag() >> d.real() >> d.imag();
      Ls[i] = L(s,d);
    }
    printf("Case %d: %.5f\n", t++, solve());
  }
  return 0;
}

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

#define pb push_back

const int N = 3e5 + 11;

vector<int> v[N];
int dp[N],mx[N],mxx[N];
int use[N];
int prr[N];
int k,tin[N],tout[N],kk;
int vv[N*4];
set<int> st;
int n;

void build(int i, int l, int r)
{
    if (l==r) {vv[i]=2e9; return;}
    int mid=(l+r)/2;
    build(i*2,l,mid);
    build(i*2+1,mid+1,r);
    vv[i]=2e9;
}

void update(int i, int l, int r, int x, int t)
{
    if (l==r) {vv[i]=t; return;}
    int mid=(l+r)/2;
    if (x<=mid) update(i+i,l,mid,x,t); else update(i+i+1,mid+1,r,x,t);
    vv[i]=min(vv[i+i],vv[i+i+1]);
}

int get(int i, int l, int r, int tl, int tr)
{
    if (tl<=l&&r<=tr) return vv[i];
    if (tl>r||l>tr) return 2e9;
    int mid=(l+r)/2;
    return min(get(i+i,l,mid,tl,tr),get(i+i+1,mid+1,r,tl,tr));
}

void add_dv(int l)
{
    st.insert(l);
    update(1,1,n,tin[l],l);
}

void del_dv(int l)
{
    st.erase(l);
    update(1,1,n,tin[l],2e9);
}

void add(int l)
{
    k++;
    del_dv(l);
    for (int j=0; j<v[l].size(); j++)
        if (v[l][j]!=prr[l]) add_dv(v[l][j]);
}

void del(int l)
{
    k--;
    add_dv(l);
    for (int j=0; j<v[l].size(); j++)
        if (v[l][j]!=prr[l]) del_dv(v[l][j]);
}

void dfs1(int l, int pr)
{
    prr[l]=pr;
    kk++;
    tin[l]=kk;
    for (int j=0; j<v[l].size(); j++)
        if (v[l][j]!=pr) dfs1(v[l][j],l);
    tout[l]=kk;
}

void dfs2(int l)
{
    ///cout<<l<<": "<<endl;
    mx[l]=max(l,mx[prr[l]]);
    vector<int> p;
    if (st.find(l)!=st.end())
    {
        ///cout<<"+ "<<l<<endl;
        p.pb(l);
        add(l);
    }
    while (1)
    {
        int r=get(1,1,n,tin[l],tout[l]);
        if (r>mx[prr[l]]) break;
        ///cout<<"+ "<<r<<endl;
        p.pb(r);
        add(r);
    }
    ///cout<<l<<" = "<<k<<endl;
    dp[l]=k;
    for (int j=0; j<v[l].size(); j++)
        if (v[l][j]!=prr[l]) dfs2(v[l][j]);
    for (int t=p.size()-1; t>=0; t--)
    {
        int r=p[t];
        ///cout<<"- "<<r<<endl;
        del(r);
    }
}

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin>>n;
    for (int i=1; i<n; i++)
    {
        int l,r;
        cin>>l>>r;
        v[l].pb(r);
        v[r].pb(l);
    }
    dfs1(1,0);
    build(1,1,n);
    dp[1]=0;
    mx[1]=1;
    k=0;
    for (int j=0; j<v[1].size(); j++)
        add_dv(v[1][j]);
    for (int j=0; j<v[1].size(); j++)
        dfs2(v[1][j]);
    for (int i=2; i<=n; i++)
        cout<<dp[i]<<" ";
    cout<<endl;
}


Measured memory_bytes: 44648
local n,m=io.read("n","n")
local w,v={},{}
for i=1,n do
    w[i],v[i]=io.read("n","n")
end

local dp={}
for i=1,n+1 do
    dp[i]={}
    for j=0,m do
        dp[i][j]=0
    end
end

for i=1,n do
    for j=0,m do
        if j-w[i]>=0 then
            dp[i+1][j]=math.max(dp[i+1][j],dp[i][j-w[i]]+v[i])
        end
        dp[i+1][j]=math.max(dp[i+1][j],dp[i][j])
    end
end

print(string.format("%d",dp[n+1][m]))

Measured memory_bytes: 106416
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <set>
#include <queue>
#include <stack>
using namespace std;
typedef long long int ll;

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

void P(int x) {cout << x << endl;}
void P(long x) {cout << x << endl;}
void P(double x) {cout << x << endl;}
void P(ll x) {cout << x << endl;}
void P(string x) {cout << x << endl;}
void P(char x) {cout << x << endl;}

#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define drep(i, n) for(int i = n - 1; i >= 0; i--)

const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;

int main() {
  string s, t;
  cin >> s >> t;
  int flag = 0;
  rep (i, s.size()) {
    if (s[i] != t[i]) {
      No;
      return 0;
    }
  }
  Yes;
  return 0;
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
int n,M[105][105];
void djkstr(){
  int minv;
  int d[105],color[105];

  for(int i=0;i<n;i++){
    d[i]= 1234567890;
    color[i]=0;
  }
  d[0]=0;
  color[0]=1;
  while(1){
    minv = 1234567890;
    int u = -1;
    for(int i=0;i<n;i++){
      if(minv>d[i]&&color[i]!=2){
	u=i;
	minv = d[i];
      }
    }
    if(u==-1)break;
    color[u]=2;
    for(int v=0;v<n;v++){
      if(color[v]!=2&&M[u][v]!=1234567890){
	if(d[v]>d[u]+M[u][v]){
	  d[v]=d[u]+M[u][v];
	  color[v]=1;
	}
      }
    }
  }
  for(int i=0;i<n;i++){
    cout << i << " " << (d[i]==1234567890?-1:d[i])<<endl;
  }
}
int main(){
  cin >> n;
  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
      M[i][j]=1234567890;
    }
  }
  int k,c,u,v;
  for(int i=0;i<n;i++){
    cin >> u >> k;
    for(int j=0;j<k;j++){
      cin >> v >> c;
      M[u][v]=c;
    }
  }
  djkstr();
  return 0;
}

    

Measured memory_bytes: 3124
#include <cstdio>
#define swap(a, b) { ll t = a; a = b; b = t; }
typedef long long ll;
ll gcd(ll a, ll b) {
	if (a < b) swap(a, b);
	return b ? gcd(b, a % b) : a;
}
ll lcm(ll a, ll b) {
	return a * b / gcd(a, b);
}
int main(void)
{
	ll x, y;
	scanf("%lld %lld", &x, &y);
	ll ans = x * (lcm(x, y) / x - 1);
	printf("%lld", ans ? ans : -1);
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll=long long;
const int MOD=(int)1e9+7;
const int INF=(int)1e9;
const ll LINF=(ll)1e18;

int main(){
    ll n;cin >> n;
    if(n%2==1){
        cout << 0 << endl;
        return 0;
    }
    ll k=10;
    ll ans=0;
    while(n/k>0){
        ans += n/k;
        k *= 5;
    }
    cout << ans << endl;
}

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

using namespace std;

#define int long long

#ifndef bhupixb
    #define var(...)
    #define stl(...)
#endif

#define single_test

void solve() {
    int a, b, c, d;
    int ans = -2e18;
    cin >> a >> b >> c >> d;
    ans = max(ans, a * d);
    ans = max(ans, a * c);
    ans = max(ans, b * d);
    ans = max(ans, c * b);
    cout << ans << '\n';
}

signed main() {
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int t = 1;
    #ifndef single_test
        cin >> t;
    #endif
    for (int i = 1; i <= t; ++i) {
        // cout << "Case #" << i << ": ";
        solve();
    }

    return 0;
}

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

using namespace std;

char str[10];

int main() {
	scanf("%s", str);
	for (int i = 0; i < 3; ++i) {
		if (str[i] == str[i+1]) {
			printf("Bad\n");
			return 0;
		}
	}
	printf("Good\n");
	return 0;
}


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

using namespace std;

int main(void) {

  string s;
  int K;

  cin >> s;
  cin >> K;

  for(int i = 0; K > 0 && i < (int)s.size(); i++) {
    if(s[i] == 'a') continue;
    int diff = 'z' - s[i] + 1;
    if(diff <= K) {
      K -= diff;
      s[i] = 'a';
    }
  }

  if(K > 0) s[s.size()-1] += K%26;

  printf("%s\n", s.c_str());
}

Measured memory_bytes: 512
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric;

alias OP = Tuple!(int, "y", int, "x", int, "ny", int, "nx");

int[500][500] AS;
OP[500 * 500] OPS;

void main()
{
    auto hw = readln.split.to!(int[]);
    auto H = hw[0];
    auto W = hw[1];

    foreach (i; 0..H) {
        foreach (j, a; readln.split.to!(int[])) {
            AS[i][j] = a;
        }
    }

    if (H == 1 && W == 1) {
        writeln("0");
        return;
    }

    int x, y, nx, ny;
    if (W == 1) {
        ny = 1;
    } else {
        nx = 1;
    }

    int gx, gy = H-1;
    if (H % 2) gx = W-1;

    int i;
    for (;;) {
        if (AS[y][x] % 2) {
            OPS[i++] = OP(y, x, ny, nx);
            AS[ny][nx] += 1;
        }
        if (nx == gx && ny == gy) break;
        x = nx;
        y = ny;
        if (y % 2) {
            nx -= 1;
            if (nx < 0) {
                nx += 1;
                ny += 1;
            }
        } else {
            nx += 1;
            if (nx >= W) {
                nx -= 1;
                ny += 1;
            }
        }
    }
    writeln(i);
    foreach (op; OPS[0..i]) {
        writefln("%d %d %d %d", op.y+1, op.x+1, op.ny+1, op.nx+1);
    }
}

Measured memory_bytes: 11132
/* Just_Do_It ___________ICARUS__________________*/
                     
    #include <bits/stdc++.h>
    using namespace std;
           
    typedef long long ll;
    #define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    #define rep(i,a,n) for(int i=a;i<n;i++)
    #define per(i,n,a) for (int i=n;i>a;i--)
    #define te int t; std::cin >> t; while(t--)
    #define SZ 200010
    //# define M_PIl  3.141592653589793238462643383279502884L 
    /*   Proceed with CAUTION   */
    

    pair<ll,ll> fa[SZ],fb[SZ];
    int main(){
        fastio;
        ll n;
        cin>>n;
        rep(i,0,n) {
          ll x;
          cin>>x;
          if(i%2) fa[x].first++ , fa[x].second = x;  
          else  fb[x].first++ , fb[x].second = x;
        }
        sort(fa,fa+SZ);
        sort(fb,fb+SZ);
        //cout<<fa[SZ-1].first<<" "<<fb[SZ-1].first<<endl;
        if(fa[SZ-1].second == fb[SZ-1].second) cout<<min(n-fa[SZ-1].first-fb[SZ-2].first , n-fa[SZ-2].first-fb[SZ-1].first);
        else cout<<n-fa[SZ-1].first-fb[SZ-1].first<<endl;

    }

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

using namespace std;

#define int long long
#define nl '\n'

#define st first
#define nd second
#define ins insert

#define pb push_back
#define mp make_pair

#define hashmap unordered_map
#define hashset unordered_set

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


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

#define rep(i, n) for(int i = 0; i<(n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef long long ll;

int INF = 100100100;

int G[110][110];

struct Edge {
    int a, b, c;
};

int main() {
    int N, M;
    cin >> N >> M;
    rep(i, N) {
        rep(j, N) {
            G[i][j] = INF;
        }
        G[i][i] = 0;
    }

    vector<Edge> edges;
    rep(i, M) {
        int a, b, c;
        cin >> a >> b >> c;
        a--;
        b--;
        G[a][b] = c;
        G[b][a] = c;
        edges.push_back(Edge{a, b, c});
    }

    rep(k, N) rep(i, N) rep(j, N) chmin(G[i][j], G[i][k] + G[k][j]);
    int ans = 0;
    rep(i, M) if (G[edges[i].a][edges[i].b] < edges[i].c && G[edges[i].b][edges[i].a] < edges[i].c) ans++;
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
 
int main() {
  int n, l;
  scanf("%d%d", &n, &l);
  if (l<=0 && l+n-1>=0) {
    printf("%d\n", n*(2*l+n-1)/2);
  } else if (l>0) {
    printf("%d\n", (n-1)*(2*l+n)/2);
  } else {
    printf("%d\n", (n-1)*(2*l+n-2)/2);
  }
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <queue>

using namespace std;

typedef pair<int, int> P;
typedef pair<int, P> Q;

int main() {
	vector< vector<int> > hyou(201, vector<int>(201, 0));
	int t, n, x, y;
	while (cin >> t >> n) {
		if (t == 0 && n == 0) {
			break;
		}
		for (int i = 0; i < 200; i++) {
			for (int j = 0; j < 200; j++) {
				hyou[i][j] = 0;
			}
		}
		for (int i = 0; i < n; i++) {
			cin >> x >> y;
			hyou[x+100][y+100] = -1;
		}
		cin >> x >> y;
		queue<Q> q;
		Q qq;
		qq.first = 0;
		(qq.second).first = x+100;
		(qq.second).second = y+100;
		q.push(qq);
		int counter = 1;
		hyou[x+100][y+100] = -1;
		int dx[] = {0, 1, 1, 0, -1, -1};
		int dy[] = {1, 1, 0, -1, -1, 0};
		while (!q.empty()) {
			Q p = q.front();
			q.pop();
			for (int i = 0; i < 6; i++) {
				if (hyou[(p.second).first+dx[i]][(p.second).second+dy[i]] == 0) {
					counter++;
					hyou[(p.second).first+dx[i]][(p.second).second+dy[i]] = -1;
					Q p2 = p;
					p2.first++;
					(p2.second).first += dx[i];
					(p2.second).second += dy[i];
					if (p2.first < t) {
						q.push(p2);
					}
				}
			}
		}
		cout << counter << endl;
	}
	return 0;
}

Measured memory_bytes: 1348
n,t = map(int,input().split())
arr = list(map(int,input().split()))


now = 0
ans = 0
for i in range(n-1):
    if arr[i+1]-arr[i] <= t:
        ans += arr[i+1]-arr[i]
    else:
        ans += t

ans += t

print(ans)

Measured memory_bytes: 26708