akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
const ll MOD = 1000000007;
const ll INF = 10000000000000000;
vector<int> x4 = {0, 1, 0, -1}, x8 = {0, 1, 1, 1, 0, -1, -1, -1};
vector<int> y4 = {1, 0, -1, 0}, y8 = {1, 1, 0, -1, -1, -1, 0, 1};
template<class T> struct edge { int from, to; T cost;};
template<class T> inline bool chmin(T& a, T b){if (a>b){a = b; return true;}return false;}
template<class T> inline bool chmax(T& a, T b){if (a<b){a = b; return true;}return false;}
template<class T> inline T powerM(T a,T b){if (b==0) return 1;
T tmp = powerM(a,b/2); if (b%2==0) return tmp*tmp%MOD; else return tmp*tmp%MOD*a%MOD; }
template<class T> inline T power(T a,T b,T m){ if (b==0) return 1;
  T tmp = power(a,b/2,m); if (b%2==0) return tmp*tmp%m; else return tmp*tmp%m*a%m; }
template<class T> inline T gcd(T a, T b){if (b==0) return a; return gcd(b, a%b);}
template<class T> inline T lcm(T a, T b){return a / gcd(a,b) * b;}
// ax+by=gcd(a,b)を解く
template<class T> inline T extgcd(T a,T b,T &x,T &y){if (b==0){x=1; y=0; return a;} T d=extgcd(b,a%b,y,x); y -= a/b*x; return d;}
void hey(){ cout <<"hey" <<endl; }


int main() {
  int N; cin >>N;
  deque<int> que;
  stack<int> st;
  string s; int x;
  rep(i, N){
    cin >>s;
    if (s[0] == 'i'){
      scanf("%d", &x);
      que.push_front(x);
    }else if (s == "delete"){
      scanf("%d", &x);
      while (!que.empty()){
        if (que.front() == x){
          que.pop_front();
          break;
        }else{
          st.push(que.front()); que.pop_front();
        }
      }
      while (!st.empty()){
        que.push_front(st.top()); st.pop();
      }
    } else if (s[6] == 'F'){
    // }else if (s == "deleteFirst"){
      que.pop_front();
    }else{
      que.pop_back();
    }
  }
  if (!que.empty()){
    printf("%d", que.front());
    que.pop_front();
  }
  while (!que.empty()){
    printf(" %d", que.front());
    que.pop_front();
  }
  printf("\n");
}


Measured memory_bytes: 7184
#include<iostream>
#include<algorithm>
#include<vector>
#include<functional>
#include<string>
#include<cmath>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<cstdio>
#include<numeric>
using namespace std;
using ll = long long;
int main(){
  int h, w;
  cin >> h >> w;
  vector<vector<char>> a(h, vector<char>(w)), b(h, vector<char>(w)), c(h, vector<char>(w));
  for(int i = 0; i < h; i++) {
    string s;
    cin >> s;
    for(int j = 0; j < w; j++){
      a[i][j] = s[j];
    }
  }
  for(int i = 0; i < h; i++){
    bool white = false;
    for(int j = 0; j < w; j++) {
      if(a[i][j] == '.'){
        white = true;
      }else{
        white = false;
        break;
      }
    }
    if(white){
      for(int j = 0; j < w; j++){
        b[i][j] = '0';
      }
    }else{
      for(int j = 0; j < w; j++){
        b[i][j] = a[i][j];
      }
    }
  }


  for(int i = 0; i < w; i++){
    bool white = false;
    for(int j = 0; j < h; j++) {
      if(b[j][i]== '0'){
        white = true;
        continue;
      }
      if(b[j][i] == '.'){
        white = true;
      }else{
        white = false;
        break;
      }
    }
    if(white){
      for(int j = 0; j < h; j++){
        c[j][i] = '0';
      }
    }else{
      for(int j = 0; j < h; j++){
        c[j][i] = b[j][i];
      }
    }
  }
  for(int i = 0; i < h; i++){
    bool white = false;
    for(int j = 0; j < w; j++) {
      if(c[i][j] == '0') {
        white = true;
      }else{
        white = false;
        break;
      }
    }
    if(white){
      continue;
    }
    for(int j = 0; j < w; j++) {
      if(c[i][j] == '0') {
        continue;
      }
      cout << c[i][j];
    }
    cout << '\n';
  }
  return 0;
}

Measured memory_bytes: 256
import math, string, itertools, fractions, heapq, collections, re,  array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10**7)
inf = 10 ** 20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def pf(s): return print(s, flush=True)

N = I()
A = LI()

counts = collections.Counter(A)

result = 0
for c in counts:
    if c < counts[c]:
        # 必要な数より多い場合
        result += counts[c] - c
    elif c > counts[c]:
        # 必要な数より少ない場合
        result += counts[c]
print(result)


Measured memory_bytes: 20196
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

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

    static class A {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            String S = in.next();
            boolean[] flg = new boolean[3];
            flg[S.charAt(0) - 'a'] = true;
            flg[S.charAt(1) - 'a'] = true;
            flg[S.charAt(2) - 'a'] = true;
            out.println(flg[0] && flg[1] && flg[2] ? "Yes" : "No");

        }

    }
}



Measured memory_bytes: 21844
#include <vector>
#include <iostream>
#include <map>
#include <algorithm>
#include <random>
#include <complex>
#include <unordered_map>
#include <cmath>
#include <cstring>
#include <cassert>
#include <cstdio>
#include <bitset>

using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;

const int MN = 501*1000*1000;

ll gcd(ll a, ll b) {
    if (!a) return b;
    return gcd(b%a, a);
}
ll ext_gcd(ll a, ll b, ll &x, ll &y) {
    ll d = a;
    if (b) {
        d = ext_gcd(b, a%b, y, x);
        y -= a / b*x;
    } else {
        x = 1;
        y = 0;
    }
    return d;
}

int w, d, n, m, t, u, h;
int x, tu;
void init() {
    m = t-m%t;
    u = gcd(t, w+d), h = gcd(t, m);
    tu = t/u;
    ll xx, y;
    ext_gcd(m, t, xx, y);
    x = ((xx % t) + t) % t;
}
int solve() {
    init();

    int res = 0;
    int l = 0;

    int s = 0;
    int th = t/h;
    for (int i = 0; i < t; i += h) {
        if (s<n) {
            res += max(0, (i-l-w) / u);
            l = i/u*u;
        }
        s += x; s %= th;
    }
    res += max(0, (t-l-w)/u);
    return res;
}

int main() {
    cin >> w >> d >> n >> m >> t; w++; d--;
    printf("%.20f\n", 1.0 * solve() / tu);
    return 0;
}

Measured memory_bytes: 1172
N, K = map(int, input().split())
A = [0] + list(map(int, input().split()))

cnt = [-1 for _ in range(N + 1)]
cnt[1] = 0

p = A[1]
l = 1

while cnt[p] == -1:
    if l == K:
        print(p)
        exit()

    cnt[p] = l
    p = A[p]
    l += 1

lp = (l - cnt[p])
k = (K - cnt[p]) % lp + cnt[p]

for i, c in enumerate(cnt):
    if k == c:
        print(i)
        break


Measured memory_bytes: 32384
import sys
sys.setrecursionlimit(10**7)

N, Q = map(int, input().split())
root = [[] for i in range(N)]
ans = [0]*N

for i in range(N-1):
  a, b = map(int, input().split())
  a, b = a-1, b-1
  root[a].append(b)
  root[b].append(a)
  
for i in range(Q):
  p, x = map(int, input().split())
  ans[p-1] += x
  
visit = [False]*N
def dfs(n):
  visit[n] = True
  for go in root[n]:
    if visit[go]:
      continue
    ans[go] += ans[n]
    dfs(go)
    
dfs(0)
print(*ans)

Measured memory_bytes: 223404
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(ll i=0;i<n;i++)
#define cY cout << "Yes" << endl;
#define cN cout << "No" << endl;

int main() {
  int n;
  cin >> n;
  map<string,int>mp;
  rep(i,n){
    string s;
    cin >> s;
    mp[s]++;
  }
  int mx = 0;
  for(auto a:mp) mx = max(mx,a.second);
  for(auto a:mp){
    if(a.second != mx) continue;
    cout << a.first << endl;
  }  
  return 0;
}


Measured memory_bytes: 25216
// I make this just for fun because i'm done
// Aimi Haraguni >> Konomi Suzuki >> Yui >>  Ikimono Gakari >> Garnidelia >> Kalafina >> Eir Aoi.   .. dude? 
// problems that involves any kind of persistent data structures are the best of the best, are not them?
 
// #pragma GCC optimize ("Ofast,unroll-loops")
// #pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
 
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
 
#define pb push_back
#define ff  first
#define ss second
#define tm1 first
#define tm2 second.first
#define tm3 second.second
#define sz(x) ll(x.size())
#define all(v) (v).begin(), (v).end()
#define fill(x, v) memset(x, v, sizeof(x))
#define FER(i,a,b) for(int i=int(a); i< int(b); ++i)
#define IFR(i,a,b) for(int i=int(a); i>=int(b); --i )
#define fastio ios_base::sync_with_stdio(0); cin.tie(0)
 
// #define N 21000000
// #define M 19
// #define mod3 9
 
#define mod1  998244353
#define mod 48
#define mod2 1000000009
#define mody 998244353
#define bas 987625403
#define sqr(x) (x)*(x)  
#define INF 3000000000000000000
#define N1 1000
 
using namespace std;
using namespace __gnu_pbds;
 
typedef long long ll;
typedef pair<ll, ll> ii;
typedef pair<ll, ii > tri;
typedef vector<ll> vi;
typedef vector<vi> vv;
typedef vector<ii> vii;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> S_t;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
 
#define trace(...) fff(#__VA_ARGS__, __VA_ARGS__)
template<typename t> void fff(const char* x, t&& val1) { cout<<x<< " : "<<val1<<"\n";}
template<typename t1, typename... t2> void fff(const char* x, t1&& val1, t2&&... val2){
    const char* xd=strchr(x+1, ',');
    cout.write(x, xd-x)<<" : "<<val1<<" | ";
    fff(xd+1, val2...);
}
 
inline ll add(ll a, ll b) { return a+b < mod? a+b : a+b-mod;}
inline ll rem(ll a, ll b) { return a >= b? a - b: a- b + mod;}
inline ll mul(ll a, ll b) { return (long long) a*b%mod;}
inline void Mul(ll &a, ll b) { a = (long long) a*b%mod;}
inline ll bp(ll a, ll p){
    ll ret;
    for(ret = 1; p; p>>=1, Mul(a, a)) (p & 1) && (Mul(ret, a), 1);
    return ret;
}
 
 
static inline void read(ll &result) {
    bool minus = false;
    char ch;
    ch = getchar();
    while (true) {
        if (ch == '-') break;
        if (ch >= '0' and ch <= '9') break;
        ch = getchar();
    }
    (ch == '-')? minus = true: result = ch-'0';
    while (true) {
        ch = getchar();
        if (ch < '0' or ch > '9') break;
        result = (result<<3)+ (result<<1) + (ch - '0');
    }
    if(minus) result=-result;
}


int main(){
	string s, t; cin>>s>>t;
	ll resp = INF;
	FER(i, 0, sz(s) -sz(t) + 1){
		string cur = s.substr(i, sz(t));
		ll ans = 0;
		FER(j, 0, sz(t)) ans += cur[j] != t[j];
		resp = min(ans, resp);
	}
	cout<<resp<<"\n";
	return 0;
}

Measured memory_bytes: 3636
#include <cstdio>
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <string>
#include <cstring>
#include <sstream>
#include <algorithm>
using namespace std;

typedef long double ld;

const int Maxm = 32;

int a, b, c, d, e, f;
bool has[Maxm];
ld besta = -1;
int bestb, bestc;

int main()
{
	scanf("%d %d %d %d %d %d", &a, &b, &c, &d, &e, &f);
	for (int i = 0; i < Maxm; i += a)
		for (int j = 0; j < Maxm; j += b)
			if (i + j < Maxm) has[i + j] = true;
	for (int i = 1; i < Maxm; i++) if (has[i])
		for (int j = 0; j <= f; j += c)
			for (int k = 0; k <= f; k += d)
				if (100 * i + j + k <= f && j + k <= e * i) {
					ld cand = ld(100 * (j + k)) / ld(100 * i + j + k);
					if (cand > besta + 1e-11l) {
						besta = cand; bestb = 100 * i + j + k, bestc = j + k;
					}
				}
	printf("%d %d\n", bestb, bestc);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; (i) < (int)(n); ++ (i))
#define REP3(i, m, n) for (int i = (m); (i) < (int)(n); ++ (i))
#define REP_R(i, n) for (int i = (int)(n) - 1; (i) >= 0; -- (i))
#define REP3R(i, m, n) for (int i = (int)(n) - 1; (i) >= (int)(m); -- (i))
#define ALL(x) ::std::begin(x), ::std::end(x)
using namespace std;


int64_t solve(int64_t A, double B) {
    // TODO: edit here
    long long C = (B * 100 + 0.5);
    return A * C / 100;
}

// generated by online-judge-template-generator v4.4.0 (https://github.com/kmyk/online-judge-template-generator)
int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    constexpr char endl = '\n';
    double A;
    double B;
    cin >> A >> B;
    auto ans = solve(A, B);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3712
#include<iostream>
#include<string>
#include<algorithm>
#include<math.h>
#include<queue>
#include<vector>
#include<map>
#include<cstdlib>



using namespace std;


int main(){
    int a,b;
    cin >> a ;
    cin >> b;
    for(int i=1;i<=3;i++){
        if(i != a && i != b){
            cout << i << endl;
        }
    }
    



    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {

    public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
    	// 入力
    	int a = sc.nextInt();

    	int a100 = a/100;
    	int a10 = a/10 - a100*10;
    	int a1 = a - a100*100 - a10*10;
    	int rev = a1*100 + a10*10 + a100;
    	String ans;

    	if (a == rev){
    		ans = "Yes";
    	} else {
    		ans = "No";
    	}

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

Measured memory_bytes: 21844
H, W = map(int, input().split())
S = []
for i in range(H):
  S.append(list(i for i in input()))
# 参考https://atcoder.jp/contests/abc075/submissions/5409794
for i in range(H):
  for j in range(W):
    if S[i][j] == ".":
      cnt = 0
      if i != 0:
        cnt += S[i-1][max(0, j-1) : min(j+1, W-1) + 1].count("#")
      cnt += S[i][max(0, j-1) : min(j+1, W-1) + 1].count("#")
      if i != H-1:
        cnt += S[i+1][max(0, j-1) : min(j+1, W-1) + 1].count("#")
      S[i][j] = str(cnt)
for i in range(H):
	print("".join(S[i]))



Measured memory_bytes: 3188
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define pb push_back
#define all(v) v.begin(),v.end()
#define fi first
#define se second
#define bigger (char)toupper
#define smaller (char)tolower
using namespace std;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef long long ll;
typedef unsigned long long ull;

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

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

ll Digit(ll x) {
    int counter=0;
    if(x==0) counter=1;
    else {
        while(x>0) {
            x/=10;
            counter++;
        }
    }
    return counter;
}

int main() {
    int A,B;
    string S;
    cin>>A>>B>>S;
    bool ok=true;
    if(S.at(A)!='-') ok=false;
    int N=A+B+1;
    rep(i,N) {
        if(i==A) continue;
        else if(S.at(i)=='-') ok=false;
    }
    if(ok) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

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

stack<int> S;

int main() {
  char ch[7];
  while (cin >> ch) {
    int a, b;
    switch (ch[0]) {
      case '+':
        a = S.top(); S.pop();
        b = S.top(); S.pop();
        S.push(a + b);
        break;
      case '-':
        b = S.top(); S.pop();
        a = S.top(); S.pop();
        S.push(a - b);
        break;
      case '*':
        a = S.top(); S.pop();
        b = S.top(); S.pop();
        S.push(a * b);
        break;
      default:
        S.push(atoi(ch));
        break;
    }
  }
  cout << S.top() << endl;
  return 0;
}

Measured memory_bytes: 1192
#include <bits/stdc++.h>
#include <array>
using namespace std;
using ULL = unsigned long long;
using UL = unsigned;
using LL = long long;
#define rep(i, n) for(UL i = 0; i < (n); i++)

struct Problem {

	struct Node { UL color = 0; UL pri = 0; };

	void Solve() {
		UL N, M, Q; cin >> N >> M;
		vector<Node> G(N);
		vector<vector<UL>> E(N);
		rep(i, M) {
			UL a, b; cin >> a >> b; a--; b--;
			E[a].push_back(b);
			E[b].push_back(a);
		}
		vector<vector<pair<UL, Node>>> q(11);
		cin >> Q;
		rep(i, Q) {
			UL v, d, c; cin >> v >> d >> c;
			v--;
			q[d].push_back({ v, { c, i + 1 } });
		}
		for (auto p : q[10]) {
			if(G[p.first].pri < p.second.pri) G[p.first] = p.second;
		}
		for (UL i = 1; i <= 10; i++) {
			vector<Node> Gbuf = G;
			rep(v, N) {
				for (UL e : E[v]) {
					if (Gbuf[e].pri < G[v].pri) Gbuf[e] = G[v];
				}
			}
			G = move(Gbuf);
			for (auto p : q[10 - i]) {
				if (G[p.first].pri < p.second.pri) G[p.first] = p.second;
			}
		}
		rep(i, N) {
			cout << G[i].color << endl;
		}
	}


	Problem();
};
int main() {
	unique_ptr<Problem> p(new Problem());
	p->Solve();
	return 0;
}
Problem::Problem() {
	cout << fixed << setprecision(10);
}

Measured memory_bytes: 10072
n = int(input())
a = [0] + list(map(int, input().split()))
a.append(0)
d = []
for i in range(1, n+2):
  d.append(abs(a[i - 1] - a[i]))
base = sum(d)
for i in range(1, n+1):
  print(base - d[i - 1] - d[i]
    + abs(a[i - 1] - a[i + 1]))
  
         


Measured memory_bytes: 60396
#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1.);
typedef complex<double> P;

P p;
double dir = pi / 2.;

int main()
{
	p = P(0, 0);
	double n, d;
	while (scanf("%lf,%lf", &n, &d), (int)n | (int)d){
		p += polar(n, dir);
		dir -= d * pi / 180;
	}
	
	printf("%d\n%d\n", (int)p.real(), (int)p.imag());
	
	return 0;
}

Measured memory_bytes: 1216
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_set>
#include <vector>

using namespace std;

#define ll long long
#define P pair<int, int>
#define FOR(i, N) for (int i = 0; i < (int)N; i++)
#define FORIN(i, a, b) for (int i = a; i < (int)b; i++)
#define ALL(x) (x).begin(), (x).end()
#define GI(name) \
  int(name);     \
  scanf("%d", &(name))
#define GI2(name1, name2) \
  int(name1), (name2);    \
  scanf("%d %d", &(name1), &(name2))
#define GI3(name1, name2, name3) \
  int(name1), (name2), (name3);  \
  scanf("%d %d %d", &(name1), &(name2), &(name3))
#define GVI(name, size)    \
  vector<int>(name)(size); \
  FOR(i, (size)) scanf("%d", &(name)[i])
#define GS(name) \
  string(name);  \
  cin >> (name);
#define MOD 1000000007
#define DEBUG(...) debug(__LINE__, ":" __VA_ARGS__)

string to_string(string s) {
  return s;
}

template <class T>
string to_string(vector<T> v) {
  string ret = "{";
  for (int i = 0; i < v.size() - 1; ++i) {
    ret += to_string(v[i]) + ",";
  }
  if (v.size() > 0) {
    ret += to_string(v.back());
  }
  ret += "}";
  return ret;
}

void debug() {
  cerr << endl;
}

template <class Head, class... Tail>
void debug(Head head, Tail... tail) {
  cerr << to_string(head) << " ";
  debug(tail...);
}

void print() {
  cout << endl;
}

template <class Head, class... Tail>
void print(Head head, Tail... tail) {
  cout << to_string(head);
  print(tail...);
}

int main() {
  GVI(A, 3);
  sort(ALL(A));
  print((A[0] == 5 && A[1] == 5 && A[2] == 7) ? "YES" : "NO");
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<vector>
#include<map>
#include<unordered_map>
#include<set>
#include<string>
#include<algorithm>
#include<math.h>
#include<numeric>
#include<iomanip>
#include<queue>
#include<functional>
#include<iso646.h>
#include<bitset>

using namespace std;

typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long long ll;
typedef vector<long long> vll;
typedef pair<long long, long long> pll;

//const ll INF = 1e19;
//const ll MOD = 1e9 + 7;
const ll MOD = 998244353;

ll gcd(ll n, ll m){
	if (n > m){
		ll l = n;
		n = m;
		m = l;
	}
	while (1){
		ll l = n;
		n = m%n;
		m = l;
		if (n == 0){
			break;
		}
	}
	return m;
}

int main(){
	ll T;
	cin>>T;
	ll i, j;
	for(i=0;i<T;i++){
		ll A, B, C, D;
		cin>>A>>B>>C>>D;
		ll g = gcd(gcd(A, B), gcd(C, D));
		A /= g;
		B /= g;
		C /= g;
		D /= g;
		if(A<B || D<B) cout<<"No"<<endl;
		else if(C>=B-1) cout<<"Yes"<<endl;
		else{
			if(A%B>C) cout<<"No"<<endl;
			else{
				ll gg = gcd(B, D);
				if(C-(C-A%B)%gg+gg>=B) cout<<"Yes"<<endl;
				else cout<<"No"<<endl;
			}
		}
	}

}


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

int main(){
    int X, N;
    cin >> X >> N;
    set<int> P;
    for(int i = 0; i < N; i++){
        int p;
        cin >> p;
        P.insert(p);
    }
    for(int i = 0; ; i++){
        if(P.find(X - i) == P.end()){
            cout << X - i << endl;
            break;
        }
        if(P.find(X + i) == P.end()){
            cout << X + i << endl;
            break;
        }
    }
    
    return 0;
}

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

using namespace std;

#define PB push_back
#define f first
#define s second
#define what_is(x) cerr << #x << " is " << x << endl;

typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;

const ll MOD = 1000000007;
const int N = 200005;
int n, k;

vector<ll> a[2];

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cin >> n >> k;
    for(int i=0; i<n; i++)
    {
        ll x;
        cin >> x;
        a[x<0].PB(x);
    }
    if(a[0].size())
        sort(a[0].begin(), a[0].end());
    if(a[1].size())
        sort(a[1].begin(), a[1].end());
    int siz0 = a[0].size();
    int siz1 = a[1].size();
    //what_is(siz0);
    //what_is(siz1);
    int ind0 = siz0-k, ind1 = 0;
    //take all positive
    if(siz0 + siz1 == k)
    {
        ind0 = 0, ind1 = siz1;
    }
    else if((siz1 == 0) || (siz1 > 0 && siz0 >= k && abs(a[1][0]) < a[0][siz0-k]))
    {
        ind0 = siz0-k;
        ind1 = 0;
    }
    else
    {
        for(int i=2; i<=min(k, (int)siz1); i+=2)
        {
            if(k - i > siz0)
                continue;
            int ind = siz0-k+i;
            //what_is(i);
            //what_is(ind);
            if(ind <= 1)
            {
                ind1 = i;
                ind0 = ind;
            }
            int smallest = i-1;
            if(ind >= 2 && (a[0][ind-1] * a[0][ind-2]) <= (a[1][smallest] * a[1][smallest-1]))
            {
                ind1 = i;
                ind0 = ind;
            }
        }
        //all negative

    }
    ll ans = 1LL;
    //what_is(ind0);
    //what_is(ind1);
    if(ind0 < 0)
    {
        if(k%2 == 1)
        {
            for(int i=siz1-k; i<siz1; i++)
            {
                ans = (ans * (MOD + a[1][i]) % MOD) % MOD;
            }
        }
        else
        {
            for(int i=0; i<k; i++)
            {
                ans = (ans * (MOD + a[1][i]) % MOD) % MOD;
            }
        }
    }
    else
    {
        if(ind0 < siz0)
        {
            for(int i=ind0; i<siz0; i++)
            {
                ans = (ans * a[0][i]) % MOD;
            }
        }
        if(ind1 > 0)
        {
            for(int i=0; i<ind1; i++)
            {
                ans = (ans * (MOD + a[1][i]) % MOD) % MOD;
            }
        }
    }
    cout << ans;
    return 0;
}


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

const int N = 100 + 5;

int n;
char s[N], t[N];

int main() {
#ifdef LOCAL
    freopen("C:\\Users\\Administrator\\Desktop\\in.txt", "r", stdin);
    freopen("C:\\Users\\Administrator\\Desktop\\out.txt", "w", stdout);
#endif
    scanf("%d%s%s", &n, s + 1, t + 1);
    int l = 1, r = 1;
    while (l <= n) {
        if (t[r] == s[l]) { l++, r++; }
        else if (t[r] != s[l]) { l = l - r + 2; r = 1; }
    }
    printf("%d\n", n * 2 - r + 1);
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <deque>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <algorithm>
#include <utility>
#include <cmath>
using namespace std;
using ll=long long;
using P=pair<int,int>;
#define rep(i,a,b) for(ll i=a;i<ll(b);i++)
#define repr(i,a,b) for(ll i=a;i>=ll(b);i--)
#define endl '\n'
#define ALL(x) x.begin(),x.end()
#define ALLR(x) x.rbegin(),x.rend()
#define INF 1e9
#define DEBUG(x) cout<<"debug: "<<x<<endl
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}

const int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};

int H, W, sx, sy, gx, gy;
vector<vector<int>> dist(1001, vector<int>(1001, INF));
int main(){
    cin >> H >> W >> sx >> sy >> gx >> gy;
    sx--;sy--;gx--;gy--;
    vector<string> field(H);
    rep(i, 0, H) cin >> field[i];

    deque<P> que;
    que.emplace_front(sx, sy);
    dist[sx][sy] = 0;

    bool end = false;
    while(que.size()){
        int x = que.front().first;
        int y = que.front().second;
        que.pop_front();

        int nowDist = dist[x][y];

        rep(i, 0, 4){
            int nx = x+dx[i], ny = y+dy[i];
            if(nx < 0 || nx >= H || ny < 0 || ny >= W) continue;
            if(field[nx][ny] == '#') continue;
            if(dist[nx][ny] <= nowDist) continue;
            dist[nx][ny] = nowDist;
            if(nx == gx && ny == gy) { break; end = true; }
            que.emplace_front(nx, ny);
        }

        if(end) break;

        rep(i, -2, 3) rep(j, -2, 3){
            int nx = x+i, ny = y+j;
            if(nx < 0 || nx >= H || ny < 0 || ny >= W) continue;
            if(field[nx][ny] == '#') continue;
            if(dist[nx][ny] <= nowDist+1) continue;
            dist[nx][ny] = nowDist+1;
            que.emplace_back(nx, ny);
        }
    }

    int ans = dist[gx][gy];
    if(ans == INF) cout << -1 << endl;
    else cout << ans << endl;

    return 0;
}


Measured memory_bytes: 8680
#include<iostream>
#include<cmath> 
using namespace std; 
int main ( ){
	
long long a , x  , sum  ; 
cin >> a ;
sum = 0 ;
 x= 0 ; 
while ( a != 0 ) {
	a = a/2 ;
	x+= 1 ;
	
}
for ( double i = 0 ; i< x ; i++ ){
	sum+= pow(2 , i ) ;
}
cout<< sum ; 
	
	


 
} 




Measured memory_bytes: 256
#define rep(i, a, b) for(int i = a; i < (int)(b); i++)
#include <bits/stdc++.h>

typedef long long ll;
using namespace std;
template<class T> inline void chmax(T &a, const T &b) {if(a < b) a = b;}
template<class T> inline void chmin(T &a, const T &b) {if(a > b) a = b;}
const long long INF = 1LL<<60;
const long long MOD = (ll)1e9+7;
// const long long MOD = (ll)1e6+3;
const long long MAX = (ll)1e5+10;


int main(void) {
    ll H,W,N;
    cin>>H>>W>>N;
    ll ans = 0;
    if (N%max(H,W)==0)ans += N/max(H,W);
    else ans += N/max(H,W)+1;
    cout<<ans<<endl;








   return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<string>
#include<vector>
#include<algorithm>
#include<iomanip>
using namespace std;


int main(){
    int a,b,ans;cin >> a >> b;
    ans = a - 1;
    if(a<=b){
        ans++;
    }   
    cout << ans << endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod=1e9+7;

int main(){
    ll n,ans=0;
    cin >> n;
    vector<string> s(0);
    string atgc="ATGC";
    ll dp[100][64];
    fill(dp[0],dp[100],0);

    for(int i0 = 0;i0 < 4;i0 ++){
        for(int i1 = 0;i1 < 4;i1 ++){
            for(int i2 = 0;i2 < 4;i2 ++){
                string smps="";
                smps += atgc[i0];
                smps += atgc[i1];
                smps += atgc[i2];
                s.push_back(smps);
                if(smps=="AGC"||smps=="ACG"||smps=="GAC") continue;
                dp[2][s.size()-1] = 1;
            }
        }
    }
    for(int i = 3;i < n;i ++){
        for(int j = 0;j < 64;j ++){
            if(s[j]=="AGC"||s[j]=="ACG"||s[j]=="GAC") continue;
            for(int k = 0;k < 64;k ++){
                if(s[j].substr(0,2)!=s[k].substr(1,2)) continue;
                if(s[k][0]=='A'&&s[k][2]=='G'&&s[j][2]=='C') continue;
                if(s[k].substr(0,2)=="AG"&&s[j][2]=='C') continue;
                dp[i][j] += dp[i-1][k];
                dp[i][j] %= mod;
            }
        }
    }
    for(int i = 0;i < 64;i ++){
        ans += dp[n-1][i];
        ans %= mod;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define endl "\n"
const int MOD=1e9+7;
#ifndef HOME
#define cerr if(0)cerr
#endif
const int N = 1e5 + 5;
int dp[N];
int n,k;
int a[N];
int solve(int i){
    if(i <= 0){
        return 0;
    }
    int &ans = dp[i];
    if(ans != -1) return ans;
    // if we have i stones and we remove x coins then just check if solve(i - x) is false or not that is
    // if i remove x stones then the person moving at i - x should lose;
    ans = 0;
    for(int j=0;j<n;j++){
        if(i - a[j] < 0) continue;
        ans = ans | (solve(i - a[j]) == 0); // if player having i - a[j] loses then we will win;
    }
    return ans;
}
int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    memset(dp,-1,sizeof(dp));
    cin>>n>>k;
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    if(solve(k)){
        cout<<"First"<<endl;
    }else{
        cout<<"Second"<<endl;
    }
    return 0;
    
}



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

#define lli long long int
#define pb push_back
#define pii pair <int, int>
#define pll pair <lli, lli>
#define _F first
#define _S second
#define mset(x) memset(x, 0, sizeof(x))
#define fastio() ios_base::sync_with_stdio(0)

using namespace std;

int main()
{
	int a, b, c;
	cin >> a >> b >> c;

	if((not (c < a)) && (not (c > b)))
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
	return (0-0);	
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <stdlib.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,ll> llP;

int main() {
  int n;
  cin>>n;
  int a[n];
  for(int i=0;i<n;i++){
    int q;
    cin>>q;
    if(q%2==0) a[i]=0;
    else a[i]=1;
  }
  int mul=1,res=1;
  for(int i=0;i<n;i++){
    mul*=3;
    if(a[i]==0) res*=2;
  }
  cout<<mul-res<<endl;
  return 0;
}


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

typedef long double ld;

int N;
ld X[105], Y[105];
ld tot[105];
const ld TPI = 6.2831853071795864769252868L;
const int ITER = 100000;

int main() {
	scanf("%d", &N);
	for (int i = 0; i < N; ++i) scanf("%Lf%Lf", X+i, Y+i);

	for (int i = 0; i < ITER; ++i) {
		ld R = i;
		R *= TPI;
		R /= ITER;
		ld x = cos(R) * 1e12L;
		ld y = sin(R) * 1e12L;

		ld mn = 1e50L;
		int mni = 0;
		for (int j = 0; j < N; ++j) {
			if ((x-X[j])*(x-X[j]) + (y-Y[j])*(y-Y[j]) < mn) {
				mn = (x-X[j])*(x-X[j]) + (y-Y[j])*(y-Y[j]);
				mni = j;
			}
		}

		tot[mni]++;
	}

	for (int i = 0; i < N; ++i) printf("%.20Lf\n", tot[i] / ITER);
}

Measured memory_bytes: 384
/// e.cpp

# include <stdio.h>
# include <bits/stdc++.h>
using namespace std;
const pair < int , int > DD[] = {{1,0},{1,1},{0,1},{-1,1},{-1,0},{-1,-1},{0,-1},{1,-1}};
# define fi cin
# define fo cout
# define x first
# define y second
# define ll long long
# define IOS ios_base :: sync_with_stdio(0);cin.tie(0)
# define p(v) cerr << #v << " = " << v << '\n'
# define p2(v) cerr << #v << " = " << (complex < __typeof(v.x) > (v.x,v.y)) << '\n'
# define vi vector < int >
# define vl vector < ll >
# define pll pair < ll , ll >
# define pii pair < int , int >
# define mp make_pair
# define db long double
# define fail puts("-1")
# define yes puts("YES")
# define no puts("NO")
# define PP puts("Possible")
# define II puts("Impossible")
# define vii vector < pii >
# define vll vector < ll >
# define pb push_back
# define pdd pair < db , db >
template < class T > T smin(T &a,T b) {if (a > b) a = b;return a;}
template < class T > T smax(T &a,T b) {if (a < b) a = b;return a;}
int main(void)
{
    #ifdef CF
    freopen("input","r",stdin);
    #endif // CF
    srand(time(0));
    fo << fixed << setprecision(7);
    cerr << fixed << setprecision(7);
    int n;
    fi>>n;
    static ll ans[1 << 20];
    vector < pii > s;
    for (int i = 1;i <= n;++i)
    {
        int v;
        fi>>v;
        s.pb(mp(v,i));
    }
    sort(s.begin(),s.end(),[&](pii a,pii b)
         {
            if (a.x != b.x)
                return a.x > b.x;
            return a.y < b.y;
         });
    int mn = s[0].y;
    int was = s[0].x;
    int cur = 0;
    for (auto it : s)
    {
        ans[mn] += 1ll * cur * (was - it.x);
        smin(mn,it.y);
        was = it.x;
        ++cur;
    }
    ans[mn] += 1ll * cur * was;
    for (int i = 1;i <= n;++i)
        fo << ans[i] << '\n';
    cerr << "Time elapsed :" << clock() * 1000.0 / CLOCKS_PER_SEC << " ms" << '\n';
    return 0;
}


Measured memory_bytes: 2804
a11, a12, a13 = map(int, input().split())
a21, a22, a23 = map(int, input().split())
a31, a32, a33 = map(int, input().split())

a = [
    [a11, a12, a13],
    [a21, a22, a23],
    [a31, a32, a33],
    [a11, a21, a31],
    [a12, a22, a32],
    [a13, a23, a33],
    [a11, a22, a33],
    [a13, a22, a31],
]

maru = [
    [0, 0, 0],
    [0, 0, 0],
    [0, 0, 0],
    [0, 0, 0],
    [0, 0, 0],
    [0, 0, 0],
    [0, 0, 0],
    [0, 0, 0],
]

ans = 0
n = int(input())
for i in range(n):
    b = int(input())
    for j in range(8):
        for k in range(3):
            if b == a[j][k]:
                maru[j][k] = 1
                if maru[j] == [1, 1, 1]:
                    ans = 1

if ans == 1:
    print("Yes")
else:
    print("No")
            
            
            

Measured memory_bytes: 3064
// By Mohit Gupta
#include <bits/stdc++.h>
using namespace std;
//DEBUG 
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#define printint(v) copy(begin(v), end(v), ostream_iterator<int>(cout," "))
#define printintv(s,e) copy(s,e, ostream_iterator<int>(cout," "))
#define forstl(i,v) for(auto &i: v)
#define all(v) (v).begin(), (v).end()
#define forn(i,e) for(int i = 0; i < e; i++)
#define forsn(i,s,e) for(int i = s; i < e; i++)
#define rforn(i,s) for(int i = s; i >= 0; i--)
#define rforsn(i,s,e) for(int i = s; i >= e; i--)
#define clz(a) __builtin_clz(a) // count leading zeroes
#define ctz(a) __builtin_ctz(a) // count trailing zeroes
#define popc(a) __builtin_popcount(a) // count set bits (for ints only diff for ll)
//https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html for other in built
#define ln "\n"
#define dbg(x) cout<<#x<<" = "<<x<<ln
#define pb push_back
#define fi first
#define se second
#define IOS ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
typedef pair<int,int> p32; 
typedef pair<ll,ll> p64;
typedef pair<double,double> pdd;
typedef vector<ll> v64;
typedef vector<int> v32;
typedef vector<vector<int> > vv32;
typedef vector<p64> vp64;
typedef vector<p32> vp32;
typedef map<int,int> m32;
#pragma GCC optimize ("-O2")
const int LIM = 5e5+5, MOD = 998244353;
int t,n,m,k,x,y;
 
 
int32_t main()
{
    IOS;
    cin>>n>>m>>x;
    vector<int> books[n];
    v32 cost(n);
    forn(i,n){
      cin>>cost[i];
      forn(j,m) {
        cin>>y;
        books[i].pb(y);
      }
    }
    int ans=-1;
    for(int s=0;s<(1<<n);s++){
      int price=0;
      v32 skill(m,0);
      forn(j,n){
        if(s & (1<<j)){
          price+=cost[j];
          forn(k,m) skill[k]+=books[j][k];
        }
      }
      int flag=1;
      forn(i,m) if(skill[i]<x) flag=0;
      if(flag && (ans==-1 || ans>price)) ans=price;
    }
    cout<<ans<<ln;
}


Measured memory_bytes: 3648
#include <iostream>
#include <string>
#include <vector>
#include <numeric>
#include <queue>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <sstream>
#include <stack>
#include <map>
#include <set>
#include <ios>
#include <cctype>
#include <cstdio>
#include <functional>

#define REP(i,a) for(int i = 0;i < (a);++i)
#define FOR(i,a,b) for(int i = (a);i < (b); ++i)
#define FORR(i,a,b) for(int i = (a) - 1;i >=(b);--i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SIZE(obj) (int)(obj).size()
#define YESNO(cond,yes,no){cout <<((cond)?(yes):(no))<<endl; }
#define SORT(list) sort(ALL((list)));
#define RSORT(list) sort((list).rbegin(),(list).rend())

using namespace std;

template<typename T>
T round_up(const T& a, const T& b) {
    return (a + (b - 1)) / b;
}

template <typename T1, typename T2>
istream& operator>>(istream& is, pair<T1, T2>& p) {
    is >> p.first >> p.second;
    return is;
}

template <typename T1, typename T2>
ostream& operator<<(ostream& os, pair<T1, T2>& p) {
    os << p.first << p.second;
    return os;
}

template <typename T>
istream& operator>>(istream& is, vector<T>& v) {
    REP(i, (int)v.size())is >> v[i];
    return is;
}

template <typename T>
ostream& operator<<(ostream& os, vector<T>& v) {
    REP(i, (int)v.size())os << v[i] << endl;
    return os;
}

using ll = long long;
constexpr int mod = 1'000'000'007;
constexpr int INF = 1'050'000'000;

template <typename T>
T clamp(T& n, T a, T b) {
    if (n < a)n = a;
    if (n > b)n = b;
    return n;
}

template <typename T>
static T GCD(T u, T v) {
    T r;
    while (v != 0) {
        r = u % v;
        u = v;
        v = r;
    }
    return u;
}

template <typename T>
static T LCM(T u, T v) {
    return u * v / gcd(u, v);
}

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

    ll M, N;
    cin >> N >> M;
    if (N == 1 && M == 1) {
        cout << 1 << endl;
    }
    else  if (N == 1) {
        cout << M - 2 << endl;
    }
    else if (M == 1) {
        cout << N - 2 << endl;
    }
    else {
        cout << (N - 2) * (M - 2) << endl;
    }
    return 0;

}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Console = System.Console;

namespace Atcoder
{
    class Program
    {

        static void Main(string[] args)
        {
            var S = Read();
            Enumerable.Repeat("x", S.Length).ToList().ForEach(x => Console.Write(x));
        }
        private static readonly Func<string> Read = () => Console.ReadLine();
        private static readonly Func<string[]> ReadStringArray = () => Console.ReadLine().Split();
        private static readonly Func<int> ReadInt = () => int.Parse(Console.ReadLine());
        private static readonly Func<long> ReadLong = () => long.Parse(Console.ReadLine());
        private static readonly Func<int[]> ReadIntArray = () => Console.ReadLine().Split().Select(int.Parse).ToArray();
        private static readonly Func<long[]> ReadLongArray = () => Console.ReadLine().Split().Select(long.Parse).ToArray();
        private static readonly Action<string> Cw = str => Console.WriteLine(str);
    }
}

Measured memory_bytes: 13268
use std::str::FromStr;
use std::fmt::Debug;
use std::cmp;
#[allow(dead_code)]
fn read_as_vec<T>() -> Vec<T>
where T: FromStr, <T as FromStr>::Err : Debug{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().split_whitespace().map(|c| T::from_str(c).unwrap()).collect()

}

#[allow(dead_code)]
fn read_as_string() -> String{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

fn main(){
    let line = read_as_vec::<i64>();
    let (a, b, c) = (line[0], line[1], line[2]);

    println!("{}", a ^ b ^ c);
}


Measured memory_bytes: 4352
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <cmath>

using namespace std;

#define BLOCK '#'
#define NONE '.'

int main() {
  int H, W;
  cin >> H >> W;
  vector<vector<char>> S(H+2);
  for (int i = 0; i < H+2; i++) {
    S[i].resize(W+2);
    for (int j = 0; j < W+2; j++) {
      if (i == 0 || i == H + 1 || j == 0 || j == W + 1) {
        S[i][j] = '#';
      } else {
        cin >> S[i][j];
      }
    }
  }
  vector<vector<int>> hmap(H + 2);
  for (int i = 0; i < H + 2; i++) {
    hmap[i].resize(W + 2);
    int cnt = 0;
    for (int j = 0; j < W + 2; j++) {
      if (S[i][j] == BLOCK) {
        int k = j - 1;
        while (k >= 0 && S[i][k] == NONE) {
          hmap[i][k] = cnt;
          k--;
        }
        cnt = 0;
      } else {
        cnt++;
      }
    }
  }

  vector<vector<int>> vmap(H + 2);
  for (int i = 0; i < H + 2; i++) {
    vmap[i].resize(W + 2);
  }

  for (int j = 0; j < W + 2; j++) {
    int cnt = 0;
    for (int i = 0; i < H + 2; i++) {
      if (S[i][j] == BLOCK) {
        int k = i - 1;
        while (k >= 0 && S[k][j] == NONE) {
          vmap[k][j] = cnt;
          k--;
        }
        cnt = 0;
      } else {
        cnt++;
      }
    }
  }
  int ans = -1;
  for (int i = 0; i < H + 2; i++) {
    for (int j = 0; j < W + 2; j++) {
      ans = max(ans, {hmap[i][j] + vmap[i][j] - 1});
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 35712
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <string.h>
#include <vector>
using namespace std;

#define ll long long
#define INF (1 << 30)
#define INFLL (1LL << 60)

#define FOR(i,a,b) for(ll i = (a);i<(b);i++)
#define REP(i,a) FOR(i,0,(a))
#define MP make_pair

int main() {
	int mi = INF, ma = 0, n, s;
	cin >> n;
	for(int i = 0;i < n;i++){
		cin >> s;
		mi = min(mi, s);
		ma = max(ma, s);
	}

	cout << ma - mi << endl;
	return 0;
}

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

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

    vector<int> dp(n, INT_MAX);
    dp[0] = 0;
    dp[1] = abs(h[1] - h[0]);
    for (int i = 2; i < n; i++)
    {
        for (int j = max(0, i - k); j < i; j++)
            dp[i] = min(dp[i], dp[j] + abs(h[i] - h[j]));
    }
    cout << dp[n - 1] << "\n";
    return 0;
}

Measured memory_bytes: 1024
from itertools import combinations
import numpy as np
N,M,X = map(int, input().split())
matrix = np.array([list(map(int, input().split())) for _ in range(N)])

min_price = 1e9
for n in range(N):
  for texts in combinations(matrix, n+1):
    summation = np.sum(texts, axis=0)
    price = summation[0]
    if all(summation[1:] >= X):
      min_price = min(price, min_price)

print(min_price if min_price < 1e9 else -1)


Measured memory_bytes: 27332
s = input()

res = 0
if s=='SUN':
    res = 7
elif s=='MON':
    res = 6
elif s=='TUE':
    res = 5
elif s=='WED':
    res = 4
elif s=='THU':
    res = 3
elif s=='FRI':
    res = 2
elif s=='SAT':
    res = 1
print(res)

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

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	char g[3][3];
	for (int i=0; i<3; i++)
		for (int j=0; j<3; j++) 
			cin>>g[i][j];
	for (int i=0; i<3; i++) 
		cout<<g[i][i];
	cout<<"\n";
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define rrep2(ri,x,n) for(int ri = (int)(n-1); ri >= (int)(x); ri--)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(x) x.begin(), x.end()
using ll = long long;
using namespace std;

int main(){
  int n, m, x;
  cin >> n >> m >> x;
  int a1 = 0, a2 = 0;
  rep(i, m){
    int in;
    cin >> in;
    if(in < x) a1++;
    else a2++;
  }
  cout << min(a1, a2) << endl;

  return 0;
}

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

bool check(int a, int b, int c) {
  if(a < b && b < c) return true;
  else return false;
}

int main() {
  int a, b, c, k; cin >> a >> b >> c >> k;
  if(check(a,b,c)) {
    cout << "Yes" << endl;
    return 0;
  }
  for(int i = 0; i < k; i++) {
    if(b <= a) b *= 2;
    else if(c <= b) c *= 2;
    if(check(a, b, c)) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 3632
ans=0
n=int(input())
if n<105:
  print('0')
  exit()
else:
  for i in range(105,n+1):
    if i%2!=0:
      cnt=0
      for j in range(1,i+1):
        if i%j==0:
          cnt+=1
      if cnt==8:
         ans+=1

print(ans)

Measured memory_bytes: 9148
#include<iostream>
#include<cmath>
#include<string>
#include<cstdlib>
#include<stdio.h>
#include<cctype>
#include<algorithm>
#include<string.h>
#include<iomanip>
using namespace std;
int main()
{
	int S[14],H[14],C[14],D[14];//????°±?????????????????????????????????
	for(int i=1;i<=13;i++)
		{
			S[i]=i;
		H[i]=i;
		C[i]=i;
		D[i]=i;
	}
	char a;
	int n,k;
	cin>>k;
	for(int i=0;i<k;i++)
	{
		cin>>a>>n;
		if(a=='S')
			S[n]=0;
				if(a=='H')
					H[n]=0;
	
						if(a=='C')
							C[n]=0;
	
								if(a=='D')
									D[n]=0;//??\???????¢??°±????????¨?????\????????????????????????????????§??\?§£???????¢?
	
	
	
	
	
	
	}
	for(int i=1;i<=13;i++)
	
		if(S[i]!=0)
			cout<<"S "<<S[i]<<endl;
		for(int i=1;i<=13;i++)
		if(H[i]!=0)
		cout<<"H "<<H[i]<<endl;
		for(int i=1;i<=13;i++)
		if(C[i]!=0)
			cout<<"C "<<C[i]<<endl;
		for(int i=1;i<=13;i++)
			if(D[i]!=0)
			cout<<"D "<<D[i]<<endl;
		
	
	
	
	
	
	   





}

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

int main() {
  int N;
  cin >> N;
  vector<string> W(N);
  for (int i = 0; i < N; ++i) {
    cin >> W.at(i);
  }
  set<string> st(W.begin(), W.end());
  bool ans = true;
  if (W.size() != st.size()) {
    ans = false;
  } else {
    for (int i = 1; i < N; ++i) {
      if (W.at(i - 1).back() != W.at(i).front()) {
        ans = false;
        break;
      }
    }
  }
  if (ans) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
N = int(input())
S = input()

M = 10**9 + 7
cnt = [0] * 26

for i in range(N):
    cnt[ord(S[i]) - ord('a')] += 1

ans = 1
for i in range(26):
    ans *= (cnt[i] + 1)
    ans %= M

print(ans - 1)



Measured memory_bytes: 3188
#include <iostream>

#include <string>

using std::cin;
using std::cout;
using std::endl;
using std::string;

static bool
kaibun(string const &s)
{
  int len = s.size();
  for (int i = 0; i < len / 2; i++)
  {
    if (s[i] != s[len - 1 - i])
    {
      return false;
    }
  }
  return true;
}

static char const *
solve(string const &S)
{
  int len = S.size();
  return (kaibun(S) && kaibun(S.substr(0, len / 2)) && kaibun(S.substr((len + 3) / 2 - 1))) ? "Yes" : "No";
}

int
main()
{
  string S;
  cin >> S;
  cout << solve(S) << endl;
  return 0;
}


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

int n, J, O, I, res;
string s;

int main() {
    ///freopen("test.txt", "r", stdin);
    ios_base::sync_with_stdio(0);

    cin >> s;
    n = s.size();
    for (int i = 0; i < n; i ++) {
        if((s[i] == s[i - 1] && i > 0) || i == 0) {
            if(s[i] == 'J') J ++;
            if(s[i] == 'O') O ++;
            if(s[i] == 'I') I ++;
        }
        else if(s[i] == 'J') {
            J = O = I = 0;
            J ++;
        }
        else if(s[i] == 'O' && s[i - 1] == 'J') O ++;
        else if(s[i] == 'I' && s[i - 1] == 'O') I ++;
        else J = O = I = 0;
        if(J >= I && I == O) res = max(res, min(J, min(O, I)));
        ///cout << J << ' ' << O << ' ' << I << endl;
    }
    cout << res << endl;
}

Measured memory_bytes: 2712
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pll pair<long long,long long>
#define mod 1000000007
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);

ll power(ll a,ll b){
	ll ans=1;
	while(b>0){
		if(b%2!=0){
			ans=(ans*a)%mod;
		}
		a=(a*a)%mod;
		b>>=1;
	}
	return ans;
}

int main() {
	IOS;
	int t=1;
	//cin>>t;
	while(t--){
		int n;
      cin>>n;
      set<int> s;
      int a;
      for(int i=0;i<n;i++){
      cin>>a;
      s.insert(a);
      }
      if(s.size()==n)
        cout<<"YES";
      else
        cout<<"NO";
	}
	return 0;
}

Measured memory_bytes: 9600
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const ll MOD = 1e9+7;
const int MAX_N = 200005;
ll A[MAX_N];

int main()
{
	int N;
	cin >> N;
	ll sum = 0;
	rep(i,N)
	{
		cin >> A[i];
		sum = (sum + A[i]) % MOD;
	}
	ll ans = 0;
	rep(i,N-1)
	{
		sum = (sum + MOD - A[i]) % MOD;
		ans = (ans + A[i] * sum) % MOD;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 5188