akhauriyash/Code-Regression huggingface dataset:
// #include {{{
#include <iostream>
#include <cassert>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <ctime>
#include <queue>
#include <set>
#include <map>
#include <stack>
#include <string>
#include <bitset>
#include <vector>
#include <complex>
#include <algorithm>
using namespace std;
// }}}
// #define {{{
typedef long long ll;
typedef double db;
typedef pair<int,int> pii;
typedef vector<int> vi;
#define de(x) cout << #x << "=" << x << endl
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define per(i,a,b) for(int i=(b)-1;i>=(a);--i)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define fi first
#define se second
// }}}

typedef db T;
const db eps = 1e-8;
int sgn(T x){return (x>eps)-(x<-eps);}
struct P{
    T x,y;
    P(){} P(T x,T y):x(x),y(y){}
    void read(){scanf("%lf%lf",&x,&y);}
    P operator - (const P&b) const {return P(x-b.x,y-b.y);}
    P operator + (const P&b) const {return P(x+b.x,y+b.y);}
    T operator * (const P&b) const {return x*b.x+y*b.y;}
    P operator * (const T&k) const {return P(x*k,y*k);}
    T operator ^ (const P&b) const {return x*b.y-y*b.x;}
    bool operator < (const P&b) const {return sgn(x-b.x)?x<b.x:y<b.y;}
};
T norm(P x){return x*x;}
T abs(P x){return sqrt(x*x);}
struct L{
    P s,t;
    void read(){s.read();t.read();}
};
struct C{
    P o;T r;
    void read(){o.read();scanf("%lf",&r);}
};
int relation(C A,C B){
    T dis = abs(A.o - B.o);
    if(sgn(dis - (A.r + B.r)) == 1) return 4;
    if(sgn(dis - (A.r + B.r)) == 0) return 3;
    if(sgn(dis - fabs(A.r - B.r)) == 1) return 2;
    if(sgn(dis - fabs(A.r - B.r)) == 0) return 1;
    return 0;
}
vector<P> insCL(C c,L a){
    db x = (a.s-c.o)*(a.t-a.s) , y = norm(a.t-a.s);
    db d = x * x - y * (norm(a.s-c.o) - c.r*c.r);
    vector<P> res;
    if(sgn(d) < 0) return res;
    d = max(d,0.);
    P mid = a.s - (a.t - a.s) * (x / y);
    P del = (a.t - a.s) * (sqrt(d) / y);
    return {mid - del,mid + del};
}

int main(){
    C o;o.read();
    int Q;scanf("%d",&Q);
    rep(i,0,Q){
        L a;a.read();
        vector<P> ans = insCL(o,a);
        sort(all(ans));
        for(auto p : ans) printf("%.10f %.10f ",p.x,p.y);
        puts("");
    }
    return 0;
}

Measured memory_bytes: 3224
#include<bits/stdc++.h>
using namespace std;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    long a,b,t=0;
    cin>>a>>b;
    long long c[b];
    for(int i=0;i<b;i++)
     cin>>c[i];
     
    sort(c,c+b,greater<int>());
     
     for(int i=0;i<b;i++){
         a=a-c[i];
         if(a<=0)
         { cout<<"Yes";
          t++;
          break;}
     }
     if(t==0)
      cout<<"No";
    return 0;
}
     
   




Measured memory_bytes: 4444
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second

const int mx=200010;
const ll mod=1e9+7;

struct mint {
    ll x; // typedef long long ll;
    mint(ll x=0):x((x%mod+mod)%mod){}
    mint& operator+=(const mint a) { if ((x += a.x) >= mod) x -= mod; return *this; }
    mint& operator-=(const mint a) { if ((x += mod-a.x) >= mod) x -= mod; return *this; }
    mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this; }
    mint operator+(const mint a) const { mint res(*this); return res+=a; }
    mint operator-(const mint a) const { mint res(*this); return res-=a; }
    mint operator*(const mint a) const { mint res(*this); return res*=a; }
    mint pow(ll t) const { if (!t) return 1; mint a = pow(t>>1); a *= a; if (t&1) a *= *this; return a; }
    // for prime mod
    mint inv() const { return pow(mod-2); }
    mint& operator/=(const mint a) { return (*this) *= a.inv(); }
    mint operator/(const mint a) const { mint res(*this); return res/=a; }
};

vector<ll> inv,fact,invfact;
void mod_build(int n){  
  fact.resize(n+1); inv.resize(n+1); invfact.resize(n+1);
  fact[0]=inv[0]=invfact[0]=1; inv[1]=1;
  rep(i,n){
    fact[i+1]=fact[i]*(i+1)%mod;
    if(i>0)inv[i+1]=mod-inv[mod%(i+1)]*(mod/(i+1))%mod;
    invfact[i+1]=invfact[i]*inv[i+1]%mod;
  }
}
ll perm(int n,int k){ if(n<0||k<0||k>n){ return 0; } else { return fact[n]*invfact[n-k]%mod; } }
ll comb(int n,int k){ if(n<0||k<0||k>n){ return 0; } else { return (fact[n]*invfact[n-k]%mod)*invfact[k]%mod; }}
ll modpow(ll n,ll k){
  k%=mod-1; if(k<0)k+=mod-1;
  ll ret=1; while(k){ if(k&1)ret=ret*n%mod; n=n*n%mod; k>>=1; }
  return ret;
}
ll modinv(ll a){ return modpow(a, mod-2); }

vector<int> v[mx];
vector<int> sz(mx,0); //0 oya: bubun ki no size
vector<ll> dp1(mx,0), dp2(mx,0);
int n;

void dfs1(int x, int p){
  sz[x] = 1;
  dp1[x] = 1;
  for(auto to:v[x]){
    if(to==p) continue;
    dfs1(to,x);
    sz[x] += sz[to];
  }
  if(sz[x]==1) return;

  mint ret = fact[sz[x]-1];
  for(auto to:v[x]){
    if(to==p) continue;
    ret *= dp1[to];
    ret *= invfact[sz[to]];
  }
  dp1[x] = ret.x;
}

void dfs2(int x, int p){
  if(p==-1){
    dp2[x] = dp1[x];
  } else {
    mint ret = fact[n-1];
    for(auto to:v[x]){
      if(to==p){
        mint tmp=dp2[p];

        tmp *= fact[sz[x]];
        tmp *= fact[n-sz[x]-1];
        tmp *= invfact[n-1];
        tmp *= modinv(dp1[x]);
        tmp *= invfact[n-sz[x]];
        ret *= tmp;
      } else {
        ret *= invfact[sz[to]];
        ret *= dp1[to];
      }
    }
    dp2[x] = ret.x;
  }
  for(auto to:v[x]){
    if(to==p) continue;
    dfs2(to,x);
  }
}

int main(){
  mod_build(mx);
  cin >> n;
  rep(i,n-1){
    int a,b; cin >> a >> b; a--; b--;
    v[a].push_back(b);
    v[b].push_back(a);
  }
  dfs1(0,-1);
  dfs2(0,-1);
  rep(i,n) cout << dp2[i] << endl;
  return 0;
}


Measured memory_bytes: 23424
#include <stdio.h>

int main(){
	int n,i,j,tmp,flag,cnt;
	int s[12],c[12];

	while(1){
		scanf("%d",&n);
		if(n == 0){
			break;
		}
		for(i = 0;i < n;i++){
			scanf("%d",&s[i]);
		}

		cnt = 0;
		while(1){
			for(i = 0;i < n;i++){
				tmp = 0;
				for(j = 0;j < n;j++){
					if(s[i] == s[j]){
						tmp++;
					}
				}
				c[i] = tmp;
			}
			flag = 1;
			for(i = 0;i < n;i++){
				if(s[i] != c[i]){
					flag = 0;
					s[i] = c[i];
				}
			}
			if(flag){
				break;
			}
			cnt++;
		}
		printf("%d\n",cnt);
		for(i = 0;i < n;i++){
			printf("%d%c",s[i],(i == n-1) ? '\n' : ' ');
		}
	}

	return 0;
}

Measured memory_bytes: 600
#include<stdio.h>
int main(void) {
	int a, b, c, n, i;
	scanf("%d", &n);
	for(i = 0; i < n; i++) {
		scanf("%d%d%d", &a, &b, &c);
		if((a*a == b*b + c*c) || (b*b == a*a + c*c) || (c*c == a*a + b*b)) {
			puts("YES");
		} else {
			puts("NO");
		}
  }
  return 0;
}

Measured memory_bytes: 580
#include <bits/stdc++.h>
using namespace std;
class finite_field {
  const int md;
  const int sz;
  vector<int> fct, fnv;
  int inv2 = -1;
  void init () {
    if (sz) {
      fct[0] = 1;
      for (int i = 1; i < sz; i++) fct[i] = prod(fct[i - 1], i);
      fnv[sz - 1] = inv(fct[sz - 1]);
      for (int i = sz - 1; i >= 1; i--) fnv[i - 1] = prod(fnv[i], i);
    }
    inv2 = inv(2);
  }
  public :
    finite_field(
        const int md,
        const int init_factorial_size = 0,
        const int init_power_size = 0
      ) :
      md(md), sz(init_factorial_size),
      fct(sz), fnv(sz)
      {
        init();
      }
    inline void add (int& a, const int b) const {
      a += b;
      if (a >= md) a -= md;
    }
    inline void sub (int& a, const int b) const {
      a -= b;
      if (a < 0) a += md;
    }
    template<class... A> inline int sum (A... args) const {
      int ret = 0;
      for (int a : initializer_list<int>{args...}) {
        add(ret, a);
      }
      return ret;
    }
    inline int dif (int a, int b) const {
      sub(a, b);
      return a;
    }
    template<class... A> inline int prod (A... args) const {
      long long ret = 1;
      for (int a : initializer_list<int>{args...}) {
        ret *= a;
        ret %= md;
      }
      return (int)ret;
    }
    void mul (int& a, int b) const {
      a = prod(a, b);
    }
    inline int inv (int a) const {
      if (a == 2 && inv2 != -1) return inv2;
      a %= md; if (a < 0) a += md;
      int b = md, u = 0, v = 1;
      while (a) {
        int t = b / a;
        b -= a * t; swap(a, b);
        u -= v * t; swap(u, v);
      }
      assert(b == 1);
      if(u < 0) u += md;
      return u;
    }
    inline int quat (int a, int b) const {
      return prod(a, inv(b));
    }
    inline void div (int& a, int b) const {
      a = quat(a, b);
    }
    inline int pow (int a, long long b) {
      int ret = 1;
      for (; b; b >>= 1) {
        if (b & 1) mul(ret, a);
        a = prod(a, a);
      }
      return ret;
    }
    inline int binom (int n, int k) const {
      assert(0 <= n && n < sz);
      if (k < 0 || n < k) return 0;
      return prod(fct[n], fnv[k], fnv[n - k]);
    }
};
int main() {
  cin.tie(0); cin.sync_with_stdio(false);
  int n, q;
  cin >> n >> q;
  vector<int> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  vector<vector<int>> dp(n, vector<int>(n));
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      dp[i][j] = a[i] > a[j] ? 1 : 0;
    }
  }
  finite_field fld(1e9 + 7);
  for (int cnt = 0; cnt < q; cnt++) {
    int x, y;
    cin >> x >> y;
    x--; y--;
    auto half = [&] (int& a, int& b) -> void {
      fld.add(a, b);
      fld.div(a, 2);
      b = a;
    };
    half(dp[x][y], dp[y][x]);
    for (int z = 0; z < n; z++) if (z != x && z != y) {
      half(dp[x][z], dp[y][z]);
      half(dp[z][x], dp[z][y]);
    }
  }
  int ret = 0;
  int coeff = fld.pow(2, q);
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      fld.mul(dp[i][j], coeff);
      fld.add(ret, dp[i][j]);
    }
  }
  cout << ret << endl;
  return 0;
}

Measured memory_bytes: 37632
def inpl(): return [int(i) for i in input().split()]
N, C = inpl()
channel = [[] for _ in range(C)]
for i in range(N):
    s, t, c = inpl()
    channel[c-1].append([s,t])
H = [0 for i in range(10**5+3)]
for i in range(C):
    channel[i].sort(key = lambda x: x[0])
    for j in range(len(channel[i])-1):
        if channel[i][j][1] == channel[i][j+1][0]:
            channel[i][j+1] = [channel[i][j][0],channel[i][j+1][1]]
            channel[i][j] = []
    channel[i] = [k for k in channel[i] if k != []]

for i in range(C):
    for st, en in channel[i]:
        H[st] += 1
        H[en+1] -= 1
ans = H[0]
for i in range(10**5+1):
    H[i+1] += H[i]
    ans = max(ans,H[i+1])
        
print(ans)

Measured memory_bytes: 21980
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		
		Scanner vd = new Scanner(System.in);
		String cd = vd.nextLine().substring(4);
		vd.close();
		System.out.println("2018"+cd);
		
	}

}


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


import sys
import math

# 1整数
# n = int(input())

# 空白区切り2整数
a, b = list(map(int, input().split()))

ret = 0

if (((1+b)//2) - ((a)//2))%2 == 1:
    ret += 1


for i in range(1,41):
    nextone = 1 << (i + 1)
    wa = 0
    if (a >> i) % 2 == 1:
        wa += nextone - (a % nextone)
    if (b >> i) % 2 == 1:
        wa += 1 + b % nextone
    #print("i=", i)
    #print(wa ,nextone - (a % nextone), b % nextone+1 )

    if wa % 2 == 1:
        ret += 1 << i

print(ret)


Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		String line = sc.nextLine();
		String[] lines = line.split(" ");
		int P = Integer.parseInt(lines[0]);
		int Q = Integer.parseInt(lines[1]);
		int R = Integer.parseInt(lines[2]);

		int min = P + Q + R - (int)Math.max(P, Math.max(Q, R));
		System.out.println(min);
	}

}


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

using vb=vector<bool>;
using vi=vector<int>;
using vvi=vector<vi>;
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vl>;
using si=set<int>;
using qi=queue<int>;
using pi=pair<int,int>;

void solve() {
    ll x; cin>>x;
    for(ll a=-1000;a<=1000;a++){
        for(ll b=-1000;b<=1000;b++){
            ll aa=a*a*a*a*a;
            ll bb=b*b*b*b*b;
            if(aa-bb==x){
                cout<<a<<" "<<b<<endl;
                return;
            }
        }
    }
}

bool boosts=false, tests=false;

int main() {
    if(boosts) {
        ios_base::sync_with_stdio(0);
        cin.tie(0);
        cout.tie(0);
    }

    int tcases=1;
    if(tests) {
        cin>>tcases;
    }
    for(int tcase=1; tcase<=tcases; tcase++) {
        solve();
    }

    return 0;
}


Measured memory_bytes: 3624
import java.util.Scanner;

public class Main{

    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);

        // input
        char[] input = scan.next().toCharArray();

        // search
        String answer = "Good";
        char temp = input[0];
        for(int i = 1; i < 4; i++){
            if(temp == input[i]){
                answer = "Bad";
                break;
            } else {
                temp = input[i];
            }
        }

        // answer
        System.out.println(answer);

    }
}

Measured memory_bytes: 21716
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <string>
#include <utility>
#include <algorithm>
#include <stack>
#include <map>
#include <queue>
#include <functional>
using namespace std;
typedef long long ll;

//Union-Findライブラリ.1は後で修正すること.
class UF{
public:
    int par[1];
    int ran[1];

    void init(int n){
        for(int i = 0;i < n;i++){
            par[i] = i;
            ran[i] = 0;
        }
    }

    int find(int x){
        if(par[x] == x)return x;
        else return par[x] = find(par[x]);
    }

    void unite(int x,int y){
        x = find(x);
        y = find(y);

        if(ran[x] < ran[y])par[x] = y;
        else{
            par[y] = x;
            if(ran[x] == ran[y])ran[x]++;
        }
    }

    bool same(int x,int y){
        return find(x) == find(y);
    }
};
int main(){
    string s;
    cin >> s;
    for(int i = 0;i < s.size();i++){
        cout << 'x';
    }
    cout << endl;
}


Measured memory_bytes: 256
from sys import stdin
N = int(stdin.readline().rstrip())
fact = [0]*(N+1)
for i in range(2, N+1):
    tmp = i
    for j in range(2, i+1):
        while tmp % j == 0:
            fact[j] += 1
            tmp //= j


def num(m):
    return len([i for i in fact if i >= m-1])

ans = 0
ans += num(75) + num(25)*(num(3)-1) 
ans += num(15)*(num(5)-1) 
ans += num(5)*(num(5)-1)*(num(3)-2)//2
print(ans)

Measured memory_bytes: 3064
H,W=map(int,input().split())
data=[list(input()) for i in range(H)]
for w in range(W):
    for h in range(H):
        if data[h][w]==".":
            xlist=[0]
            if w!=0:xlist+=[-1]
            if w!=W-1:xlist+=[1]
            ylist=[0]
            if h!=0:ylist+=[-1]
            if h!=H-1:ylist+=[1]
            data[h][w]=str([data[h+y][w+x] for x in xlist for y in ylist].count("#"))
for i in data:
    print("".join(i))


Measured memory_bytes: 3188
#define _USE_MATH_DEFINES
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <cstdio>
#include <complex>
#include <numeric>
#include <string.h>
#include <random>
#include <cmath>
#define rep(i,n) for (int i = 0; i < (int)n; i++)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<pi, pi> pp;
typedef pair<ll, ll> pl;
double PI = 3.141592653589793238462643383279;
const double EPS = 1e-9;
const ll MOD = 1000000007;
const int inf = 1 << 30;
const ll linf = 1LL << 60;

double a, b, x;

int main() {
    cin >> a >> b >> x;
    x /= a;
    if (x > a*b/2.0) {
        double c = 2*x/a - b;
        double r = atan2(b-c, a);
        printf("%.9f\n", r*360/(2*M_PI));
    } else {
        double c = 2*x/b;
        double r = atan2(b, c);
        printf("%.9f\n", r*360/(2*M_PI));
    }
}

Measured memory_bytes: 384
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iostream>
#include <iostream>
#include <fstream>
#include <numeric>
#include <cstring>
#include <cassert>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <cmath>
#include <set>
#include <map>
#include <functional>
#include <bitset>
#include <iomanip>
#include <stack>
#include <list>
#include <cstdint>
#include <chrono>

using namespace std;
#define     loop(n,i,a)     for(ll i=a;i<n;i++)
#define     loopR(n,i,a)    for(ll i=a-1;i>=n;i--)
#define     all(arr,n)      arr,arr+n
#define     allv(v)         (v).begin(),(v).end()
#define     rallv(v)        (v).rbegin(),(v).rend()
#define     m_p             make_pair
#define     ll              long long
#define     pii             pair<ll,ll>
#define     vi              vector<int>
#define     vll             vector<ll>
#define     vii             vector<pii>
#define     sz(x)           (int)x.size()
#define     pb              push_back
#define     endl            "\n"
#define     Endl            "\n"
#define     f               first
#define     s               second
#define     mem(dp,n)       memset(dp,n,sizeof dp)
template<typename T>void max_self(T &a,T b){a=max(a,b);}
template<typename T>void min_self(T &a,T b){a=min(a,b);}
int dx[] = { 1 , 0 ,-1 , 0 ,-1 ,-1 , 1 , 1 };
int dy[] = { 0 , 1 , 0 ,-1 ,-1 , 1 ,-1 , 1 };
int KnightI[] = { 2, 1, -1, -2, -2, -1, 1, 2 };
int KnightJ[] = { 1, 2, 2, 1, -1, -2, -2, -1 };
void fast(){
    std::ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
}
vector<string> vec_splitter(string s) {
    s += ',';
    vector<string> res;
    while(!s.empty()) {
        res.push_back(s.substr(0, s.find(',')));
        s = s.substr(s.find(',') + 1);
    }
    return res;
}
void debug_out(
        vector<string> __attribute__ ((unused)) args,
        __attribute__ ((unused)) int idx,
        __attribute__ ((unused)) int LINE_NUM) { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
    if(idx > 0) cerr << ", "; else cerr << "Line(" << LINE_NUM << ") ";
    stringstream ss; ss << H;
    cerr << args[idx] << " = " << ss.str();
    debug_out(args, idx + 1, LINE_NUM, T...);
}
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
const ll mxN=1e5+10,oo=0x3f3f3f3f,MOD=998244353;
const long double PI = acos(-1),eps=1.0e-14;

void solve(){
    int n;
    cin>>n;
    ll x=(n+1)/2;
    cout<<(1.0*x)/n<<Endl;
}
int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    fast();
    solve();

}


Measured memory_bytes: 3736
#include <bits/stdc++.h>
using namespace std;
int main(){
	long long int a,b,big=2020,minn=10000;
	cin>>a>>b;
	for(long long int i=a;i<=b;i++){
		for(long long int j=i+1;j<=b;j++){
			minn=min(minn,(i*j)%2019);
			if(minn==0){
				cout<<0;
				return 0;
			}
		}
	}
	cout<<minn;
}

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

using namespace std;

#define sp(x) cout<<setprecision(x);
#define all(a) (a).begin(), (a).end()
#define inf 10000000
#define linf INT64_MAX*0.99
#define lint long long
#define FOR(i,a,b) for(lint i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define yes "Yes"
#define no "No"
#define divs 1000000007
#define dive 1000000009

typedef pair<int, int> P;

lint ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}
 
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
	int n, m; cin>>n>>m;
	int ans = 0;
	ans += n*(n-1)/2;
	ans += m*(m-1)/2;
	cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define ll long long
#define li long
#define pb push_back
#define mem(arr,x) memset(arr,x,sizeof(arr))

int main() 
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n,i;
    cin>>n;
    ll h[n+1];
    for(i=0;i<n;i++)
    cin>>h[i];
    vector<ll>dp(n+1,0);
    dp[0]=0;
    dp[1]=abs(h[1]-h[0]);
    for(i=2;i<n;i++)
    dp[i]=min(abs(h[i]-h[i-1])+dp[i-1], abs(h[i]-h[i-2])+dp[i-2]);
    cout<<dp[n-1];
    return 0;
}

Measured memory_bytes: 4756
n, m, c = map(int, input().split())
b = list(map(int, input().split()))
a = [list(map(int, input().split())) for _ in range(n)]

ans = 0
for i in range(n):
    D = 0
    for j in range(m):
        D += a[i][j] * b[j]
    if D + c > 0:
        ans += 1

print(ans)


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

using namespace std;

#define FAST_IO ios_base::sync_with_stdio(0); cin.tie(nullptr)
#define FOR(i, a, b) for(int i = (a); i <= (b); i++)
#define pb push_back
#define f first
#define s second
#define INF 1000000000000000
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vii;

const int MAXN = 3100, MAXK = 25;
const ll MOD = 1e9+7;

int dp[MAXN][MAXN];
pii p[MAXN][MAXN];

int main()
{
    FAST_IO;

    string s, t; cin >> s >> t;
    FOR(i, 1, s.size()) FOR(j, 1, t.size()) {
        dp[i][j] = dp[i-1][j];
        p[i][j] = {i-1, j};

        if (dp[i][j-1] > dp[i][j]) {
            dp[i][j] = dp[i][j-1];
            p[i][j] = {i, j-1};
        }
        if (dp[i-1][j-1] + (s[i-1]==t[j-1]) > dp[i][j]) {
            dp[i][j] = dp[i-1][j-1] + (s[i-1]==t[j-1]);
            p[i][j] = {i-1, j-1};
        }
    }

    //cout << dp[s.size()][t.size()] << endl;
    vector<char> seq;
    pii last = {s.size(), t.size()};
    while (last.f != 0 && last.s != 0) {
        if (dp[last.f][last.s] == dp[p[last.f][last.s].f][p[last.f][last.s].s] + 1)
            seq.pb(s[last.f-1]);
        last = p[last.f][last.s];
    }
    for (int i = seq.size()-1; i >= 0; i--) cout << seq[i];
    cout << endl;

    return 0;
}


Measured memory_bytes: 111744
import sys
S = raw_input()
d = ["L","R","U","D"]
k = ["R","U","D"]
g = ["L","U","D"]
def r():
    print("No")
    sys.exit()
x = 1
if not (1 <= len(S) and len(S) <= 100): r()
for c in S:
    if not c in d:
        r()
    if(x % 2 == 0):
        if not c in g:
            r()
    else:
        if not c in k:
            r()
    x += 1

print("Yes")


Measured memory_bytes: 2948
#include <iostream>
#include <algorithm>
#include <numeric>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <iomanip>
#include <functional>
#include <bitset>
#include <limits>
#include <cstdio>
#include <cmath>
#include <cassert>
#include <random>

#ifdef DEBUG
#include "library/Utility/debug.cpp"
#else
#define debug(...)
#endif

#define rep(i,n) for(int i=0;i<(n);++i)
#define EL '\n'
#define print(i) std::cout << (i) << '\n'
#define all(v) (v).begin(), (v).end()
using lnt = long long;
struct FIO{FIO(){std::cin.tie(0);std::cout.tie(0);std::ios_base::sync_with_stdio(0);std::cout<<std::fixed<<std::setprecision(15);}}fIO;
/*-*/
struct S
{
	lnt a,b,c,d;
	S(lnt a, lnt b, lnt c,lnt d) : a(a),b(b),c(c),d(d) {}
	bool operator<(const S rhs) const {
		if(a!=rhs.a) return a<rhs.a;
		if(b!=rhs.b) return b<rhs.b;
		if(c!=rhs.c) return c<rhs.c;
		return d<rhs.d;
	}
};

int main() {
	int n;
	std::cin >> n;
	std::vector<lnt> a(n);
	rep(i,n) std::cin >> a[i];
	lnt c=0;
	for(int i=2;i<n;i++) c^=a[i];
	lnt z=a[0]+a[1]-c;
	if(z<0||z%2==1) {
		print(-1);
		return 0;
	}
	z>>=1;
	lnt x=a[0],y=a[1];
	lnt ans=0;
	int N=63;
	for(int i=N;i>=0;i--) {
		if(c>>i&1) {
			if(z>>i&1) {
				print(-1);
				return 0;
			}
		} else {
			ans+=(z>>i&1)*(1ll<<i);
		}
	}
	for(int i=N;i>=0;i--) {
		if(c>>i&1) {
			if((1ll<<i)+ans<=a[0]) ans+=(1ll<<i);
		} else {
		}
	}
	if(ans==0||ans>x) {
		print(-1);
	} else print(x-ans);
}


Measured memory_bytes: 3668
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
#from fractions import gcd
#from itertools import combinations # (string,3) 3回
#from collections import deque
from collections import defaultdict
#import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#

import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
def readInts():
  return list(map(int,input().split()))
def I():
  return int(input())
r = I()
print(3*r**2)


Measured memory_bytes: 3316
#include <stdio.h>

int main(){
    int n;
    int a[10000];
    int max,min;
    long sum;
    int i;
    sum = 0;
    scanf( "%d",&n );
    for ( i = 0; i < n; i++ ){
        scanf( "%d",  &a[i] );
    }
    min = max = a[0];

    for ( i = 0; i < n; i++ ){
        if( a[i] > max ){
            max = a[i];
        }
        if( a[i] < min ){
            min = a[i];
        }
        sum += a[i];
    }

    printf( "%d %d %ld\n",min, max,sum );
    return 0;
}

Measured memory_bytes: 1868
#include <stdio.h>

int main(void){
  double r,cir,are;
  scanf("%lf", &r);
  cir = 2 * 3.141592653589 * r;
  are = r * r * 3.141592653589;
  printf("%f %f\n", are, cir);
  return(0);
}

Measured memory_bytes: 648
N = int(input())
T = list(map(int,input().split()))
M = int(input())
for i in range(M):
    p,x = map(int,input().split())
    ans = 0
    for j in range(N):
        if(j == p-1):
            ans+= x
        else:
            ans += T[j]
    print(ans)

Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <vector>

using lli=long long;
const lli mod = 1000000007;

lli mod_13n(lli n, lli k){
  lli tmp[13] = {1, 10, 9, 12, 3, 4, 1, 10, 9, 12, 3, 4};
  return n*tmp[(k-1)%12]%13;
}

int main(){
  std::string S;
  std::cin >> S;

  lli dp[100009][13] = {};
  dp[0][0] = 1;
  for(int i = 0; i < S.size(); i++){
    char s = S[S.size()-1-i];
    if(s == '?'){
      for(int j = 0; j < 10; j++){
        for(int k = 0; k < 13; k++){
          dp[i+1][(k+mod_13n(j, i+1))%13] += dp[i][k];
          dp[i+1][(k+mod_13n(j, i+1))%13] %= mod;
        }
      }
    }else{
      int si = s-'0';
      for(int k = 0; k < 13; k++){
        dp[i+1][(k+mod_13n(si, i+1))%13] += dp[i][k];
        dp[i+1][(k+mod_13n(si, i+1))%13] %= mod;
      }
    }
  }
  std::cout << dp[S.size()][5] << std::endl;

}


Measured memory_bytes: 10624
using System;
using System.Collections.Generic;
using static System.Console;

class Program
{
    static List<int> sieve(int n)
    {
        var d = new bool[n+1];

        for (int i = 2; i*i <= n; i++)
        {
            if (d[i]) continue;
            int j = 2;
            while (i*j <= n)
                d[i*(j++)] = true;
        }

        var ret = new List<int>();
        for (int i = 2; i <= n; i++)
            if (!d[i]) ret.Add(i);

        return ret;
    }

    public static void Main()
    {
        int n = int.Parse(ReadLine());
        var a = sieve(55555);

        int j = 0;
        for (int i = 0; i < n; i++)
        {
            while (a[j]%5 != 1) j++;
            Write(a[j++]);
            if (i < n-1) Write(" ");
        }
        WriteLine("");
    }
}

Measured memory_bytes: 11216
#include <algorithm>
#include <complex>
#include <iostream>
#include <string>
#include <vector>

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

using std::min;
using std::max;
using std::abs;

using std::string;
using std::to_string;

using std::sort;

using std::vector;

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

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

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

    vector<int> b;
    for(int j = n - 1; j > 0; j--){
        if(a[j] == a[j-1]){
            b.push_back(a[j]);
            j--;
            if(b.size() >= 2){
                break;
            }
        }
    }

    if(b.size() < 2){
        cout << 0 << endl;
    }else{
        cout << (long)b[0] * (long)b[1] << endl;
    }


    return 0;
}


Measured memory_bytes: 1272
import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.Queue;
import java.util.Random;
import java.util.Scanner;
 


public class Main {
	private static Scanner sc = new Scanner(System.in);
	//result = Math.pow(num1, num3)
	//StringBuffer str = new StringBuffer(hoge1);
	//String hoge2 = str.reverse().toString();
	//map.containsKey(A)

	//Map<String, Integer> map = new HashMap<String, Integer>(n);
	/*for ( キーのデータ型 key : マップの名前.keySet() ) {
		データのデータ型 data = マップの名前.get( key );
		
		// keyやdataを使った処理;
	}*/
	//int i = Integer.parseInt(s);
	//Queue<String> qq=new ArrayDeque<>(); //add,poll,peek
	//Deque<String> qq=new ArrayDeque<>();//push,pop,peek
	//ArrayList<String> cc = new ArrayList<>(n);
	//Collections.sort(list);
	//Array.sort(list);   cc.contains(tmp)
	//Arrays.asList(c).contains("a")
	//list.set(1,"walk");//1 1 2 3 5
	//static long mod =1000000007;
	//static 	ArrayList<Integer> cc = new ArrayList<>(100);
	
	
	
	
	public static void main(String[] args) {
		//int N=sc.nextInt();for(int i=0;i<N;i++) {}
		//int a[]=new int[N];
		//Ae2+Be2=Ce2
		String S=sc.next();
		long K=sc.nextLong();
		
		
		char a[]=S.toCharArray();
		
		long ans=0;
		boolean x=true;
		
		for(int i=0;i<S.length();i++) {
			if(a[i]!=a[0]) {
				x=false;
				break;
			}
		}
		if(x) {
			long p=S.length();
			ans=K*p/2;
			p(ans);
		}
		
		
		
		
		
		
		if(!x) {
			if(a[0]==a[S.length()-1]) {
				long tt=1;
				long tt2=1;
				int i=1;
				while(true) {
					if(a[0]!=a[i])break;
					tt++;a[i]=0;
					i++;
					
				}
				i=S.length()-2;
				while(true) {
					if(a[0]!=a[i])break;
					tt2++;a[i]=0;
					i--;
				}
				ans+=tt/2;
				ans+=tt2/2;
				ans+=((tt+tt2)/2)*(K-1);
			
			}
		for(int i=0;i+1<S.length();i++) {
			if(a[i]==0)continue;
			if(a[i]==a[i+1]) {
				long t=1;
				while(i+1<S.length()) {
					if(a[i]!=a[i+1]) {
						break;
					}
					i++;
					t++;
					
				}
				ans+=(t/2)*K;
			}
		}
		
			p(ans);
		}
		
		
		}
		
		
	
	
	
	public static long lcm(long a, long b) {
        return a / gcd(a, b) * b;
	}
	
	public static long gcd(long a, long b) {
        return b == 0 ? a: gcd(b, a % b);
	}

	


	
	static void p(String ans) {System.out.println(ans);};
	static void p(int ans) {System.out.println(ans);};
	static void p() {System.out.println();};
	static void p(long ans) {System.out.println(ans);};
	static void p(double ans) {System.out.println(ans);};
	
}
	


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

#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

#define MAXX 200005


#define PI 3.14159265358979323846264338327950

#define ll  long long int
vector<ll> v;
multiset<ll> ms;
multiset<ll>::iterator it;
ll a[MAXX], b[MAXX];
ll mod = 1000000007;
char c[MAXX];

int main()
{
	FAST;
	ll  ans = 0, a1 = 0, a2 = 0, n , mx = 0, m = 1;
	cin >> n;
	ms.insert(n);
	while(ms.count(n) < 2){
		if(n % 2 == 0){
			n /= 2;
		}
		else{
			n = 3*n + 1;
			
		}
		ms.insert(n);
		m ++;
	}
	cout << m;
	
}

Measured memory_bytes: 256
n,x=map(int,input().split())
a=[int(j) for j in input().split()]
ref=[10**18]*n
ans=10**18
for i in range(n):
	ref=[min(ref[j],a[(j+i)%n]) for j in range(n)]
	ans=min(ans,sum(ref)+i*x)
print(ans)

Measured memory_bytes: 43100
#include <bits/stdc++.h>
using namespace std;
typedef pair<long long, long long> P;
#define int long long
#define override_rep(i, l, r, mes, ...) mes
#define rep1(i, n) for (int i = 0; i < n; i++)
#define rep2(i, l, r) for (int i = l; i < r; i++)
#define rep(...) override_rep(__VA_ARGS__, rep2, rep1)(__VA_ARGS__)
template<typename T, typename U>
istream& operator>>(istream& in, pair<T, U>& p) {
    in >> p.first >> p.second;
    return in;
}
signed main(signed argc, char* argv[]) {
    cin.tie(0);
    ios::sync_with_stdio(false);
    const int MOD = 1000000007;
	int n;
	cin>>n;
	map<int,int>mp;
	rep(i,n-1){
		int in;
		cin>>in;
		if(in!=0)mp[in-1]++;
	}
	rep(i,n)cout<<mp[i]<<endl;
}


Measured memory_bytes: 16164
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr long long int MOD = 1000000007;

int main(void){
    int N; cin >> N;
    int L[N]; for(int i = 0; i < N; i++) cin >> L[i];
    sort(L, L + N);
    
    int ans = 0;
    for(int i = 0; i < N; i++){
        for(int j = i + 1; j < N; j++){
            int a = L[i] + L[j];
            int k = lower_bound(L, L + N, a) - L;
            ans += max(0, k - (j+1));
        }
    }
    cout << ans << endl;
}


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

int main() {
  int num,fill;
  vector<tuple<int, int, int>> tpl; // 問題,WA数,AC数
  
  cin >> num >> fill;
  
  for(int i = 0; i < num; i++) tpl.emplace_back(i,0,0);
  
  int mondai;
  string kekka;
  for(int i = 0; i < fill; i++){
    cin >> mondai >> kekka;
    mondai--;
    
    if(get<2>(tpl[mondai]) == 0){
      if(kekka == "AC"){
        get<2>(tpl[mondai]) += 1;
      }else{
        get<1>(tpl[mondai]) += 1;
      }
    }else{
       //AC済み何もしない
    }
  }
  
  int cntWA = 0;
  int cntAC = 0;
  for(auto itr : tpl){ 
    cntAC += get<2>(itr);
    if(get<2>(itr) == 1) cntWA += get<1>(itr); 
  }

  cout << cntAC << " " << cntWA;
}


Measured memory_bytes: 1912
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A, B, ans, port;
  cin >> A >> B;
  ans = 0;
  port = 1;
  while (port < B) {
    port = port + A - 1;
    ans++;
  }

  cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void) {

	int i;
	int a,b,c;
	int ans =0;

	scanf("%d %d %d",&a,&b,&c);

	for(i = a;i <= b;i++){
		if((c % i) == 0){
			ans++;
		}
	}
	printf("%d\n",ans);

	return 0;
}



Measured memory_bytes: 2104
#include<iostream>
using namespace std;
typedef long long ll;
const int maxn=1e7+10;
ll p[maxn];

int main()
{
	for(ll i=1;i<maxn;i++){
		for(ll j=i+i;j<maxn;j+=i) p[j]++;
	}
	ll n;cin>>n;ll ans=0;
	for(ll i=1;i<=n;i++){
		if(i==1) ans++;
		else ans+=(p[i]+1)*i;
	}
	cout<<ans;
	return 0;	
} 

Measured memory_bytes: 81696
#include<iostream>
#include<cstring>
using namespace std;
int main()
{
    string n;
	cin>>n;
	int num=0,len=n.size();
	for(int i=0;i<len;i++)
		num+=n[i]-'0';
	//cout<<num<<" ";
	if(num%9==0)
	   cout<<"Yes\n";
	else
	   cout<<"No\n";
	return 0;
}

Measured memory_bytes: 3684
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;

const int mx=200010;
//const ll mod=1e9+7;
const ll mod=2019;

int L,R;
ll ans=2019;

int main(){
  cin >> L >> R;
  R = min(R,L+2019);
	
  for(ll i=L; i<R; i++){for(ll j=i+1; j<=R; j++){
	ans=min(ans,(i*j)%mod);
  }} 
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <bits/stdc++.h>
#include <vector>
#include <iterator>
#include <string>
#define pan(i,n) for(int i=0;i<n;i++)
#define ll long long int
#define vi vector<int>
#define pb push_back
using namespace std;



int main(){
    int i,a,b;
    cin>>a>>b;
    int sok=0;
    if(b!=1){
        for( i=1;i<29;i++){
            sok=(a*i)+1-i;
            // cout<<sok;
            if(sok>=b) break;
        }
    }
    if(sok>1) cout<<i;
    else cout<<0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#define FOR(i, a, n) for(int i = (int)(a); i < (int)(n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define SORT(a) sort(a.begin(),a.end())
using namespace std;
int main(){
    //Seiranchan!
    int X,Y,Z,ans;;
    cin >>X>>Y>>Z;

    for (int i=0;i*Y+(i+1)*Z<=X;i++){
        ans = i;
    } 
    cout << ans <<endl;
}


Measured memory_bytes: 256
use std::cmp;
use std::fmt::Debug;
use std::str::FromStr;
#[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: Vec<usize> = read_as_vec();
    let (l, r, d) = (line[0], line[1], line[2]);
    println!("{}", r / d - (l - 1) / d);
}


Measured memory_bytes: 2100
#include <bits/stdc++.h>
 
using namespace std;
 
int diff(int a, int b) { return abs(a-b); }
 
int main(){
  int n, k; cin >> n >> k;
  int vet[n];
  for(int i = 0; i < n; i++) cin >> vet[i];
  int dp[n+5];
  for(int i = 0; i < n; i++) dp[i] = 1e9;
  dp[0] = 0;
  dp[1] = diff(vet[0], vet[1]);
  for(int i = 2; i < n; i++){
    for(int j = i - 1; j >= max(0, i - k); j--)
    	dp[i] = min(dp[i], dp[j]+diff(vet[i], vet[j]));
  }
  cout << dp[n-1] << endl; 
  return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
    using namespace std;
     
    int main(){
      int N;
      cin >> N;
      vector<int> A(N);
      vector<int> B(N);
      for(int i=0;i<N;i++){
        cin >> A.at(i);
        B.at(i) = A.at(i);
      }
      sort(A.begin(),A.end());
      for(int i=0;i<N;i++){
        if(B.at(i) == A.at(N-1)){
          cout << A.at(N-2) << endl;
        }else{
          cout << A.at(N-1) << endl;
        }
      }
    }

Measured memory_bytes: 3200
hn = gets.chomp.split
h = hn[0].to_i
n = hn[1].to_i

a = gets.chomp.split
n.times do |i|
  a[i] = a[i].to_i
end

result = false
n.times do |i|
  h -= a[i]
  if h <= 0
    result = true
    break
  end
end

puts result ? "Yes" : "No"

Measured memory_bytes: 7940
#include <iostream>
int main(){
    int a,b,c,d,e,k;
    std::string s;
    std::cin >> a;
    std::cin >> b;
    std::cin >> c;
    std::cin >> d;
    std::cin >> e;
    std::cin >> k;
    int dis1;
    dis1 = e - a;
    s = ":(";
    if(dis1 <= k){
        s = "Yay!";
    }
    std::cout << s << std::endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
string s,t;
int b[200];
void change(int k,char v1,char v2){
    for(int i=k+1;i<s.size();++i){
        if(s[i]==v1)s[i]=v2;
        else if(s[i]==v2)s[i]=v1;    }
}
int main(){
    ios::sync_with_stdio(0);
    cin>>s>>t;
    for(int i=0;i<s.size();++i){
        if(s[i]!=t[i]){
            if(b[s[i]]||b[t[i]]){
                cout<<"No"<<endl;
                exit(0);
            }
            b[t[i]]++;
            change(i,s[i],t[i]);
        }
    }
    cout<<"Yes"<<endl;
    return 0;
    }

Measured memory_bytes: 1044
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main(void){
    int x, n;
    cin >> x >> n;
    vector<bool> y(102, true);
    for(int i=0;i<n;i++){
        int p;
        cin >> p;
        y[p] = false;
    }
    int ans = 0;
    for(int i=0;i<=101;i++){
        if(y[i]){
            if(abs(i-x) < abs(ans-x)) ans = i;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3192
#include <bits/stdc++.h>
using namespace std;
int main() {
    int k;
    string s,res="";
    cin >> k;
    cin >> s;
    if (s.length() > k)
    {
        for (int i = 0; i < k; i++)
        {
            res += s[i];
        }

        res = res + "...";
    }
    else
    {
        res = s;
    }

    cout << res << endl;
    return 0;
}

Measured memory_bytes: 3624
import sys
sys.setrecursionlimit(10000000)
MOD = 10 ** 9 + 7
INF = 10 ** 15

def main():
    N = int(input())
    A = list(map(int,input().split()))
    ans = -INF
    for i in range(N):
        for j in range(i + 1,N):
            ans = max(ans,abs(A[i] - A[j]))
    print(ans)
if __name__ == '__main__':
    main()

Measured memory_bytes: 40336
def four_nums(n, ans, nums):
	if len(nums) == 4:
		if sum(nums) == n:
			return ans + 1
		else:
			return ans
	for i in range(10):
		nums.append(i)
		if sum(nums) <= n: ans = four_nums(n, ans, nums)
		nums.pop()
	return ans

while True:
	try:
		n = input()
		print four_nums(n, 0, [])
	except:
		break

Measured memory_bytes: 4216
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <fstream>
#include <functional>
#include <iostream>
#include <string>
#include <vector>
using namespace std;

int main() {
  int r, d, x;
  cin >> r >> d >> x;
  for (int i = 1; i <= 10; i++) {
    x = r * x - d;
    cout << x << endl;
  }
  return 0;
}


Measured memory_bytes: 256
W, H, N = map(int, input().split())

XYA = []

x1 = 0
x2 = W
y1 = 0
y2 = H

for i in range(N):
  x, y, a = map(int, input().split())
  XYA.append([x, y, a])

for i in range(N):
  if XYA[i][2]==1:
    x1 = max(x1, XYA[i][0])
  if XYA[i][2]==2:
    x2 = min(x2, XYA[i][0])
  if XYA[i][2]==3:
    y1 = max(y1, XYA[i][1])
  if XYA[i][2]==4:
    y2 = min(y2, XYA[i][1])

print(max(x2-x1,0)*max(y2-y1,0))

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

int main() {
	int num; cin>>num;
	int k; cin>>k;
	
	vector<int> heig;
	for(int i=0;i<num;i++){
	    int t; cin>>t;
	    heig.push_back(t);
	}
	
	vector<int> dp(heig.size(),INT_MAX);
	dp[0] = 0;
	dp[1] = abs(heig[0]-heig[1]);
	
	for(int i=2;i<dp.size();i++){
	    int j = i-1;
	    int m = k-1;
	    while(j>=0 && m>=0){
	        dp[i] = min(dp[j]+abs(heig[i]-heig[j]), dp[i]);
	        j--;
	        m--;
	    }
	}
	
	cout<<dp[dp.size()-1];
}

Measured memory_bytes: 1144
# D - Line++
def main():
    N, X, Y = map(int, input().split())
    dist = [0] * N
    calc_min_dist = lambda x, y: min(
        abs(x - y), abs(X - x) + abs(y - Y) + 1, abs(Y - x) + abs(y - X) + 1
    )
    for i in range(1, N + 1):
        for j in range(i + 1, N + 1):
            dist[calc_min_dist(i, j)] += 1
    print("\n".join(map(str, dist[1:])))


if __name__ == "__main__":
    main()


Measured memory_bytes: 3188
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
using namespace std;

typedef long long ll;
typedef vector<int> vi;

const double PI=acos(-1.0);

int N;
void input()
{
    cin >> N;
}

bool check(int n)
{
    if(n > N || n < 1) return false;
    bool three = false, five = false, seven = false;
    while(n > 0){
        switch (n%10){
        case 3:
            three = true;
            break;
        case 5:
            five = true;
            break;
        case 7:
            seven = true;
        default:
            break;
        }
        n /= 10;
    }

    if(three && five && seven) return true;
    else return false;
}

void add753(string S, int& ans)
{
    if(S.length() > 9){
        return;
    }
    int num = 0;
    for(int i=0; i<S.length(); ++i){
        num = num * 10 + S[i] - '0';
    }
    if(check(num)) ++ans;

    add753(S+'3',ans);
    add753(S+'5',ans);
    add753(S+'7',ans);
}

void solve()
{
    string S = "";
    int ans = 0;
    add753(S,ans);
    cout << ans << endl;
}

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

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

using namespace std;

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

#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll) 1e15;

bool check(string s) {
    ll N = s.length();
    REP(i, N) {
        if (s[i] != s[N - 1 - i])
            return false;
    }

    REP(i, (N - 1) / 2) {
        if (s[i] != s[(N - 1) / 2 - 1 - i])
            return false;
    }

    ll cnt = 0;
    FOR(i, N, (N + 3) / 2 - 1) {
        if (s[i] != s[N - 1 - cnt++])
            return false;
    }

    return true;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S;
    cin >> S;
    if (check(S))
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <fstream>
#include <sstream>
#include <iomanip>

using namespace std;

long long MOD = 1000000007;

int main(){
    int N;
    cin >> N;
    priority_queue<double> pque;

    for(int i=0; i<N; i++){
        double v;
        cin >> v;

        pque.push(-v);
    }

    for(int i=0; i<N-1; i++){
        double tmp=0.0;
        tmp=pque.top();
        pque.pop();
        tmp+=pque.top();
        pque.pop();
        pque.push(tmp/2.0);
    }

    cout << -pque.top() << endl;

}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <sstream>

#define INPUT_FROM_FILE (0) 
#if INPUT_FROM_FILE
#include <fstream>
#endif


int main(int argc, char **argv){
	int n, m;
	std::vector<long> a, b;

#if INPUT_FROM_FILE
	std::ifstream ifs("test.txt");
	//FILE *fp = fopen("test.txt", "r");
#endif


#if INPUT_FROM_FILE
	ifs >> n;
#else
	std::cin >> n;
#endif

	a.resize(n);
	for(int i = 0; i < n; i++){
#if INPUT_FROM_FILE
		ifs >> a[i];
#else
		std::cin >> a[i];
#endif
	}

#if INPUT_FROM_FILE
	ifs >> m;
#else
	std::cin >> m;
#endif

	b.resize(m);
	for(int i = 0; i < m; i++){
#if INPUT_FROM_FILE
		ifs >> b[i];
#else
		std::cin >> b[i];
#endif
	}

	
	if(std::includes(a.begin(), a.end(), b.begin(), b.end())){
		std::cout << "1" << std::endl;
	}
	else{
		std::cout << "0" << std::endl;
	}

	return 0;
}


Measured memory_bytes: 6000
//----------BHAVIK DIWANI(PICT_COMP)---------------
#include<bits/stdc++.h>
#include<stdlib.h>
#include<stdio.h>
#define test ll t; cin>>t; while(t--)
#define FOR(p,n) for(ll i=p;i<(ll)n;i++)
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define mod 1000000007
#define ll long long
#define int long long
#define ull unsigned long long
#define MAX 1000005
#define pb push_back
#define mkp make_pair
#define vi vector<int>
#define pii pair<int,int>
#define endl '\n'
#define vs vector<string>
#define mii map<int,int>
#define msi map<string,int>
#define vpii vector< pair<int, int > >
#define vpsi vector< pair< string ,int > >
#define forci(p,q) for(int i=p;i<q;i++)
ll gcd(ll a,ll b){ if(b==0) return a;    return gcd(b,a%b);}
ll lcm(ll a,ll b) { return (a/gcd(a,b)*b);}
ull power(ull a, ull b) {a %= mod;  ull res = 1;  while (b > 0) { if (b & 1) res = res * a % mod;  a = a * a % mod;  b >>= 1; }  return res%mod; }
ll modmul(ll x, ll y){return (x*y)%mod;}
ll modadd(ll x, ll y){return (x+y)%mod;}
ll modsub(ll x, ll y){return (x-y+mod)%mod;}
ll fact[1000007]={0};
void facto() {fact[0]=1;fact[1]=1;for(int i=2;i<100007;i++)fact[i]=(fact[i-1]*i)%mod;}
ll ncr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(power(fact[r],mod-2)))%mod; res=(res*(power(fact[n-r],mod-2)))%mod; return res;}
ll npr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(power(fact[n-r],mod-2)))%mod; return res;}
inline long long toint(const std::string &s) {std::stringstream ss; ss << s; long long x; ss >> x; return x;}
inline std::string tostring(long long number) {std::stringstream ss; ss << number; return ss.str();}
inline std::string tobin(long long x) {return std::bitset<63>(x).to_string();}
/*bool prime[MAX];
ull sieve(){memset(prime,true,sizeof(prime));for(ull p=2;p*p<MAX;p++){if(prime[p]==true){for(ull i=2*p;i<MAX;i+=p){prime[i]=false;}}}prime[0]=0;prime[1]=0;
}
int inv[1000001]={0};
void findinverse(){inv[1] = 1;for(int i = 2; i <=1e6 ; ++i)	inv[i] = (mod - (mod/i) * inv[mod%i] % mod) % mod;}
*/
using namespace std;
int prime[1000009];
int solve()
{
	int n;
	cin>>n;
	int a[n];
	int mx=INT_MIN;
	mii mp;
	forci(0,n)	cin>>a[i], mx=max(mx,a[i]), mp[a[i]]++;
	for(int i=0;i<1000005;i++)	prime[i]=1;
	for(int j=0;j<n;j++)
	{
		if(prime[a[j]])
		{
			for(int i=2*a[j];i<=mx;i+=a[j])
				prime[i]=false;
		}
	}
	int cnt=0;
	for(int i=0;i<n;i++)
	{
		if(prime[a[i]] && mp[a[i]]==1)
			cnt++;
	}
	cout<<cnt<<endl;
	return 0;
}
signed main()
{
	fastio;
//	test
		solve();
}




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

long long int n,i,a[20],t,m,x;
	
signed main()
{
    ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
	cin>>n;
	a[1]=1;m=1;
	for (t=2;t<n+1;t++)
	if (m==1)
	{
		if (a[1]<9) a[1]++;else a[1]=0,a[2]=1,m++;
	}
	else
	{
		i=1;
		while ((a[i]>a[i+1] || a[i]==9) && i<=m) i++;
		if (i==m+1)
		{
			if (a[m]==9)
			{
				for (i=1;i<m+1;i++) a[i]=0;
				m++;a[m]=1;
			}
			else
			{
				i=m;
				a[i]++;x=i;
				for (i=x-1;i>0;i--) a[i]=max((long long)0,a[i+1]-1);
			}
		}
		else
		{
			a[i]++;x=i;
			for (i=x-1;i>0;i--) a[i]=max((long long)0,a[i+1]-1);
		}
	}
	for (i=m;i>0;i--) cout<<a[i];
}


Measured memory_bytes: 3580