akhauriyash/Code-Regression huggingface dataset:
fun main() {
    var k: Int
    var s: String
    do {
        k = readLine()?.toInt() ?: 1
    } while (k !in 1..100)
    do {
        s = readLine() ?: ""
    } while (s?.length !in 1..100)
    when (s.length <= k) {
        true -> print(s)
        false -> print(s.substring(0, k) + "...")
    }
}

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

template<class T> void vin(vector<T>& v, int n) {
    v.resize(n);
    for (int i = 0; i < n; ++i) {
        cin >> v[i];
    }
}

int main() {
    ll N, L, T, gap = 0;
    cin >> N >> L >> T;
    vector<ll> p;
    rep(i, N) {
        int x, w;
        cin >> x >> w;
        ll pos = x + T*(w==1 ? 1 : -1);
        ll np = ((pos%L)+L)%L;
        gap += (pos > 0 ? pos / L : (pos - L + 1) / L);
        p.push_back(np);
    }
    //cout << gap << endl;
    sort(p.begin(), p.end());
    gap = ((gap%N)+N)%N;
    rep(i, N) {
        cout << p[(i + gap)%N] << endl;
    }
    return 0;
}


Measured memory_bytes: 2164
#include<bits/stdc++.h>
using namespace std;
#define int long long
typedef long long ll;
#define mk make_pair
#define pb push_back
#define pf push_front
typedef pair<int, int> pii;
#define INF (1 << 30)
#define INFL (1ll << 60ll);
#define mod 1000000007

int N, M;
pii c[200200];

signed main()
{
    cin >> N >> M;
    for(int i = 0; i < N; i++){
        int a, b;
        cin >> a >> b;
        c[i] = mk(a, b);
    }
    sort(c, c + N);
    int ans = 0ll;
    for(int i = 0; i < N; i++){
        int a, b;
        a = c[i].first;
        b = c[i].second;
        if(b < M){
            ans += a * b;
            M -= b;
        }
        else {
            ans += a * M;
            break;
        }
    }
    cout << ans << endl;



    return 0;
}


Measured memory_bytes: 1792
/**
*   @author: Kshitiz Srivastava (Pirate_ksh) @ MNNIT Allahabad
*/
#include<bits/stdc++.h>
using namespace std;
 
// General
#define ll long long
#define ld long double
#define io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define mod 1000000007 // 998244353
#define PI 3.1415926535897932384
#define endl "\n"
#define debug(x) cout<<x<<endl
#define REP(i,n) for(i=0;i<n;++i)
#define FOR(i,x,n) for(i=x;i<n;++i)
#define RREP(i,n) for(i=n-1;i>=0;--i)
#define RFOR(i,x,n) for(i=n-1;i>=x;--i)
#define TR(i,c) for(auto i=c.begin();i!=c.end();++i)
#define RTR(i,c) for(auto i=c.rbegin();i!=c.rend();++i)
#define sz(a) a.size()
 
// Bounds
#define lb(a,x) a.lower_bound(x)
#define ub(a,x) a.upper_bound(x)
#define all(a) a.begin(),a.end()
 
// Vector
#define vi vector <int>
#define pb(v,x) v.push_back(x)
#define vll vector <ll>
 
// Map
#define mii map <int, int>
#define umii unordered_map <int, int>
 
// Set
#define si set <int>
#define msi multiset<int>
 
// Pair
#define vpii vector<pair < int, int > >
#define vpll vector<pair < ll, ll > >
#define pii pair < int, int >
#define mp(a,b) make_pair(a,b)
#define F first
#define S second
#define vppi vector<pair<pair<int,int>,int>>
#define ppi pair<pair<int,int>,int>

void solve();

int main(){
    io
    ll t;
    t=1;
    // cin >> t;
    for(int i=0;i<t;++i) solve();
    return 0;
}

void solve() {
    ll i, j, n;
    cin >> n;
    vector<ll> a(n), b(n);
    REP(i,n) {
        cin >> a[i];
        b[i] = a[i];
    }
    // REP(i,n) cout << a[i] << " ";
    mii mp;
    bool flg = false;
    // Pairwise
    REP(i,n) {
        for(j=2; j*j<=a[i];++j) {
            if(a[i] % j == 0) {
                ll cnt = 0;
                while(a[i] % j == 0) {
                    a[i] /= j;
                    ++cnt;
                }
                if(mp[j] > 0) {
                    flg  = true;
                    break;
                }
                else mp[j] = cnt;
            }
        }
        if(a[i] > 1) {
            if(mp[a[i]] > 0) {
                flg  = true;
                break;
            }
            else {
                mp[a[i]] = 1;
            }
        }
        if(flg) break;
    }
    // REP(i,n) cout << a[i] << " ";
    if(!flg) {
        cout << "pairwise coprime\n";
        return;
    }

    else {
        // Setwise
        ll gc = b[0];
        // cout << "gc=" << gc << endl;
        FOR(i,1,n) {
            gc = __gcd(gc, b[i]);
            // cout << "gc=" << gc << endl;
        }
        if(gc == 1) cout << "setwise coprime\n";
        else cout << "not coprime\n";
    }
}


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

int main(){
  int N; cin >> N;
  int h[100000];
  for(int i=0; i<N; i++) cin >> h[i];
  int dp[100000]={};
  dp[1]=abs(h[1]-h[0]);
  for(int i=2; i<N; i++){
    dp[i]=min(dp[i-2]+abs(h[i]-h[i-2]),dp[i-1]+abs(h[i]-h[i-1]));
  }
  cout << dp[N-1] << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<double,double> pd;

typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pi> vpi;

template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

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

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()

const int MOD = 998244353;
const ll INF = 1e18;
const int MX = 100001;

int get(string s) {
    map<string,int> all;
    map<string,string> pre;
    vector<string> q;
    
    q.pb(s); all[s] = 0;
    while (sz(q)) {
        s = q.back(); q.pop_back();
        F0R(i,sz(s)-1) if (s[i] != s[i+1]) {
            int x = 3-(s[i]-'a')-(s[i+1]-'a');
            string S = s;
            S[i] = S[i+1] = char('a'+x);
            if (!all.count(S)) {
                all[S] = all[s]+1;
                pre[S] = s;
                q.pb(S);
            }
        }
    }
    
    return sz(all);
}

bool dif(string s) {
    F0R(i,sz(s)-1) if (s[i] == s[i+1]) return 0;
    return 1;
}

int po(int a, int b) {
    ll ans = 1;
    F0R(i,b) ans = ans*a%MOD;
    return ans;
}

bool same(string s) {
    F0R(i,sz(s)-1) if (s[i] != s[i+1]) return 0;
    return 1;
}


string s; 

int solve(int t) {
    return po(3,sz(s)-1);
}

array<array<int,3>,3> tmp;

int solveDif(int t) {
    F0R(i,3) tmp[i][i] = 1;
    FOR(i,2,sz(s)+1) {
        array<array<int,3>,3> TMP = array<array<int,3>,3>();
        F0R(a,3) F0R(b,3) F0R(c,3) if (c != b) TMP[(a+c)%3][c] = (TMP[(a+c)%3][c]+tmp[a][b])%MOD;
        tmp = TMP;
    }
    return ((tmp[t][0]+tmp[t][1])%MOD+tmp[t][2])%MOD;
}

int sum(string s) {
    int su = 0;
    for (char c: s) su += c-'a';
    return su%3;
}

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin >> s;
    if (sz(s) <= 3) cout << get(s);
    else if (same(s)) cout << 1;
    else {
        int t = sum(s);
        int ans = (solve(t)-solveDif(t)+MOD)%MOD;
        if (dif(s)) ans = (ans+1)%MOD;
        cout << ans << "\n";
    }
}

// read the question correctly (is y a vowel? what are the exact constraints?)
// look out for SPECIAL CASES (n=1?) and overflow (ll vs int?)

Measured memory_bytes: 788
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Edge = pair<int, int>;
using Graph = vector<vector<Edge>>;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
const ll MOD = 1000000007;
const ll nmax = 8;
const ll INF = 1e9;
bool graph[nmax][nmax];
vector<vector<ll>> dist = vector<vector<ll>>(nmax, vector<ll>(nmax, INF));
void warshall_floyd(ll n)
{
    for (size_t i = 0; i < n; i++)
    {
        for (size_t j = 0; j < n; j++)
        {
            for (size_t k = 0; k < n; k++)
            {
                dist[j][k] = min(dist[j][k], dist[j][i] + dist[i][k]);
            }
        }
    }
}

class UnionFind
{
  public:
    vector<ll> Parent;

    UnionFind(ll N)
    {
        Parent = vector<ll>(N, -1);
    }
    ll find(ll A)
    {
        if (Parent[A] < 0)
            return A;
        return Parent[A] = find(Parent[A]);
    }

    ll size(ll A)
    {
        return -Parent[find(A)];
    }

    bool Union(ll A, ll B)
    {
        A = find(A);
        B = find(B);
        if (A == B)
        {
            return false;
        }
        if (size(A) < size(B))
            swap(A, B);

        Parent[A] += Parent[B];
        Parent[B] = A;

        return true;
    }
};

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

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

ll mulMod(ll a, ll b)
{
    return (((a % MOD) * (b % MOD)) % MOD);
}

ll powMod(ll a, ll p)
{
    if (p == 0)
    {
        return 1;
    }
    else if (p % 2 == 0)
    {
        ll half = powMod(a, p / 2);
        return mulMod(half, half);
    }
    else
    {
        return mulMod(powMod(a, p - 1), a);
    }
}

ll ceil(ll a, ll b)
{
    return (a + b - 1) / b;
}

const string YES = "Yes";
const string NO = "No";

void solve(long long N){
    for (int i = 1; i <= 9; i++)
    {
        for (int j = 1; j <=9; j++)
        {
            if(i*j == N){
                cout << YES << endl;
                return;
            }
        }
        
    }
    cout << NO << endl;
    
}

int main(){
    long long N;
    scanf("%lld",&N);
    solve(N);
    return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3

n = int(input())


pn = [2, ]
A = 3000
for L in range(5, A):
    chk = True
    for L2 in pn:
        if L % L2 == 0:
            chk = False
    if chk:
        pn.append(L)
# print(pn)

for i in pn:
    if i % 5 == 2:
        print(i, "", end="")
        n -= 1
    if n == 0:
        exit()


# print(*ans)


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

namespace 鉛筆
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] nabcd = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int ans = Math.Min((nabcd[0] / nabcd[1] + (nabcd[0] % nabcd[1] != 0 ? 1 : 0)) * nabcd[2], (nabcd[0] / nabcd[3] + (nabcd[0] % nabcd[3] != 0 ? 1 : 0)) * nabcd[4]);
            Console.WriteLine(ans);
        }
    }
}



Measured memory_bytes: 18424
#include <iostream>
using namespace std;
int a[8]={0,64,32,16,8,4,2,1};
int main()
{
	int n;
	cin>>n;
	for(int i=1;i<=8;i++)
		if(n>=a[i])
		{
			cout<<a[i]<<endl;
			break;
		}
	return 0;
}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;
 
public class Main {
    public static void main(String[] args) {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        try {
            String line;
            /* input */
            while(true){
                line = br.readLine();
                
                String str = line.split(" ")[0], type = line.split(" ")[1];
                
                if(type.equals("X")) break;
                
                if(str.indexOf('_')>-1){
                	if(type.equals("D")){
                		System.out.println(str);
                	} else {
                		String[] s = str.split("_");
                		if(type.equals("U")){
                			for(String t : s){
                				System.out.print(t.substring(0,1).toUpperCase() + t.substring(1));
                			}
                			System.out.println();
                		} else {
                			System.out.print(s[0]);
                			for(int i=1;i<s.length;i++){
                				System.out.print(s[i].substring(0,1).toUpperCase() + s[i].substring(1));
                			}
                			System.out.println();
                		}
                	}
                } else {
        			String[] s = str.split("(?<!^)(?=[A-Z])");
            		if(type.equals("D")){
            			System.out.print(s[0].toLowerCase());
            			for(int i=1;i<s.length;i++){
            				System.out.print("_" + s[i].toLowerCase());
            			}
            			System.out.println();
            		} else if(type.equals("U")){
            			for(String t : s){
            				System.out.print(t.substring(0,1).toUpperCase() + t.substring(1));
            			}
            			System.out.println();
            		} else {
            			System.out.print(s[0].toLowerCase());
            			for(int i=1;i<s.length;i++){
            				System.out.print(s[i].substring(0,1).toUpperCase() + s[i].substring(1));
            			}
            			System.out.println();
            		}
                }
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}

Measured memory_bytes: 17256
import sys
stdin = sys.stdin
sys.setrecursionlimit(10**6)
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()

n = ni()
a = na()
m = 1000

for i in range(n-1):
    if a[i] < a[i+1]:
        m += (m//a[i])*(a[i+1]-a[i])

print(m)

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

int func(int n){
  if(n < 10) return n;
  return n % 10 + func(n/10);
}

int main(){
  int n;
  cin >> n;
  if(n%func(n) == 0){
    cout << "Yes"<<endl;
  }else{
    cout << "No" <<endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1LL << 60;

int main() {
    int n;
    cin >> n;
    vector<int> h(n);
    for (int i = 0; i < n; i++) {
        cin >> h[i];
    }
    int cnt_max = 0;
    int cnt = 0;
    for (int i = 0; i < n - 1; i++) {
        if (h[i] < h[i + 1]) {
            cnt_max = max(cnt_max, cnt);
            cnt = 0;
        } else {
            cnt++;
        }
    }
    cnt_max = max(cnt_max, cnt);
    cout << cnt_max << endl;
    return 0;
}

Measured memory_bytes: 3784
// 大きい方を選ぶだけ

#include <iostream>

using namespace std;

int main(void){

  int g[128][128], n;
  int i = 0, j = 0;

  while( cin >> n ){
    g[i][j++] = n;
    char c = cin.get();
    if( c == '\n' ){
      i++;
      j = 0;
    }
  }

  int dp[128][128] = {0};
  dp[0][0] = g[0][0];

  for( int a = 1 ; a < i + 1 ; a++ ){
    for( int b = 0 ; b < a + 1 ; b++ ){
      if( a < i/2 + 1 ){
	if(!b) dp[a][b] = dp[a - 1][b] + g[a][b]; // 左端
	else if( b == a ) dp[a][b] = dp[a - 1][b - 1] + g[a][b]; // 右端
	else dp[a][b] = max(dp[a - 1][b], dp[a - 1][b - 1]) + g[a][b];
      }else dp[a][b] = max(dp[a -1][b], dp[a - 1][b + 1]) + g[a][b];
    }
  }
  cout << dp[i][0] << endl;
  return 0;
}

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

using namespace std;

const int INF = 1e9;

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    if(fopen("in.txt", "r")) {
        freopen("in.txt", "r", stdin);
        freopen("out.txt", "w", stdout);
    }
    int h, w, k;
    cin >> h >> w >> k;
    int x1, x2, y1, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    vector<vector<int>> a(h+1, vector<int>(w+1, 0));
    vector<vector<int>> f(h+1, vector<int>(w+1, INF));
    for(int i = 1; i <= h; ++i) {
        for(int j = 1; j <= w; ++j) {
            char ch;
            cin >> ch;
            a[i][j] = (ch == '.');
            f[i][j] = (a[i][j]) ? -1 : INF;
        }
    }
    f[x1][y1] = 0;
    queue<pair<int, int>> q;
    q.push({x1, y1});
    while(q.size()) {
        int u, v; tie(u, v) = q.front();
        q.pop();
        if(u && (f[u - 1][v] == -1 || f[u - 1][v] == f[u][v] + 1)) {
            for(int i = 1; i <= k; ++i) {
                if(u - i > 0 && f[u - i][v] == f[u][v] + 1) continue;
                if(u - i <= 0 || f[u - i][v] != -1) break;
                f[u - i][v] = f[u][v] + 1;
                q.push(make_pair(u - i, v));
            }
        }
        if(v && (f[u][v - 1] == -1 || f[u][v - 1] == f[u][v] + 1)) {
            for(int i = 1; i <= k; ++i) {
                if(v - i > 0 && f[u][v - i] == f[u][v] + 1) continue;
                if(v - i < 1 || f[u][v - i] != -1) break;
                f[u][v - i] = f[u][v] + 1;
                q.push({u, v - i});
            }
        }
        if(u < h && (f[u + 1][v] == -1 || f[u + 1][v] == f[u][v] + 1)) {
            for(int i = 1; i <= k; ++i) {
                if(u + i <= h && f[u + i][v] == f[u][v] + 1) continue;
                if(u + i > h || f[u + i][v] != -1) break;
                f[u + i][v] = f[u][v] + 1;
                q.push(make_pair(u + i, v));
            }
        }
        if(v < w && (f[u][v + 1] == -1 || f[u][v + 1] == f[u][v] + 1)) {
            for(int i = 1; i <= k; ++i) {
                if(v + i <= w && f[u][v + i] == f[u][v] + 1) continue;
                if(v + i > w || f[u][v + i] != -1) break;
                f[u][v + i] = f[u][v] + 1;
                q.push(make_pair(u, v + i));
            }
        }
    }
    if(f[x2][y2] == INF) f[x2][y2] = -1;
    cout << f[x2][y2] << '\n';
}


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

#define TRACE(x)
#define WATCH(x) TRACE(cout << #x" = " << x << endl)
#define WATCHR(a, b) TRACE(for (auto it=a; it!=b;) cout << *(it++) << " "; cout << endl)
#define WATCHC(V) TRACE({cout << #V" = "; WATCHR(V.begin(), V.end());})

#define sz(x) int((x).size())
#define all(x) (x).begin(), (x).end()

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vs = vector<string>;

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

void go(int fr, int en, vi& vals) {
    if (fr == en) return;
    if (fr + 2 == en) {
        cout << fr + 1 + 1 << "\n";
        return;
    }

    int nfr = fr + 2, nen = en - 2;
    while (nfr <= nen && vals[nfr] <= 0)
        nfr += 2;
    while (nen >= nfr && vals[nen] <= 0)
        nen -= 2;

    if (nen < nfr) {
        TRACE(cout << "Clearing " << fr << " " << en << endl;)
        // clear everything between
        for (int reps = 0; reps < (en - fr) / 2 - 1; reps++) {
            cout << fr + 2 + 1 << "\n";
        }
        cout << fr + 1 + 1 << "\n";
        return;
    }

    TRACE(cout << "Handling " << fr << " " << en << endl;)

    // clear the back
    for (int reps = 0; reps < (en - nen - 1) / 2; reps++) {
        cout << nen + 2 + 1 << "\n";
    }

    TRACE(cout << "Descending to middle " << nfr << " " << nen << endl;)

    // condense the middle
    go(nfr, nen, vals);

    TRACE(cout << "Finishing " << nfr << " " << nen << endl;)

    // condense everything
    for (int reps = 0; reps < (nfr - fr) / 2 - 1; reps++) {
        cout << fr + 2 + 1 << "\n";
    }
    cout << fr + 1 + 1 << "\n";
    cout << fr + 1 + 1 << "\n";
}

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

    int N;
    cin >> N;

    vector<array<ll, 2>> pref(N + 1);
    pref[0] = { 0, 0 };

    vi a(N);
    for (int i = 0; i < N; i++) {
        cin >> a[i];
        pref[i + 1] = pref[i];
        if (a[i] > 0) pref[i + 1][i&1] += a[i];
    }

    ll max = LLONG_MIN;
    int fr = -1, en = -1;

    for (int cf = 0; cf < N; cf++) {
        for (int cb = 0; cf + cb < N; cb++) {
            int re = N - cf - cb;
            if (re % 2 != 1) continue;

            ll tot = (re == 1) ? a[cf] : (a[cf] + a[cf + re - 1] +
                pref[cf + re - 1][cf & 1] - pref[cf + 1][cf & 1]);
            if (tot > max) {
                max = tot;
                fr = cf, en = cf + re - 1;
            }
        }
    }

    WATCH(fr);
    WATCH(en);

    cout << max << endl;
    cout << N - (en - fr + 1) + (en - fr) / 2 << "\n";

    for (int i = en + 1, t = N; i < N; i++) {
        cout << t-- << "\n";
    }
    go(fr, en, a);
    for (int i = 0; i < fr; i++) {
        cout << 1 << "\n";
    }

    return 0;
}



Measured memory_bytes: 256
#include "iostream"
#include "algorithm"
#include "vector"
#include "string"

int main(int argc, char const *argv[]) {

  int N;
  std::cin >> N;

  int max_digit = 0;
  int rep2[100], rep2_abs[100], rep2_temp[100];

  for (size_t i = 0; i < 100; i++) {
    rep2[i] = 0;
    rep2_abs[i] = 0;
    rep2_temp[i] = 0;

  }

  int cc = 0;
  while (N != 0) {
    int a = N %(2);
    if(a < 0) a = -a;
    rep2[cc] = a;

    if (a == 1) {
      N = N -1;
      max_digit = cc + 1;

    }

    // std::cout << N << ":::"<< cc<<":::"<<a << '\n';
    N =  N / (-2);
    cc++;
  }

  for (size_t i = 0; i < max_digit; i++) {
    std::cout << rep2[max_digit - i -1] ;
  }

  if (max_digit == 0) {
    std::cout << "0" << '\n';
  }


  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;

typedef long long ll;

#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define per(i,a,b) for(ll i=b-1LL;i>=(a);--i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(c) string(1,c)
#define print(x) cout<<#x<<" = "<<x<<endl;

#define MOD 1000000007

int main(){
  ll n;
  cin>>n;
  if(n%2==1){
    cout << "No" << endl;
    return 0;
  }
  string s;
  cin>>s;
  string s1;
  rep(i,0,s.sz/2){
    s1 += s[i];
  }
  string s2 = s1+s1;
  if(s==s2){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
  return 0;
}

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

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using pint = pair<int, int>;
int dx[8] = {1, 0, -1, 0, 1, -1, 1, -1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int MOD = 1000000009;
const long long INF = 1LL << 60;

void dfs(Graph& G, int y, int x) {
    int H = G.size();
    int W = G[0].size();
    G[y][x] = -1;
    for (int i = 0; i < 8; ++i) {
        int ny = y + dy[i];
        int nx = x + dx[i];
        if (ny < 0 || ny >= H || nx < 0 || nx >= W) continue;
        if (G[ny][nx] != 1) continue;
        dfs(G, ny, nx);
    }
}

int main() {
    while(1) {
        int W, H;
        cin >> W >> H;
        if (W == 0 && H == 0) break;
        Graph C(H, vector<int>(W, 0));
        for (int i = 0; i < H; ++i) {
            for (int j = 0; j < W; ++j) cin >> C[i][j];
        }
        int res = 0;
        for (int i = 0; i < H; ++i) {
            for (int j = 0; j < W; ++j) {
                if (C[i][j] == 1) {
                    ++res;
                    dfs(C, i, j);
                }
            }
        }
        cout << res << endl;
    }
    return 0;
}


Measured memory_bytes: 3288
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cstdlib>
#include <string>
#include <cstring>
#include <functional>
#define fs first
#define se second

#ifdef imeimi
#define debug(...) printf(__VA_ARGS__)
#else
#define debug(...)
#endif

using namespace std;
typedef long long llong;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<llong, llong> pll;
typedef pair<ld, ld> pdd;

int n, q;
llong m;
vector<pii> V[2];

struct {
    int par[100000];
    int sz[100000];
    void init(int n) {
        for (int i = 0; i < n; ++i) {
            par[i] = i;
            sz[i] = 1;
        }
    }
    int find(int x) {
        if (par[x] != x) return par[x] = find(par[x]);
        return x;
    }
    bool merge(int x, int y) {
        x = find(x);
        y = find(y);
        if (x == y) return 0;
        par[y] = x;
        sz[x] += sz[y];
        return 1;
    }
    int size(int x) const {
        return sz[x];
    }
} uf1, uf2;

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin >> n >> m >> q;
    m -= n - 1;
    uf1.init(n);
    uf2.init(n);
    for (int i = 1; i <= q; ++i) {
        int a, b, c;
        cin >> a >> b >> c;
        V[c].emplace_back(a, b);
    }
    for (pii i : V[0]) {
        uf1.merge(i.fs, i.se);
    }
    for (pii i : V[1]) {
        int x = uf1.find(i.fs);
        int y = uf1.find(i.se);
        if (x == y) {
            printf("No\n");
            return 0;
        }
        uf2.merge(x, y);
    }
    llong mn = !V[1].empty(), mx = 0;
    for (int i = 0; i < n; ++i) {
        if (uf1.find(i) != i) continue;
        ++mx;
    }
    if (!V[1].empty() && mx == 2) {
        printf("No\n");
        return 0;
    }
    mx = mx * (mx - 1) / 2 - (mx - 1);
    printf(mn <= m && m <= mx ? "Yes\n" : "No\n");
    debug("%lld %lld\n", mn, mx);
    return 0;
}

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

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


Measured memory_bytes: 3620
#include <iostream>
#include <vector>
#include <bitset>
#include <utility>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <numeric>
 
using namespace std;
typedef long long ll;
 
int main(){
  ll K; cin >> K;

  deque<ll> q;
  for(ll i=1;i<10;i++){
    q.push_back(i);
  }

  for(ll i=0;i<K-1;i++){
    ll qi=q.front();
    q.pop_front();
    //cout << qi << endl;
    if(qi%10!=0) q.push_back(10*qi+qi%10-1);
    q.push_back(10*qi+qi%10);
    if(qi%10!=9) q.push_back(10*qi+qi%10+1);
  }
  cout << q.front() << endl;

  return 0;
}


Measured memory_bytes: 1792
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int[] X = new int[N];
    int[] A = new int[N];
    for (int i = 0; i < N; i++) {
      X[i] = sc.nextInt();
      A[i] = X[i];
    }
    Arrays.sort(A);
    
    for (int i = 0; i < N; i++) {
      int ans = A[N/2] <= X[i] ? A[N/2-1] : A[N/2];
      System.out.println(ans);
    }
  }
}

Measured memory_bytes: 88524
def solve():
    N = int(input())
    C = []
    S = []
    F = []
    for _ in range(N - 1):
        tmp_c, tmp_s, tmp_f = list(map(int, input().split(" ")))
        C.append(tmp_c)
        S.append(tmp_s)
        F.append(tmp_f)

    for i in range(N - 1):
        t = 0
        for j in range(i, N - 1):
            if t < S[j]:
                t = S[j]
            else:
                if t % F[j]:
                    t += F[j] - (t % F[j])
            t += C[j]
        print(t)
    print(0)


solve()

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

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define a first
#define b second
#define sz(x) (ll)((x).size())
#define pb push_back
#define mp make_pair 
#define bg begin()
#define ed end()
#define all(x) (x).bg,(x).ed
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rep1(i,n) for(ll i=1;i<=(n);i++)
#define rrep1(i,n) for(ll i=(n);i>=1;i--)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
const ll MOD=998244353;
ll power(ll x,ll n,ll mod){ll ret=1;while(n>0){if(n&1) (ret*=x)%=mod;(x*=x)%=mod;n>>=1;}return ret;}

const ll MAX_N=265000;

struct BIT{
	ll bit[MAX_N],n;

	BIT(ll N){
		n=N;
	}

	ll sum(ll i){
		ll s=0;
		while(i>0){
			s+=bit[i];
			i-=i&-i;
		}
		return s;
	}

	void add(ll i,ll x){
		while(i<=n){
			bit[i]+=x;
			i+=i&-i;
		}
	}
};

int main(){
	ll N; cin>>N;
	BIT left(N);
	BIT right(N);
	rep1(i,N) right.add(i,1);
	vector<P> p(N);
	map<ll,ll> m;
	rep(i,N){
		ll x,y; cin>>x>>y;
		p[i]=P(x,y);
		m[y]=0;
	}
	ll sub=1;
	for(auto it=m.bg;it!=m.ed;it++) it->b=sub++;

	rep(i,N) p[i].b=m[p[i].b];
	sort(all(p));

	ll ans=N*power(2,N-1,MOD);
	ans%=MOD;
	rep(i,N){
		// p[i]を見る
		// 見る前にrightを減らす
		right.add(p[i].b,-1);

		// 見る
		/*
				A|B
		 p[i].b ---
				D|C
		*/
		ll A=left.sum(p[i].b-1),B=right.sum(p[i].b-1),C=right.sum(N)-right.sum(p[i].b),D=left.sum(N)-left.sum(p[i].b);

		ll A2=power(2,A,MOD)-1,B2=power(2,B,MOD)-1,C2=power(2,C,MOD)-1,D2=power(2,D,MOD)-1;
		ans+=(((A2*C2)%MOD)*power(2,B+D,MOD))%MOD;
		ans%=MOD;
		ans+=(((B2*D2)%MOD)*power(2,A+C,MOD))%MOD;
		ans%=MOD;
		ll tmp=(A2*B2)%MOD;
		tmp*=C2;
		tmp%=MOD;
		tmp*=D2;
		tmp%=MOD;
		ans-=tmp;
		if(ans<0) ans+=MOD;
		ans%=MOD;

		// 見た後にleftを増やす
		left.add(p[i].b,1);
	}
	cout<<ans;
}

Measured memory_bytes: 19456
#include <bits/stdc++.h>
#define REP(i, n) for (int (i) = 0; (i) < (int)(n); i++) 
#define FOR(i, a, b) for(int (i) = a; (i) < (int)b; i++)
#define RREP(i, n) for(int (i)=((int)(n)-1); (i)>=0; i--)
#define RFOR(i, a, b) for(int (i) =((int)(b)-1); (i)>=(int)a; i--)
#define ALL(v) (v).begin(),(v).end()
#define MOD 1000000007
#define NIL -1
#define FI first
#define SE second
#define MP make_pair
#define PB push_back
#define SZ(x)  (int)x.size()
#define SP(x)  setprecision((int)x)


using namespace std ;
typedef long long ll;
typedef vector<int> vint;
typedef vector<vint> vvint;
typedef vector<string> vstr;
typedef pair<int, int> pii;
const int INF = 1e9;
const ll LINF = 1e18;
const double EPS = 1e-9;
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 ;
}


//-------------------------------------------------
// メモ
/*






*/
//-------------------------------------------------


int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll h ;
  cin >> h ;
  ll ans = 1 ;
  int cnt = 0 ;
  while(h!=1){
    cnt++ ;
    h /= 2 ;
  }
  REP(i,cnt+1){
    ans *= 2 ;
  }
  cout << ans -1 <<endl ;
    
  
  
  
  return 0 ;
}


Measured memory_bytes: 256
//                                      KiSmAt
#include "bits/stdc++.h"
using namespace std;
 
using ll = long long;
 
const ll inf = 1e18;
const int N = 2 * 1e5 + 10;

ll res;
ll a[N], dp[N];

vector<ll> v[N];

ll dfs(ll node){
	if(dp[node] != -1)	return dp[node];
	dp[node] = 0;
	for(auto i: v[node]){
		dp[node] = max(dp[node], 1 + dfs(i));
	}
	return dp[node];
}

void solve(){
	ll n, m, x, y;
	cin >> n >> m;
	for(int i = 0; i < m; ++i){
		cin >> x >> y;
		v[x].push_back(y);
	}
	memset(dp, -1, sizeof dp);
	for(int i = 1; i <= n; ++i){
		if(dp[i] == -1)	dfs(i);	
	}
	for(int i = 1; i <= n; ++i){
		res = max(res, dp[i]);
	}
	cout << res;
}
 
int main(int argc, char const *argv[]){
	ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
    ll t = 1;
    //cin >> t;
    while(t--){
    	solve();
    }
}
// nEro

Measured memory_bytes: 11008
#include <bits/stdc++.h>
typedef long long ll;
#define rep(i,a,n) for(ll i = a;i < n;i++)
#define rrep(i,a,n) for(ll i = n; i >= a;i--)
#define index_check(i,n) if(i > n-1 || i < 0) continue; 
#define LINF 1e18
#define INF 1e9
using namespace std;

#define fs first
#define sc second

using P = pair<ll,ll>;
using Pll = pair<P,ll>;
using PQ = priority_queue<P,vector<P>,greater<P>>;

const ll MOD = 1e9+7;

signed main(){
    ll a[5];
    rep(i,0,5){
        cin >> a[i];
        if(!a[i]){
            cout << i+1 << endl;
            return 0;
        }
    }
    return 0;
}


Measured memory_bytes: 3676
for e in iter(input,'0'):
 a=[[*map(int,input().split())]for _ in[0]*int(e)]
 s,t=min(a)
 b={tuple(map(int,input().split()))for _ in[0]*int(input())}
 m=max(b)[0]-max(a)[0]+s
 for x,y in b:
  if x<=m:
   for u,v in a:
    if(x+u-s,y+v-t)not in b:break
   else:print(x-s,y-t);break


Measured memory_bytes: 6044
#include<bits/stdc++.h>
using namespace std;
#ifdef LOCAL_DEBUG
  #include "LOCAL_DEBUG.hpp"
#endif
#define int long long
struct edge{ int to, cost; };

signed main(){

  int n; cin >> n;
  vector<vector<int>> G(n);
  for(int i = 0; i < n-1; i++){
    int a, b; cin >> a >> b;
    a--, b--;
    G[a].push_back(b);
    G[b].push_back(a);
  }

  vector<double> dp(n, 0);
  auto dfs = [&](auto&& dfs, int u, int par)->void{
    int child = (par == -1 ? G[u].size() : G[u].size()-1);
    for(int v : G[u]){
      if(v == par) continue;
      dfs(dfs, v, u);
      dp[u] += (dp[v] + 1) / child;
    }
  };
  dfs(dfs, 0, -1);

  vector<double> ans(n);
  auto dfs2 = [&](auto&& dfs2, int u, int par, double d_par)->void{
    int child = G[u].size();
    if(par == -1){
      ans[u] = dp[u];
    }else{
      ans[u] = (dp[u] * (child-1) + d_par) / child;
    }
    for(int v : G[u]){
      if(v == par) continue;
      d_par = (ans[u] * G[u].size() -  (dp[v]+1)) / max(1LL, child-1) + 1;
      dfs2(dfs2, v, u, d_par);
    }
  };
  dfs2(dfs2, 0, -1, 0);
  for(int i = 0; i < n; i++){
    printf("%.9f\n", ans[i]);
  }

  return 0;
}


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

int main() {
  int N;
  cin >> N;
  vector<double> v(N);
  for (int i = 0; i < N; i++) cin >> v.at(i);
  sort(v.begin(), v.end());
  double ans = v.at(0);
  for (int i = 1; i < N; i++) {
    ans += v.at(i);
    ans /= 2.0;
  }
  cout << ans << endl;
}

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

using namespace std;

typedef pair<int,int> pii;
typedef long long ll;
typedef vector<int> vi;
#define rep(i, n) for(int i = 0; i < n; ++i)
#define rInt(a) scanf("%d",&a);

main(){
    int n; scanf("%d",&n);
    vi arr (n);
    rep(i,n) scanf("%d",&arr[i]);
    vi arr2 = arr;
    sort(arr2.begin(),arr2.end());
    int l = arr2[(n/2)-1], r = arr2[n/2];
    rep(i,arr.size()){
        if(arr[i]<=l) printf("%d\n",r);
        else printf("%d\n",l);
    }  
}

Measured memory_bytes: 3712
#include<cstdio>
#include<algorithm>
unsigned long long a[110];
unsigned long long b[110];
unsigned long long GCD(unsigned long long a , unsigned long long b)
{
	if(a % b == 0)//GCD 
		return b;
	else
		GCD(b , a%b);	
}
unsigned long long f(unsigned long long a , unsigned long long b , unsigned long long g)//先找出公倍數
{
	return g * ( (a / g) * (b / g));//找出最大公倍數 
}
int main()
{
	int n;
	unsigned long long ans=1;
	scanf("%d",&n);
	unsigned long long gcd = n;
	for(int i=1;i<=n;i++)
	{
		scanf("%lld",&a[i]);
		b[i] = a[i];
	}
	if(n != 1)
	{
		std::sort(a+1,a+n+1);//記得排序 
		std::sort(b+1,b+n+1);
		for(int i=1;i<n;i++)//主要流程 
		{
			gcd=b[i+1];
			//printf("gcd=> %d",gcd);
			gcd=GCD(b[i] , b[i+1]);
			//printf("gcd=> %d",gcd);
			b[i+1] = f(b[i] , a[i+1] , gcd);
			gcd=b[i+1];
			//printf("gcd=> %d",gcd);
		}	
		printf("%lld\n",gcd);
	}
	else
	{
		printf("%lld\n",a[n]);
	}
	return 0;
}

Measured memory_bytes: 128
#include <iostream>

using namespace std;

int main()
{
  int p0, p1, p2, p3;

  cin >> p0;

  p1 = p0 % 10000;
  p2 = p1 % 5000;
  p3 = p2 % 1000;

  cout << (p0 / 10000) * 10000 + (p1 / 5000) * 5000
    + (p2 / 1000) * 1000 + (p3 / 500) * 500 << endl;
}



Measured memory_bytes: 3100
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <cmath>
#include <numeric>
#include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <list>
#include <unordered_map>
#include <tuple>
#include <complex>


#define FOR(i, a, b)		for(int i = (int)(a); i < (int)(b); ++i)
#define FORE(i, a, b)		for(int i = (int)(a); i <= (int)(b); ++i)
#define REP(i, n)			FOR(i, 0, n)
#define REPE(i, n)			FORE(i, 0, n)
#define ALL(x)				(x).begin(),(x).end()
#define DEBUG_DC(x)			cout << #x << ": " << x << endl
#define VEC_TYPE			int
#define INF					1e9+1

using namespace std;
typedef long long ll;
typedef vector<VEC_TYPE> vdef;
typedef vector<vdef> vvdef;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmaxE(T& a, T b) { if (a <= b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T> inline bool chminE(T& a, T b) { if (a >= b) { a = b; return 1; } return 0; }
template<typename T> inline T mygcd(T a, T b) { return b ? mygcd(b, a%b) : a; }
template<typename T> inline T mylcm(T a, T b) { return a * b / mygcd(a, b); }


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

	vdef a(n);
	for (int i = 0; i < n; ++i) cin >> a[i];
	double sum = 0.0;
	for (int i = 0; i < n; ++i)
	{
		sum += (1.0 / (double)a[i]);
	}

	cout << 1.0/sum << endl;
	return 0;
}

Measured memory_bytes: 256
//Optional FAST

//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,fma,abm,mmx,avx,avx2,tune=native")

//Required Libraries

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>

//Required namespaces

using namespace std;
using namespace __gnu_pbds;

//Required defines

#define endl '\n'

#define READ(X) cin>>X;
#define READV(X) long long X; cin>>X;
#define READAR(A,N) long long A[N]; for(long long i=0;i<N;i++) {cin>>A[i];}
#define rz(A,N) A.resize(N);
#define sz(X) (long long)(X.size())
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define trav(x,A) for(auto &x:A)
#define FORI(a,b,c) for(long long a=b;a<c;a++)
#define FORD(a,b,c) for(long long a=b;a>c;a--)

//Required typedefs

typedef tree<long long,null_type,less<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
typedef tree<long long,null_type,greater<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set1;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;
typedef vector<int> veci;
typedef vector<long long> vecl;

//Required Constants

const long long inf=(long long)1e18;
const long long MOD=(long long)(1e9+7);
const long long INIT=(long long)(1e6+1);

//Required Functions

ll power(ll x,ll y) 
{ 
    if (y == 0) 
        return 1; 
    ll p = power(x, y/2) % MOD; 
    p = (p * p) % MOD; 
  
    return (y%2 == 0)? p : (x * p) % MOD; 
}
ll modInverse(ll a) 
{ 
   return power(a,MOD-2); 
   
}

//Work
ll dp[2001][2001];
int main()
{
    #ifndef ONLINE_JUDGE
    if (fopen("INPUT.txt", "r"))
    {
        freopen ("INPUT.txt" , "r" , stdin);
        //freopen ("OUTPUT.txt" , "w" , stdout);
    }
    #endif
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    clock_t clk;
    clk = clock();
//-----------------------------------------------------------------------------------------------------------//

    vector<pll> Z;
    READV(N);
    FORI(i,1,N+1)
    {
        READV(x);
        Z.pb({x,i});
    }
    sort(Z.begin(),Z.end(),greater<pll>());
    dp[0][0]=0;
    FORI(L,0,N+1)
    {
        FORI(R,0,N+1)
        {
            ll x=L+R+1;
            if(x<=N)
            {
                x--;
                dp[L+1][R]=max(dp[L+1][R],dp[L][R]+abs(L+1-Z[x].se)*Z[x].fi);
                dp[L][R+1]=max(dp[L][R+1],dp[L][R]+abs(N-R-Z[x].se)*Z[x].fi);
            }
        }
    }
    ll ans=0;
    FORI(i,0,N+1)
    {
        ans=max(ans,dp[i][N-i]);
    }
    cout<<ans<<endl;

//-----------------------------------------------------------------------------------------------------------//


    clk = clock() - clk;
    cerr << fixed << setprecision(6) << "Time: " << ((double)clk)/CLOCKS_PER_SEC << endl;

    return 0;
}

Measured memory_bytes: 26556
#include <stdio.h>
 
int main(void) {
	// your code goes here
	char ch;
	ch = getchar();
	if(ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u')
	puts("vowel");
	else puts("consonant");
	return 0;
}

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

using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;
using LL = long long;
using VL = vector<LL>;
using VVL = vector<VL>;
using PLL = pair<LL, LL>;
using VS = vector<string>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))

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

#define FF first
#define SS second
template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}
template<class S, class T>
ostream& operator<<(ostream& os, const pair<S,T>& p){
  return os << p.FF << " " << p.SS;
}
template<class T>
void maxi(T& x, T y){
  if(x < y) x = y;
}
template<class T>
void mini(T& x, T y){
  if(x > y) x = y;
}


const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1e9+7;

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

  int N, M;
  cin >> N >> M;
  VI cnt(N);
  REP(i,M){
	int u, v;
	cin >> u >> v;
	--u;
	--v;
	cnt[u]++;
	cnt[v]++;
  }
  bool ok = true;
  REP(i,N) ok = ok && cnt[i]%2 == 0;

  cout << (ok? "YES": "NO") << endl;

  return 0;
}


Measured memory_bytes: 640
#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>
#include<sstream>
using namespace std;
typedef long long LL;
const int INF = 0x3f3f3f3f;


int main()
{
	int a,b,c;
	cin >> a >> b >>c;
	if(a + b + c >= 22)
		printf("bust\n");
	else
		printf("win\n");
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define all(c) c.begin(),c.end()
#define init(c) memset(c,0,sizeof c)
#define S second
#define F first
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
const int N=20000005;
int n,k,x,t,a,b,m;
string s;
vi v;
int main(){
	cin >>a >> b;
	if(b>=a){
		cout << "unsafe";
	}else{
		cout << "safe";
	}

	
	return 0;
}

Measured memory_bytes: 3592
# coding: utf-8
A = list(input())
for i in range(2 ** 3):
    op = ["-"] * 3
    for j in range(3):
        if ((i >> j) & 1):
            op[3 - 1 - j] = "+"
    ans = ""
    for m, n in zip(A, op):
        ans += m + n
    ans += A[3]
    if eval(ans) == 7:
        print(ans + "=7")
        exit()

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

namespace BC121D
{
    class Program
    {
        static void Main(string[] args)
        {
            // 整数の入力
            //int a = int.Parse(Console.ReadLine());
            // スペース区切りの整数の入力
            string[] input = Console.ReadLine().Split(' ');
            long A = long.Parse(input[0]);
            long B = long.Parse(input[1]);
            long ans = xor_fromZero(A - 1) ^ xor_fromZero(B);
            
            Console.WriteLine(ans);
        }
        public static long xor_fromZero(long n)
        {
            if (n <= 0)
                {
                    return 0;
                }
            //
            if (n % 2 == 1) // nが奇数の時
            {

                if (((n + 1) / 2) % 2 == 0)
                {
                    return 0;
                }
                else
                {
                    return 1;
                }
            }
            else // nが偶数の時
            {
                if ((n / 2)% 2 == 0){
                    return n;
                }
                else
                {
                return n+1;
                }
            }
        } 
    }
}


Measured memory_bytes: 11092
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <cstring>
#include <numeric>
#include <algorithm>
#include <functional>
#include <array>
#include <map>
#include <queue>
#include <limits.h>
#include <set>
#include <stack>
#include <random>
#include <complex>
#include <unordered_map>
#include <nmmintrin.h>
#include <chrono>
#define rep(i,s,n) for(int i = (s); (n) > i; i++)
#define REP(i,n) rep(i,0,n)
#define RANGE(x,a,b) ((a) <= (x) && (x) <= (b))
#define DUPLE(a,b,c,d) (RANGE(a,c,d) || RANGE(b,c,d) || RANGE(c,a,b) || RANGE(d,a,b))
#define INCLU(a,b,c,d) (RANGE(a,c,d) && (b,c,d))
#define PW(x) ((x)*(x))
#define ALL(x) (x).begin(), (x).end()
#define MODU 1000000007
#define bitcheck(a,b)   ((a >> b) & 1)
#define bitset(a,b)      ( a |= (1 << b))
#define bitunset(a,b)    (a &= ~(1 << b))
#define MP(a,b) make_pair((a),(b))
#define Manh(a,b) (abs((a).first-(b).first) + abs((a).second - ((b).second))
#define pritnf printf
#define scnaf scanf
#define itn int
#ifdef _MSC_VER
#define __builtin_popcount _mm_popcnt_u32
#define __builtin_popcountll _mm_popcnt_u64
#endif
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

template <class T>
struct Lazy_BIT {
#define SZ(a) (a&-a)
#define LEFT(a) (a-SZ(a))
#define UP(a) (a+SZ(a))

	vector<T> x,lazy;
	Lazy_BIT(int n) : x(n + 1, 0), lazy(n + 1, 0) {}
	T sum(int r) {
		T S = 0;
		for (int k = r; k > 0; k -= SZ(k)) {
			S += x[k]+lazy[k]*SZ(k);
			for (int cp = UP(k); cp < x.size() && LEFT(k) == LEFT(cp); cp += SZ(cp))
				S += lazy[cp] * (r - LEFT(k));
		}
		return S;
	}
	void add(int r, T a) {
		for (int k=r; k > 0; k -= SZ(k)) {
			lazy[k] += a;
			for (int cp = UP(k); cp < x.size() && LEFT(k) == LEFT(cp); cp += SZ(cp))
				x[cp] += a * (r-LEFT(k));
		}
	}
};


int main()
{
	int n, q;
	cin >> n >> q;
	Lazy_BIT<ll> fen(n);

	REP(i, q) {
		int m;
		scanf("%d", &m);
		if (m) {
			int s, t;
			scanf("%d %d", &s, &t);

			printf("%lld\n", fen.sum(t) - fen.sum(s-1));
		}
		else {
			int s, t, x;
			scanf("%d %d %d", &s, &t, &x);

			fen.add(t,x);
			fen.add(s-1, -x);
		}
	}

	return 0;
}


Measured memory_bytes: 4416
//#define _GLIBCXX_DEBUG

#include<bits/stdc++.h>
using namespace std;
const int INF= 1e9+5;
typedef long long ll;

int main(){
  string s;
  cin>>s;
  int count=0;
  if(s[0]=='o')count++;
  if(s[1]=='o')count++;
  if(s[2]=='o')count++;
  
  cout<<700+count*100<<endl;
}

Measured memory_bytes: 256
import random as rng
import itertools as it
import collections as col
import heapq as hq
import sys
import copy as cp
sys.setrecursionlimit(10**9)


def dump_impl(*objects):
    print(*objects, file=sys.stderr)


def dump_dummy(*objects):
    pass


dump = dump_impl if "DEBUG" in sys.argv else dump_dummy

N = int(input())
P = list(map(int, input().split()))
Q = list(map(int, input().split()))
dump(N, P, Q)

factrials = it.permutations(range(1, N+1), N)
a = -1
b = -1
for i, fact in enumerate(it.permutations(range(1, N+1), N)):
    dump(list(zip(list(fact), P)), list(zip(list(fact), Q)))
    if all([x == y for (x, y) in zip(list(fact), P)]):
        a = i
        dump("  a=", a)
    if all([x == y for (x, y) in zip(list(fact), Q)]):
        b = i
        dump("  b=", b)
    dump(fact)
print(abs(a-b))


Measured memory_bytes: 4720
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<list>
#include<iomanip>
#include<cmath>
#include<cstring>
#include<functional>
#include<cstdio>
#include<cstdlib>
#include<unordered_map>
#include<unordered_set>
using namespace std;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
#define MOD 1000000007
//#define MOD 998244353
#define LINF (long long)4e18
#define jck 3.141592
#define PI acos(-1.0);

const double EPS = 1e-10;

using ll = long long;
using Pi = pair<int,int>;
using Pl = pair<ll,ll>;


int main(){
    int x; cin >> x;
    int k = x/500;
    x -= k*500;
    ll ans = (ll)k*1000+(x/5)*5;
    cout << ans << endl;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ios ios_base::sync_with_stdio(0);cin.tie(0);
using namespace std ;
typedef long long int ll ;


int main(){
	ios;
	string s;
	cin>>s;
	int n=ceil(s.length()/2),N=s.length();
	int cnt=0;
	for(int i=0; i<n; i++){
		if(s[i]!=s[N-i-1])
			cnt++;
	}
	cout<<cnt<<'\n';
	return 0;
}



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

int main(){
    string S;
    cin >> S;
    string list[7]={"SUN","MON","TUE","WED","THU","FRI","SAT"};
    int N=7;

    for(int i=0; i<N; i++){
        if( S==list[i] ){
            cout << N-i << endl;
            break;
        }
    }

    return 0;
}

Measured memory_bytes: 256