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

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
using ll = long long;
string char_to_string(char val) {
  return string(1, val);
}
int char_to_int(char val) {
  return val - '0';
}
template<class T> inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template<class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}

int main() {
  ll N, K; cin >> N >> K;
  ll ans = min(N % K, abs(N % K - K));
  cout << ans << endl;
}

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

using namespace std;

int main()
{
    static int p[300001];
    
    for (int i = 1; i <= 300000; i++) p[i] = 1;
    p[1] = 0;
    
    for (int i = 2; i <= 300000; i++){
        if (i % 7 != 1 && i % 7 != 6) p[i] = 0;
    }
    
    for (int i = 6; i <= 300000; i++){
        if (p[i]){
            for (int j = 2 * i; j <= 300000; j += i){
                if (j / i % 7 == 1 || j / i % 7 == 6) p[j] = 0;
            }
        }
    }
    
    int n;
    
    while (scanf("%d", &n) && n != 1){
        printf("%d: ", n);
        
        vector<int> v;
        for (int i = 6; i < n; i++){
            if (p[i] && n % i == 0){
                v.push_back(i);
            }
        }
        if (v.empty()) v.push_back(n);
        sort(v.begin(), v.end());
        
        for (int i = 0; i < v.size(); i++){
            printf("%d%c", v[i], i + 1 == v.size() ? '\n' : ' ');
        }
    }
    
    return (0);
}

Measured memory_bytes: 2384
package main

import "fmt"

func main() {
  var N, sum int
  fmt.Scan(&N)
  a := make([]int, N)
  b := make([]int, N)
  c := make([]int, N-1)
  for i := 0; i < N; i++ {
   	fmt.Scan(&a[i])
  }
  for i := 0; i < N; i++ {
  	fmt.Scan(&b[i])
  }
  for i := 0; i < N-1; i++ {
    fmt.Scan(&c[i])
  }

  for i := 0; i < N; i++ {
	sum += b[a[i]-1]
	if i < N-1 {
		if a[i] == a[i+1]-1 {
          sum += c[a[i]-1]
		}
	}
  }
  fmt.Println(sum)
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
#include <cstring>
using namespace std;
#define ll  long long
#define endl '\n'
const ll mod = 1000000007;
const double PI = 3.141592653589793238463;
using namespace std;
int a[100009];
int main()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    int x,q,c=1,l,r;
    cin>>x>>q;
    string s;
    cin>>s;
    s="*"+s;
    a[0]=0;
    for (int i=2;i<=x;i++){
        if (s[i]=='C'&&s[i-1]=='A')
        {
            a[i]=c;
            a[i-1]=c;
            if (i<x-1)
            i++;
            c++;
        }
        else
            a[i]=a[i-2],a[i-1]=a[i-2];
    }

   /* for (int i=1;i<=x;i++)
        cout<<a[i]<<" ";
    cout<<endl;*/
    while (q--){
        cin>>l>>r;
        if (a[l]==a[l-1])
            l++;
        if (a[r]==a[r+1])
            r--;
        //cout<<"l = "<<l<<endl;
       // cout<<"r = "<<r<<endl;
        cout<<a[r]-a[l-1]<<endl;
    }
    return 0;
}


Measured memory_bytes: 1388
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Aman Kumar Singh
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        BEcho solver = new BEcho();
        solver.solve(1, in, out);
        out.close();
    }

    static class BEcho {
        PrintWriter out;
        InputReader in;

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            this.out = out;
            this.in = in;
            int n = ni();
            String st = n();
            String s = st.substring(0, n / 2);
            s += s;
            if (st.equals(s) && n % 2 == 0)
                pn("Yes");
            else
                pn("No");
        }

        String n() {
            return in.next();
        }

        int ni() {
            return in.nextInt();
        }

        void pn(String zx) {
            out.println(zx);
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new UnknownError();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new UnknownError();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public String next() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            StringBuffer res = new StringBuffer();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isSpaceChar(c));

            return res.toString();
        }

        private boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

    }
}



Measured memory_bytes: 20820
#include<stdio.h>
#include<iostream>
#include<vector>
#include<queue>
using namespace std;

long long int INF = 112341234567899;
long long int d[1123456];
vector<pair<int, int> > G[1123456];

int N;
int main () {
    cin >> N;
    for(int i=1; i<=N; i++) d[i] = INF;
    for(int i=1; i<N;i++) {
        int a,b,c;
        cin >> a >> b >> c;
        G[a].push_back(make_pair(b,c));
        G[b].push_back(make_pair(a,c));
    }
    queue<int> que;
    int Q,K;
    cin >> Q >> K;

    d[K] = 0;
    que.push(K);
    while( !que.empty() ) {
        int u = que.front(); que.pop();
        for(int i=0; i<G[u].size(); i++) {
            int g = G[u][i].first;
            if( d[u] + G[u][i].second < d[g] ) {
                d[g] = d[u] + G[u][i].second;
                que.push(g);
            }
        }
    }
    for(int i=0; i<Q; i++) {
        int x,y;
        cin >> x >> y;
        cout << d[x] + d[y] << endl;
    }
    return 0;
}


Measured memory_bytes: 34292
#include<cstdio>
#define int long long
const int M=1e9+7,N=50;
struct matrix{
	int a[N][N];
	inline matrix operator*(matrix b){
		matrix c;
		for(int i=0;i<N;i++)
		  for(int j=0;j<N;j++){
			c.a[i][j]=0;
			for(int k=0;k<N;k++)
			  c.a[i][j]=(c.a[i][j]+1ll*a[i][k]*b.a[k][j])%M;
		  }return c;
	}
}a,s;
int n,m,ans;
signed main(){
	scanf("%lld%lld",&n,&m);
	for(int j=0;j<n;j++)s.a[j][j]=1;
	for(int i=0;i<n;i++)for(int j=0;j<n;j++)
	  scanf("%lld",&a.a[i][j]);
	for(;m;m>>=1)m&1?s=s*a:(matrix){0},a=a*a;
	for(int i=0;i<n;i++)for(int j=0;j<n;j++)
	  ans=(ans+s.a[i][j])%M;
	printf("%lld",ans);
	return 0;
}

Measured memory_bytes: 256
// In the name of God

#include <iostream>
#include <algorithm>
#include <fstream>
#include <vector>
#include <deque>
#include <assert.h>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <stdio.h>
#include <string.h>
#include <utility>
#include <math.h>
#include <bitset>
#include <iomanip>

using namespace std;

const int N = (int) 0, mod = (int) 0;

int32_t main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int n;
    cin >> n;
    string a, b;
    cin >> a >> b;
    for (int i = 0; i <= n; ++i) {
        int flag = 1;
        for (int j = i; j < n; ++j) {
            if (a[j] != b[j - i]) {
                flag = 0;
            }
        }
        if (flag) {
            cout << n + i << endl;
            return 0;
        }
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long LL;
using namespace std;
int main()
{
    char a;
    cin >> a;
    if(a>='a'&&a<='z')
        cout << "a";
    if(a>='A'&&a<='Z')
        cout << "A";

    return 0;
}



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

using namespace std;

using ll = long long;

template<typename T> using V = std::vector<T>;
using Vi = V<int>;
using VVi = V<V<int>>;
using Vl = V<ll>;
using VVl = V<V<ll>>;
using Vs = V<string>;

template<typename T1, typename T2> using P = std::pair<T1, T2>;
using Pii = P<int, int>;
using Pll = P<ll, ll>;
using Pdd = P<double, double>;

template<typename T1, typename T2> using M = std::map<T1, T2>;
using Mii = M<int, int>;
using Msi = M<string, int>;

#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define REP2(i,s,e) for(int i=(int)(s);i<(int)(e);++i)
#define RREP(i,s,e) for(int i=(int)(s);i>=(int)(e);--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin(),ie=(c).end();i!=ie;++i)
#define ALL(c) (c).begin(), (c).end()

const double PI = acos(-1);
const ll MOD = 1e9+7;

int size;
int n;
Vi v;
Vi cand = {0, 3, 5, 7};

int dfs(int depth) {
    if (depth == size) {
        int val = 0;
        int c3 = 0, c5 = 0, c7 = 0;
        bool is753 = true;
        REP(i, size) {
            int x = v[i];
            val += x * pow(10, size-i-1);
            if (x == 3) c3++;
            if (x == 5) c5++;
            if (x == 7) c7++;
            if ((c3 > 0 || c5 > 0 || c7 > 0) && x == 0) is753 = false;
        }
        if (!is753 || c3 == 0 || c5 == 0 || c7 == 0 || val > n) {
            return 0;
        }
        return 1;
    }
    int res = 0;
    for (auto x: cand) {
        v[depth] = x;
        res += dfs(depth+1);
    }
    return res;
}

int main() {
    cin >> n;
    size = to_string(n).size();
    v = Vi(size);

    cout << dfs(0) << '\n';

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
 
  int left = a + b;
  int right = c + d;
  if (right < left){
    cout << "Left" << endl;
  }
  else if (right > left){
    cout << "Right" << endl;
  }
  else cout << "Balanced" << endl;
  // ここにプログラムを追記
}

Measured memory_bytes: 3628
import sys
sys.setrecursionlimit(10 ** 9)
# input = sys.stdin.readline    ####
def int1(x): return int(x) - 1
def II(): return int(input())
def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())
def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def MS(): return input().split()
def LS(): return list(input())
def LLS(rows_number): return [LS() for _ in range(rows_number)]
def printlist(lst, k=' '): print(k.join(list(map(str, lst))))
INF = float('inf')
# from math import ceil, floor, log2
# from collections import deque, defaultdict
# from itertools import combinations as comb, combinations_with_replacement as comb_w, accumulate, product, permutations
# from heapq import heapify, heappop, heappush
# import numpy as np    # cumsum
# from bisect import bisect_left, bisect_right

def solve():
    N = II()
    A = [0] + LI() + [0]

    tot = 0
    for i in range(1, len(A)):
        tot += abs(A[i]-A[i-1])
    # print(tot)

    for i in range(1, N+1):
        print(tot - (abs(A[i] - A[i-1]) + abs(A[i] - A[i+1])) + (abs(A[i-1] - A[i+1])))


if __name__ == '__main__':
    solve()



Measured memory_bytes: 20516
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i, n) FOR(i, 0, n)
#define FOR(i, s, n) for (int i = (s), i##_len = (n); i < i##_len; ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()
#define CEIL(a, b) ((a - 1) / b + 1)

void solve() {
    int N, X, M;
    cin >> N >> X >> M;
    int sum = 0;
    map<int, pair<int, int>> mp;
    REP(i, N) {
        // 循環した初回のみループ変数iを最終ループへ飛ばす
        if (mp.count(X) > 0) {
            // 循環する長さ
            int len = i - mp[X].first;
            // 循環する回数 (加算後は最大でもN-1)
            int cnt = (N - 1 - i) / len;
            sum += (sum - mp[X].second) * cnt;
            i += len * cnt;
        } else {
            mp[X] = {i, sum};
        }
        sum += X;
        X = X * X % M;
    }
    cout << sum << endl;
}

signed main() {
    cin.tie(nullptr)->sync_with_stdio(false);
    solve();
}


Measured memory_bytes: 6688
#include <cstdio>
#include <climits>
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <stack>
#include <algorithm>
#include <random>
#include <iomanip>
#include <unordered_map>
#include <map>
#include <queue>
#include <functional>
#include <numeric>
#include <chrono>
#include <cstdlib>
using ll = long long;
using namespace std;

const ll MOD = 1e9 + 7;
//const double EPS = 1e(-12);
const double pi = acos(-1);
typedef pair<int, int> P;
#define REP(i, n) for (int(i) = 0; (i) < (n); ++(i))
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
#define EPS 1e-4
#define OUTPUT(i) (cout << (ll)i << endl)
#define ALL(a) ((a).begin(), (a).end())

bool operator<(const pair<ll, ll> &a, const pair<ll, ll> &b)
{

    if (a.first == b.first)
        return a.second < b.second;

    return a.first < b.first;
}

ll arr[200010];
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    //cout << fixed << setprecision(10);

    ll N, T;
    cin >> N >> T;

    for (int i = 0; i < N; ++i)
        cin >> arr[i];

    ll ans = 0;

    for (int i = 0; i < N - 1; ++i)
    {
        if (arr[i + 1] - arr[i] > T)
        {
            ans += T;
        }
        else
        {
            int idx = 0;
            while (i + idx + 1 < N && arr[i + idx + 1] - arr[i + idx] <= T)
                idx++;
            if (idx)
                idx--;
            ans += arr[idx + i + 1] - arr[i];
            i = i + idx;
        }
    }
    cout << ans + T << endl;

    return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <unordered_map>
#include <queue>
#include <algorithm>
#include <climits>

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

using namespace std;



int main(int argc, char const* argv[])
{
    int N, X, Y;
    cin >> N >> X >> Y;
    std::vector<std::vector<size_t>> adj(N);
    adj[0].push_back(1);
    for(size_t i=1; i<N-1; i++){
        adj[i].push_back(i-1);
        adj[i].push_back(i+1);
    }
    adj[N-1].push_back(N-2);
    adj[X-1].push_back(Y-1);
    adj[Y-1].push_back(X-1);

    std::vector<std::vector<size_t>> costs(N);
    std::vector<std::vector<size_t>> queues(N);
    for(size_t i=0; i<N; i++){
        costs[i] = std::vector<size_t>(N, INT_MAX);
        costs[i][i] = 0;
    }
    for(size_t i=0; i<N; i++){
        queues[i].push_back(i);
    }

    //cout << "costs: " << endl;
    //for(size_t i=0; i<N; i++){
    //    for(size_t j=0; j<N; j++){
    //        cout << costs[i][j] << " ";
    //    }
    //    cout << endl;
    //}
    //cout << "queues: " << endl;
    //for(size_t i=0; i<N; i++){
    //    for(size_t j : queues[i]){
    //        cout << j << " ";
    //    }
    //    cout << endl;
    //}

    for(size_t k=1; k<=N-1; k++){
        size_t count = 0;
        for(size_t i=0; i<N; i++){
            std::vector<size_t> new_queue;
            for(size_t idx : queues[i]){
                for(size_t adj_idx : adj[idx]){
                    if(costs[i][adj_idx] > costs[i][idx]){
                        costs[i][adj_idx] = costs[i][idx] + 1;
                        new_queue.push_back(adj_idx);
                    }
                }
            }
            sort(new_queue.begin(), new_queue.end());
            new_queue.erase(unique(new_queue.begin(), new_queue.end()), new_queue.end());
            count += new_queue.size();
            queues[i] = new_queue;
        }

        //cout << "costs: " << endl;
        //for(size_t i=0; i<N; i++){
        //    for(size_t j=0; j<N; j++){
        //        cout << costs[i][j] << " ";
        //    }
        //    cout << endl;
        //}
        //cout << "queues: " << endl;
        //for(size_t i=0; i<N; i++){
        //    for(size_t j : queues[i]){
        //        cout << j << " ";
        //    }
        //    cout << endl;
        //}
        cout << count/2 << endl;
    }

    return 0;
}


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

using namespace std;

int main(){
    string s;
    cin >> s;
    int one_cnt = 0;
    int zero_cnt = 0;
    for(int i = 0; i < s.size(); i++){
        (s[i] == '0' ? zero_cnt++ : one_cnt++);
    }
    cout << s.size() - abs(zero_cnt - one_cnt) << endl; 
    return 0;
}

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


int main()
{
	int A, B, X;
	cin >> A;	cin >> B;
	cin >> X;

	if (((A < X) && ((A + B) >= X)) || (A == X))
		cout << "YES" << endl;
	else
		cout << "NO" << endl;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include<sstream>
#include<string>
#include<vector>
#include <cmath>
#include <limits>
#include <queue>
#include<algorithm>
 
using namespace std;
 
#define rep(i,n) for (int (i)=0;(i)<(n);i++)
 
int main(){
    int n;
    cin >> n;
    int p[n];
    rep(i,n) cin >> p[i];
    int d[n+1];
    d[0] = 2100000;
    rep(i,n) {
        if (p[i] < d[i]) d[i+1] = p[i];
        else d[i+1] = d[i];
    }
    int num = 0;
    rep(i,n){
        if (p[i] <= d[i]) num++;

    }
    cout << num;

    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n,k,i;
  cin>>n;
  vector<int> vec(n);
  for(int i=0; i<n; i++){
    cin>>vec.at(i);
  }
  sort(vec.begin(), vec.end());
  k=n/2;
  i=vec.at(k)-vec.at(k-1);
 
  cout<<i;
}

Measured memory_bytes: 640
n, m = map(int, input().split())
mat = [[0 for i in range(m)] for j in range(n)]
vec = [0] * m

# 行列の読み込み
for i in range(n):
    mat[i] = list(map(int, input().split()))

for i in range(m):
    vec[i] = int(input())

for i in range(n):
    res = 0
    for j in range(m):
        res += (mat[i][j] * vec[j])
    print(res)


Measured memory_bytes: 6024
while True:
    H, W = map(int, input().split())
    if H == 0 and W == 0:
        break
    tmp = ""
    for i in range(W +1):
        if i % 2 == 0:
            tmp += "#"
        else:
            tmp += "."
    for i in range(H):
        if i % 2 == 0:
            print(tmp[:W])
        else:
            print(tmp[1:W+1])
    print("")


Measured memory_bytes: 5616
#include<iostream>
#include<string>
#include<vector>
#include<iomanip>
#include<algorithm>
#include<queue>
#include<stack>
#include<map>
using namespace std;
#define ll long long
int main(){
    int a;
    int cnt[4];
    int i;
    for(i=0;i<4;i++)cnt[i]=0;
    for(i=0;i<6;i++){
      cin >> a;
      cnt[a-1]++;
      if(cnt[a-1]==3){
        cout << "NO";
        return 0;
      }
    }
    cout << "YES";
    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#ifndef err
#define err(...)(void)0
#endif
using namespace std;
#define CAT(a,b)a b
#define VASIZE(a,b,N,...)N
template<class T>auto size(T&&a)->decltype(a.size(), int()) { return a.size(); }
template<class T, class = enable_if_t<is_integral<T>::value, T>>int size(T a) { return a; }
#define REP(t,a,N)for(int t=size(a),_l##t=size(N);t<_l##t;t++)
#define RREP(t,a,N)for(int t=size(N)-1,_l##t=size(a);t>=_l##t;t--)
#define rep(t,...)CAT(REP,VASIZE(__VA_ARGS__,(t,__VA_ARGS__),(t,0,__VA_ARGS__)))
#define rrep(t,...)CAT(RREP,VASIZE(__VA_ARGS__,(t,__VA_ARGS__),(t,0,__VA_ARGS__)))
#define all(a)(a).begin(),(a).end()
typedef long long ll;
typedef unsigned long long ull;
void Calc();
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0); cin.exceptions(istream::failbit | istream::badbit);
  cout << fixed << setprecision(15); Calc(); cout.flush(); return 0;
}
template<class A>void amax(A&a, A b) { a = max(a, b); }
template<class A>void amin(A&a, A b) { a = min(a, b); }
struct Scanner {
  template<class A = string>A Next() { A a; cin >> a; return a; }
  template<class A = int>vector<A>Array(int n) { vector<A>a(n); for (A&i : a) cin >> i; return a; }
  string Line() { string s; getline(cin, s); return s; }
  template<class A>Scanner&operator,(A&a) { a = Next<A>(); return *this; }
  template<class A>operator A() { return Next<A>(); }
}in;

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

template<class T, class B, class...V>struct Vec {
  typedef Vec<T, V...>A; typedef vector<typename A::t>t; t nvec(B a, V...b) { return t(a, A().nvec(b...)); }
};
template<class T, class B>struct Vec<T, B> { typedef vector<T>t; t nvec(B a) { return t(a); } };
template<class T>tuple<T>Init(T t) { return tuple<T>(t); }
template<class T, class C>struct Vec<T, tuple<C>> { using t = T; T nvec(tuple<C> a) { return get<0>(a); } };
template<class T = int, class...B> typename Vec<T, B...>::t nvec(B...b) { return Vec<T, B...>().nvec(b...); }

template<class A>void OutContainer(A b, A e, const char *between = " ") {
  if (b != e)while (cout << *b, ++b != e) cout << between;
}
template<class T>void Out(const char* b, const T &t) { cout << t; }
template<class T, class... Args>void Out(const char* b, const T& t, const Args&... args) {
  cout << t << b;
  Out(b, args...);
}
template<class T, class... Args>void OutSpace(const T& t, const Args&... args) { Out(" ", t, args...); }


void Calc() {
  int n, l;
  in, n, l;
  auto a = in.Array(n);
  int pos = -1;
  rep(i, n - 1) {
    if (a[i] + a[i + 1] >= l) {
      pos = i;
      break;
    }
  }
  if (pos == -1) {
    cout << ("Impossible") << endl;
    return;
  }

  cout << ("Possible") << endl;
  err(pos);
  rep(i, pos) {
    cout << (i + 1) << endl;
  }
  rrep(i, pos + 2, n) {
    cout << (i) << endl;
  }
  cout << (pos + 1) << endl;
}


Measured memory_bytes: 1280
#include <stdio.h>
int main(){ 
     int i, j, n; 
     char mark; 
     char marks[4]={'S', 'H', 'C', 'D'}; 
     int num; 
     bool cards[4][13]={false}; 
 
 
     scanf("%d ", &n); 
     for(i=0;i<n;i++){ 
         scanf("%c %d ", &mark, &num); 
         for(j=0;j<4;j++){ 
             if(mark==marks[j]){ 
                 cards[j][num-1]=true; 
                 break; 
            } 
         } 
     } 
     for(i=0;i<4;i++){ 
         for(j=0;j<13;j++){ 
             if(!cards[i][j]){ 
                 printf("%c %d\n", marks[i], j+1); 
             } 
         } 
     } 
     return 0; 
 } 


Measured memory_bytes: 2620
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define LLINF 9223372036854775807
#define MOD ll(1e9+7)


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

}


Measured memory_bytes: 1024
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        
        if (a < b&&b <c){
        System.out.println("Yes");
        
        }else{
        System.out.println("No");
        }
}
}


Measured memory_bytes: 26088
#include <bits/stdc++.h>
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;

#define forn(i,n) for (int i = 0; i < int(n); ++i)
#define forsn(i,x,y) for(long long i = (x) ; i <= (y) ; ++i)
typedef long long ll;
typedef long double ld;

const int INTMAX = 1000000009;

int calcCost(vector<int> a, int m) {
  int total = 0;
  forn(i,a.size()) {
    total += (a[i] - m) * (a[i] - m);
  }
  return total;
}

int main() {
  int n;
  cin >> n;
  vector<int> a;
  forn(i,n) {
    int tmp;
    cin >> tmp;
    a.push_back(tmp);
  }
  int result = INTMAX;
  for(int i = -100; i <= 100; i++) {
    result = min(result, calcCost(a,i));
  }
  cout << result << endl;
  return 0;
}



Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;
typedef pair<int, int> P;
int main()
{
  int n;
  while(cin>>n,n) {
    set<P> SET;
    vector<P> point;
    FOR(i,0,n) {
      int y, x; cin >> y >> x;
      SET.insert(P(y, x));
      point.push_back(P(y, x));
    }
    int ans = 0;
    FOR(i,0,n) {
      int y = point[i].first;
      int x = point[i].second;
      FOR(j,0,n) {
        if(i == j) continue;
        int yy = point[j].first;
        int xx = point[j].second;

        int dy = yy - y;
        int dx = xx - x;
        if(dy >= 0) {
          int Y = yy - dx;
          int X = xx + dy;
          if(SET.count(P(Y, X)) == 0) continue;

          Y = Y - dy;
          X = X - dx;
          if(SET.count(P(Y, X)) == 0) continue;

          Y = Y + dx;
          X = X - dy;

          if(y == Y && x == X) {
            ans = max(ans, dy * dy + dx * dx);
          }
        }
      }
    }
    cout << ans << '\n';
  }
  return 0;
}

Measured memory_bytes: 3284
c = []

def listcreate():
    global c
    c = []
    for y in range(a[0]):
        b = []
        for x in range(a[1]):
            if y == 0 or y == a[0]-1 or x == 0 or x == a[1]-1:
                b.append("#")
            else:
                b.append(".")
        c.append(b)
    return

def listdraw():
    global c
    for y in range(len(c)):
        for x in range(len(c[0])):
            print(c[y][x], end='')
        print()
    return

for i in range(10000):
    a = list(map(int,input().split()))
    if sum(a)==0:
        break
    listcreate()
    listdraw()
    print()



Measured memory_bytes: 7176
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        int t=0;
        double ans = 0;
        for(int i=n ; i>0 ; i--){
          while((double)k > Math.pow(2,t)*(double)i ){
          t++;
          }
          //System.out.println(i+" "+t);
          ans += 1.0/((double)n*Math.pow(2,t));
        }
      System.out.println(ans);
    }
}

Measured memory_bytes: 22868
#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
int keta[100005][10];

int main(){
  string s;
  cin >> s;
  reverse(s.begin(),s.end());
  int n = s.size();
  for(int i=0; i<10; ++i){
    keta[0][i] = i;
  }
  for(int i=1; i<=100000; ++i){
    for(int j=0; j<10; ++j){
      keta[i][j] = keta[i-1][j] *10 %13;
    }
  }
  vector<vector<int>> dp(s.size(),vector<int>(13,0));
  for(int i=0; i<n; ++i){
    if(s[i] == '?'){
      if(i == 0) for(int j=0; j<10; ++j){
        dp[0][j] = 1;
      }
      else for(int k=0; k<10; ++k) for(int j=0; j<13; ++j){
        int oj = j -keta[i][k];
        if(oj <0) oj += 13;
        dp[i][j] = dp[i][j] + dp[i-1][oj];
        dp[i][j] %= MOD;
      }
    }else{
      int x = keta[i][s[i] - '0'];
      if(i == 0) dp[0][x] = 1;
      else for(int j=0; j<13; ++j){
        int oj = j-x;
        if(oj <0) oj +=13;
        dp[i][j] = dp[i-1][oj];
      }
    }
  }
  /*
  for(int i=0; i<3; ++i) for(int j=0; j<13; ++j){
    if(j != 12)cout << dp[i][j] << " ";
    else cout << dp[i][j] << endl;
  }
  */
  cout << dp[n-1][5] << endl;
}

Measured memory_bytes: 15932
//Author rahuliitkgp

/*A thing of beauty is a joy forever,
Its loveliness increases,
it will never pass into nothingness.*/
//Men at Work :)

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef long long int ll;

#define setbits(x)      __builtin_popcountll(x)
#define mod             1000000007
#define ps(x,y)         fixed<<setprecision(y)<<x
#define w(x)            int x; cin>>x; while(x--)
mt19937_64 mt(chrono::steady_clock::now().time_since_epoch().count());

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

void cpp(){
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
}

//constant space solution
int main(){
    cpp();
    ll n;
    cin>>n;
    ll ans = 0;
    for(ll i=1;i<=n; i++){
        ll x = n/i;
        ans+=(i*(x*(x+1)/2));
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3652
import java.util.*;
import static java.lang.Math.*;
import static java.util.Arrays.*;

public class Main {

	int INF = 1 << 28;
	int n, k;
	int dp[][][];
	int[] sp;
	final int p = 10000;
	
	void run() {
		Scanner sc = new Scanner(System.in);
//		for(;;) {
			n = sc.nextInt();
			k = sc.nextInt();
//			if( (n|k) == 0 ) break;
			sp = new int[n+1];
			dp = new int[n+1][3][2];
			for(int i=0;i<k;i++) sp[ sc.nextInt() ] = sc.nextInt();
			dp[0][0][1] = dp[0][1][1] = dp[0][2][1] = 1;
//			dp[1][0][0] = dp[1][1][0] = dp[1][2][0] = -1;
			
			for(int i=1;i<=n;i++) {
				if(sp[i] != 0) {
					for(int j=0;j<3;j++) { 
						if( j != sp[i]-1 )
						for(int k=0;k<2;k++) {
							dp[i][ sp[i]-1 ][0] += dp[i-1][j][k];
						}
						else dp[i][ sp[i]-1 ][1] = dp[i-1][ sp[i]-1 ][0];
					}
				}
				else {
					for(int j=0;j<3;j++) {
						for(int k=1;k<=2;k++) for(int l=0;l<2;l++)
							dp[i][j][0] += dp[i-1][(j+k)%3][l];
						dp[i][j][1] = dp[i-1][j][0];
					}
				}
				for(int j=0;j<3;j++) for(int k=0;k<2;k++) {
					if( i == 1) dp[i][j][k] /= 2;
					dp[i][j][k] %= p;
				}
//				debug(dp[i]);
			}
			int sum = 0;
			for(int j=0;j<3;j++) for(int k=0;k<2;k++) {
				sum += dp[n][j][k];
			}
			System.out.println((sum) % p);
//		}
	}

	public static void main(String[] args) {
		new Main().run();
	}

	void debug(Object... os) {
		System.err.println(Arrays.deepToString(os));
	}
}

Measured memory_bytes: 12000
#include<iostream>
#include<iomanip>
#include<math.h>
#include<algorithm>
#include<utility>
#include<queue>
#include<string.h>
#include<string>
#include<set>
#include<map>
#include<unordered_map>
#include<functional>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll INF=2e18;
const ll MOD=1e9+7;

ll N;
double dp[101][401][201]={};
ll t[101];
ll v[101];
int main(){
    cin>>N;
    for(ll i=0;i<N;i++){
        cin>>t[i];
    }
    for(ll i=0;i<N;i++){
        cin>>v[i];
    }
    for(ll i=0;i<N;i++){
        for(ll j=0;j<t[i]*2;j++){
            for(ll k=0;k<=v[i]*2;k++){
                dp[i][j][k]=-INF;
            }
        }
    }
    dp[0][0][0]=0;
    for(ll i=0;i<N;i++){
        for(ll j=0;j<t[i]*2;j++){
            for(ll k=0;k<=v[i]*2;k++){
                ll nextI=i;
                ll nextJ=j+1;
                if(nextJ==t[i]*2){
                    nextI=i+1;
                    nextJ=0;
                }
                double now=dp[i][j][k];
                if( k!=v[i]*2 ){
                    dp[nextI][nextJ][k+1]=max(dp[nextI][nextJ][k+1],now+k/2.0/2.0+0.25);
                }
                dp[nextI][nextJ][k  ]=max(dp[nextI][nextJ][k  ],now+k/2.0/2.0);
                if(k-1<0)continue;
                dp[nextI][nextJ][k-1]=max(dp[nextI][nextJ][k-1],now+k/2.0/2.0-0.25);
            }
        }
    }
    cout<<setprecision(10)<<dp[N][0][0]<<endl;
    return 0;
}

Measured memory_bytes: 63744
# -*- coding:utf-8 -*-
import sys
from fractions import gcd
from collections import Counter

def prime_factorization(n):
    """nを素因数分解する
    return d(dict): 素因数をキー、素因数の指数部を値とするディクショナリを返す

    n=140: d = {2: 2, 5: 1, 7: 1}
    """
    d = Counter()
    m = 2
    while m*m <= n:
        while n%m == 0:
            n //= m
            d[m] += 1
        m = m + 1 if m == 2 else m + 2

    if n > 1:
        d[n] += 1
    return d


def solve():
    A, B = list(map(int, sys.stdin.readline().split()))
    cd = gcd(A, B)

    if cd == 1:
        print(1)
        return

    """
    (素因数分解の素因数の個数)+1が答え
    """

    prime_d = prime_factorization(cd)
    print(len(prime_d)+1)


if __name__ == "__main__":
    solve()


Measured memory_bytes: 5076
# 解き直し
H, N = map(int, input().split())
A_to_minB = {}
max_A = -1
for i in range(N):
    a, b = map(int, input().split())
    max_A = max(max_A, a)
    if a not in set(A_to_minB.keys()):
        A_to_minB[a] = b
    else:
        A_to_minB[a] = min(A_to_minB[a], b)
dp = [float("inf")] * (H + max_A)
dp[0] = 0
for i in range(1, H+max_A):
    tmp = [dp[i-a]+b for a, b in A_to_minB.items() if a<=i]
    if tmp:
        dp[i] = min(tmp)
print(min(dp[H:H+max_A]))

Measured memory_bytes: 3680
#include<iostream>
#include<cstdio>
#include<cmath>
#include<string>
#include<vector>
#include<map>

using namespace std;

int main(){
	int n;
	int s_t,p_t,q_t,r_t,c_t;
	int P,Q,R,C;
	while(scanf("%d",&n)){
		if(n==0)
		break;
		else{
			vector<int> s,p,q,r,c;
			bool fg=false;
			for(int i=0;i<n;i++){
				scanf("%d %d %d %d",&s_t,&p_t,&q_t,&r_t);
				c_t=(4*p_t)+(9*q_t)+(4*r_t);
				s.push_back(s_t);
				p.push_back(p_t);
				q.push_back(q_t);
				r.push_back(r_t);
				c.push_back(c_t);
			}
			scanf("%d %d %d %d",&P,&Q,&R,&C);
			for(int i=0;i<n;i++){
				if(p[i]<=P&&q[i]<=Q&&r[i]<=R&&c[i]<=C){
					printf("%d\n",s[i]);
					fg=true;
				}
			}
			if(fg==false)
			printf("NA\n");
		}
	}
}


Measured memory_bytes: 3196
"""
author : halo2halo
date : 12, Jan, 2020
"""

import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

A, B = map(int, readline().split())

print(max(A + B, 2 * A - 1, 2 * B - 1))


Measured memory_bytes: 3060
#include <string.h>
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <istream>
#define INF 2147483647
#define LLINF 9223372036854775807
typedef long long ll;
using namespace std;
int main(){
	int n,k;
	cin>>n>>k;
	int cnt=0;
	while(n){
		cnt++;
		n/=k;
	}
	cout<<cnt<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>

using namespace std;

#define FOR(i,n) for(int i = 0; i < n; i++)
#define FORa(i,a,b) for(int i = a; i < b; i++)
#define pb(x) push_back(x)
#define mp(a, b) make_pair(a, b)
#define F first
#define S second
#define SORT(a,n) sort(begin(a), begin(a) + n)
#define VSORT(v) sort(v.begin(), v.end())
#define MAX 1000000
#define ll long long
#define LOW(s) transform(s.begin(),s.end(),s.begin(),::tolower)
#define UP(s) transform(s.begin(),s.end(),s.begin(),::toupper)

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

int main() {
	int h,w,k, total = 0;
	cin >> h >> w >> k;
	
	string s[h];
	FOR(i, h) cin >> s[i];
	
	for(int a = 0; a < (1 << h); a++) {
		for(int b = 0; b < (1 << w); b++) {
			int n = 0;
			
			for(int i = 0; i < h; i++) {
				for(int j = 0; j < w; j++) {
					if((((a >> i) & 1) == 0) && (((b >> j) & 1) == 0) && s[i][j] == '#')
						n++;
				}
			}
			if(n == k) total++;
		}
	}
	
	cout << total << endl;
	
	return 0;
}


Measured memory_bytes: 3604
n=int(input())
w_list=list(map(int, input().split()))

w_sum = sum(w_list)

ans_list=[]

value1=0
value2=0
for index in range(n -1):
    if index == 0:
        value1 = w_list[0]
        value2 = w_sum - w_list[0]
        ans_list.append(abs(value1 - value2))
        continue
    
    value1 += w_list[index]
    value2-=w_list[index]
    ans_list.append(abs(value1 - value2))

print(min(ans_list))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define ld long double
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
using P=pair<long long,long long>;
#define rep(i,n) for(long long i=0; i<(long long)n; i++)
#define req(i,n) for(long long i=n-1; i>=0; i--)
#define range(i,a,b) for(long long i=a; i<b; i++)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((long long)(x).size())
#define COUT(x) cout << x << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define onBoard(y,x) (y>=0 && y<h && x>=0 && x<w)
#define pri_que priority_queue
#define vint vector<int>
#define vvint vector<vector<int>>
#define vi vector<int>
#define vvi vector<vector<int>>
#define vs vector<string>
#define vvc vector<vector<char>>
#define vc vector<char>
#define vp vector<pair<int,int>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define show(x) cout<<#x<<"="<<x<<endl;
#define SUM(x) accumulate(x.begin(),x.end(),0)
#define MAX(x) *max_element(x.begin(),x.end())
#define MIN(x) *min_element(x.begin(),x.end())
#define couty cout<<"Yes"<<endl
#define coutn cout<<"No"<<endl
#define coutY cout<<"YES"<<endl
#define coutN cout<<"NO"<<endl
#define yn(x) cout<<(x?"Yes":"No")<<endl
#define YN(x) cout<<(x?"YES":"NO")<<endl
long long gcd(long long a,long long b){return b?gcd(b,a%b):a;}
long long lcm(long long a, long long b){return a/gcd(a,b)*b;}
const long long dx[8]={1,0,-1,0,1,-1,-1,1};
const long long dy[8]={0,1,0,-1,1,1,-1,-1};
const long long INF = 1e15;
const long long MOD = 1e9+7;

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

    int a,b,c; cin >> a >> b >> c;
    yn(a<=c && c<=b || b<=c && c<=a);
}

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

int main() {
        int n;
        scanf("%d", &n);
        printf("%d\n", (n + 1) / 2 - 1);
        return 0;
}


Measured memory_bytes: 256
N, M, C = map(int, input().split())
B = list(map(int, input().split()))
ans = 0
for i in range(N):
    calc = C
    A = list(map(int, input().split()))
    for j in range(M):
        calc += A[j] * B[j]
    if calc > 0:
        ans += 1
print(ans)


Measured memory_bytes: 3060
#include <iostream>
#include <iomanip>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <memory>
#include <cstring>
#include <cassert>
#include <numeric>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <cctype>
#include <unordered_map>
#include <unordered_set>
using namespace std;

#define REP2(i, m, n) for (int i = (int)(m); i < (int)(n); i++)
#define REP(i, n) REP2(i, 0, n)
#define ALL(S) (S).begin(), (S).end()
typedef long long ll;

int main(){
  ios::sync_with_stdio(false);
  int M, T, P, R;
  while (cin >> M >> T >> P >> R && M + T + P + R > 0){
    vector<int> sum(T);
    vector<int> num(T);
    vector<vector<int> > wa(T, vector<int>(P));
    REP(i, R){
      int m, t, p, j;
      cin >> m >> t >> p >> j;
      t--, p--;
      if (j == 0){
        num[t]++;
        sum[t] += wa[t][p] * 20 + m;
      } else {
        wa[t][p]++;
      }
    }
    vector<tuple<int, int, int> > vp;
    REP(i, T){
      vp.push_back(make_tuple(-num[i], sum[i], -i));
    }
    sort(ALL(vp));

    REP(i, T){
      if (i > 0){
        if (get<0>(vp[i]) == get<0>(vp[i - 1]) && get<1>(vp[i]) == get<1>(vp[i - 1])){
          cout << "=";
        } else {
          cout << ",";
        }
      } 
      cout << - get<2>(vp[i]) + 1;
    }
    cout << endl;
  }
  return 0;
}

Measured memory_bytes: 1228
# Otoshidama
N,Y = gets.chomp.split(" ").map(&:to_i)
osatu = []
osatu10000 = 10000
osatu5000 = 5000
osatu1000 = 1000
k = 0
ans = []
flg = 0
for i in 0..N do
    for j in 0..N do
        k = N - i - j
        if osatu10000*i + osatu5000*j + osatu1000*k == Y && k >= 0
            ans.push(i)
            ans.push(j)
            ans.push(k)
            isBreak = true
            flg = 1
            break
        end
    end
    break if isBreak
end

if flg == 1
    puts ans.join(" ")
else
    puts "-1 -1 -1"
end

Measured memory_bytes: 1788
/*#include <iostream>
using namespace std;

//Compiler version g++ 6.3.0

int main()
{
   /* int tt;
    cin >> tt;
    while(tt--){
      int N,K;
      cin >> N >> K;
      int arr[N];
      int org = 0,less = 0;
      for(int i = 0; i < N; i++){
        cin >> arr[i];
        org += arr[i];
        if(arr[i] > K){
          less += arr[i];
          continue;
        }
        less += arr[i];
      }
      cout << org - less << "\n"; 
    }*/
      #include <bits/stdc++.h>
using namespace std;

int main(){
  int n,k;
  cin >> n >> k;
  
  vector<int> v(n);
  for(int i = 0; i < n; i++){
    int x;
    cin >> x;
    v[i] = x;
  }
  int flag = 0;
  int cnt = -1;
  for(int i = 0; i < n; i = i + k - 1){
    cnt++;
    if(i == n - 1)break;
    if(n - i - 1 < k - 1){
      flag = 1;
      break;
    }
    
  }
  if(flag)cnt++;
  cout << cnt;
    
}



Measured memory_bytes: 3740
#include <iostream>
#include <vector>
#include <queue>
#include <cmath>
#include <algorithm>
// #include <string>

#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define INF 999999999
using namespace std;

int main() {
  string s;
  cin >> s;
  int num = 700;
  for (size_t i = 0; i < 3; i++) {
    if (s[i] == 'o') num+=100;
  }
  cout << num << endl;
}


Measured memory_bytes: 256
/*input
10000 1 1
*/
 
 
 
#include <bits/stdc++.h>
using namespace std;
 
 
 
#define int long long int
#define rep(i,n) \
    for(int i = 0; i < n; i++)
#define rep2(i, a, b) \
    for(int i = a; i < b; i++)
#define all(c) \
    c.begin(), c.end()
#define init(arr, num) \
    memset(arr, num, sizeof(arr))
#define fast\
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define inputFile \
    freopen("input.txt", "r", stdin); 
#define outputFile \
    freopen("output.txt", "w", stdout);
#define modM 1000000007
#define PI 3.1415926535897932
#define F first
#define S second  
#define pb push_back  
#define INF 3e18
#ifdef gaviria
#define TRACE
#endif
#ifdef TRACE
#define trace(...) _f(#VA_ARGS, __VA_ARGS_)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
    cout << name << " : " << arg1 << std::endl;
 
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
    const char* comma = strchr(names + 1, ','); cout.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...);
}
#else
#define trace(...)
#endif
 
 
typedef long long ll;
typedef vector<int> vi;
typedef vector< vi > vvi;
typedef pair< ll, ll > ii;
typedef unordered_set<int> usi;
 
 
 
ll n,i,j,k,m,c;




void solve()
{
    cin>>n>>m>>k;

    if(m*k>=n)
    {
        cout<<"Yes";
    }
    else cout<<"No";


    }
 
 
 
signed main()
{// inputFile;


    fast;
    int T = 1;
    // cin >> T;
    ll h=T;
    while(T--){
 
        solve();
        cout<<endl;
 
     
        
        
 
    }
    
    
    return 0;
 
}

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

int dfs(vector<vector<int>> &g, int x, vector<int> &dp){
    if(dp[x]!=-1)
        return dp[x];
    dp[x]=1;
    for(auto i:g[x])
        dp[x]=max(dfs(g, i, dp)+1, dp[x]);
    return dp[x];
}

int main(){
    int n, m;
    cin >> n >> m;
    vector<vector<int>> g(n);
    vector<int> dp(n, -1), vis(n, 0);
    for(int i=0; i<m; i++){
        int x, y;
        cin >> x >> y;
        g[x-1].push_back(y-1);
    }
    int m1 = 0;
    for(int i=0; i<n; i++){
        dp[i] = dfs(g, i, dp);
        m1 = max(m1, dp[i]);
    }
    cout<<m1-1<<endl;
}

Measured memory_bytes: 9856
import sys
# sys.setrecursionlimit(100000)


def input():
    return sys.stdin.readline().strip()


def input_int():
    return int(input())


def input_int_list():
    return [int(i) for i in input().split()]


def main():
    x, y, a, b, c = input_int_list()
    P = [-1] + sorted(input_int_list())  # 番兵
    Q = [-1] + sorted(input_int_list())
    R = [-1] + sorted(input_int_list())
    A = []
    B = []
    C = []
    for i in range(x + y):
        if R[-1] >= P[-1] and R[-1] >= Q[-1]:
            C.append(R.pop())
        elif P[-1] >= Q[-1] and P[-1] >= R[-1]:
            A.append(P.pop())
        else:
            B.append(Q.pop())
    if len(A) <= x and len(B) <= y:
        print(sum(A) + sum(B) + sum(C))
    elif len(A) > x:
        for j in range(len(A) - x):
            if R[-1] >= Q[-1]:
                C.append(R.pop())
            else:
                B.append(Q.pop())
        print(sum(A[:x]) + sum(B) + sum(C))
    elif len(B) > y:
        for j in range(len(B) - y):
            if R[-1] >= P[-1]:
                C.append(R.pop())
            else:
                A.append(P.pop())
        print(sum(A) + sum(B[:y]) + sum(C))

    return


if __name__ == "__main__":
    main()


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

int main() {
	int n,m;cin>>n>>m;
  	vector<int> p(m);
  	vector<int> y(m);
   //県ごとに配列を作成し、県ごとの配列にそれぞれ値をpush_backする。
  	vector<int> yd[n+1];
  	for(int i=0;i<m;i++){
    	cin>>p[i]>>y[i];
      	yd[p[i]].push_back(y[i]);
    }
   //県ごとにsortする。
  	for(int i=0;i<n;i++){
    	sort(yd[i+1].begin(),yd[i+1].end());	
    }
   //県番号を出力。続いて県の中の位置を出力する
  	for(int i=0;i<m;i++){
    	cout<<setfill('0')<<right<<setw(6)<<p[i];
      	cout<<setfill('0')<<right<<setw(6)<<lower_bound(yd[p[i]].begin(),yd[p[i]].end(),y[i])-yd[p[i]].begin()+1<<endl;   
    }
}


Measured memory_bytes: 7808
#include <iostream>
#include <fstream>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>
#include <iomanip>

using namespace std;
#define LOCAL  1
#define UPLOAD 2
#define ll long long
ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
template <class T = long long> T input(){T x;cin >> x;return x;}
template <class T> void output(T x){cout << x << endl;}
#define debug(x) cerr << #x<< ": " << x<< '\n';
#define debugBit(x,n) cerr << #x<< ": " << std::bitset<n>(x) << '\n';

int main()
{
#if ENVIRONMENT == LOCAL
    std::ifstream in("input.txt");
    std::cin.rdbuf(in.rdbuf());
#endif
  long A = input();
  long B = input();
  
  output(A*B/gcd(A,B));

  return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("O3")
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
using P=pair<ll,ll>;
template<class T> using V=vector<T>; 
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
const ll inf=(1e18);
//const ll mod=998244353;
const ll mod=1000000007;
const vector<int> dy={-1,0,1,0},dx={0,-1,0,1};
ll GCD(ll a,ll b) {return b ? GCD(b,a%b):a;}
ll LCM(ll c,ll d){return c/GCD(c,d)*d;}
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20);}} __init;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
template<class T>void debag(const vector<T> &a){cerr<<"debag :";for(auto v:a)cerr<<v<<" ";cerr<<"\n";}
template<class T>void print(const vector<T> &a){for(auto v:a)cout<<v<<" ";cout<<"\n";}
int main(){
    int n;
    cin>>n;
    V<P> a(n);
    for(int i=0;i<n;i++)cin>>a[i].fi>>a[i].se;
    for(int i=0;i<n-2;i++){
        if(a[i].fi==a[i].se&&a[i+1].fi==a[i+1].se&&a[i+2].fi==a[i+2].se){
            cout<<"Yes"<<"\n";
            return 0;
        }
    }
    cout<<"No"<<"\n";
}

Measured memory_bytes: 3656