akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <stdlib.h>

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;
#define NIL NULL

Node root;

Node treeMinimum(Node x){
  while (x->left != NIL) x = x->left;
  return x;
}

Node treeMaximum(Node x){
  while (x->right != NIL) x = x->right;
  return x;
}

Node treeSearch(Node u, int k){
  if ((u == NIL) || (k == u->key)) return u;
  else if (k < u->key) return treeSearch(u->left, k);
  else return treeSearch(u->right, k);
}

Node treeSuccessor(Node x){
  Node y;
  if (x->right != NIL) return treeSuccessor(x->right);
  y = x->parent;
  while ((y != NIL) && (x == y->right)) {
    x = y;
    y = y->parent;
  }
  return y;
}

void treeDelete(Node z){
  Node y; // node to be deleted
  Node x; // child of y
  if ((z->left == NIL) || (z->right == NIL)) y = z;
  else y = treeSuccessor(z);
  if (y->left != NIL) x = y->left;
  else x = y->right;
  if (x != NIL) x->parent = y->parent;
  if (y->parent == NIL) root = x;
  else if (y == y->parent->left) y->parent->left = x;
  else y->parent->right = x;
  if (y != z) z->key = y->key;
}

void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;
  while (x != NIL) {
    y = x;
    if (z->key < x->key) x = x->left;
    else x = x->right;
  }
  z->parent = y;
  if (y == NIL) {
    root = z;
  } else {
    if (z->key < y->key) y->left = z;
    else y->right = z;
  }
}

void inorder(Node u){
  if (u == NIL) return;
  inorder(u->left);
  printf(" %d", u->key);
  inorder(u->right);
}
void preorder(Node u){
  if (u == NIL) return;
  printf(" %d", u->key);
  preorder(u->left);
  preorder(u->right);
}


int main(){
  int n, i, x;
  char com[20];
  scanf("%d", &n);

  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    if ( com[0] == 'f' ){
      scanf("%d", &x);
      Node t = treeSearch(root, x);
      if ( t != NIL ) printf("yes\n");
      else printf("no\n");
    } else if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    } else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    } else if ( com[0] == 'd' ){
      scanf("%d", &x);
      treeDelete(treeSearch(root, x));
    }
  }

  return 0;
}



Measured memory_bytes: 25296
import java.util.Scanner;
class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int[] Box = new int[26];
        while(sc.hasNext()){
       		String s = sc.nextLine();
        	s = s.toLowerCase();
            
            	for(int i=0;i<s.length();i++){
                    char Alfa = 'a';
                    for(int j=0;j<=('z'-'a');j++){
                        if(s.charAt(i) == Alfa++)
                            Box[j]++;
                    }
                }
        }
       char  Alfa = 'a';
            for(int k=0;k<=('z'-'a');k++){
            System.out.println(Alfa++ + " : " + Box[k]);
            }
    }
}


Measured memory_bytes: 26000
#include <algorithm>
#include <array>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <queue>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#define REP(X, Y, Z) for (ll(X) = (Y); (X) < (Z); (X)++)
#define REV(X, Y, Z) for (ll(X) = (Y); (X) > (Z); (X)--)

using namespace std;
using ll = long long;
using dll = deque<ll>;
using pll = pair<ll, ll>;
using qll = queue<ll>;
using usll = unordered_set<ll>;
using umll = unordered_map<ll, ll>;
using sll = stack<int>;
using vll = vector<ll>;
using vvll = vector<vll>;

constexpr ll kMod = 1e9 + 7;

ll gcd(ll a, ll b) {
  if (a < b) {
    return gcd(b, a);
  }
  ll c = a % b;
  while (c != 0) {
    a = b;
    b = c;
    c = a % b;
  }
  return b;
}

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

void init() {
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
}

int main() {
  init();

  ll A, B;
  cin >> A >> B;

  ll ans = 0;
  REP(i, A, B+1){
    auto s = to_string(i);
    if (s[0] == s[4] && s[1] == s[3]) {
      ans++;
    }
  }
  cout << ans;

  return 0;
}


Measured memory_bytes: 256
program sequence_sum
  implicit none
  integer(8) :: n, x, m, a(100000) = -1, num
  integer :: i, b(0:100000) = -1, period, offset, rem
  read(*,*) n, x, m
  if (n <= 200000) then
    num = x
    do i = 2, int(n)
      x = mod(x * x, m)
      if (x == 0) exit
      num = num + x
    end do
    write(*,'(i0)') num
    stop
  end if
  a(1) = x
  b(int(a(1))) = 1
  do i = 2, int(m) + 1
    x = mod(x * x, m)
    a(i) = x
    if (b(int(x)) > 0) then
      offset = b(int(x)) - 1
      period = i - b(int(x))
      exit
    end if
    b(int(x)) = i
  end do
  num = (n - offset) / period
  rem = int(n - offset - num * period)
  write(*,'(i0)') sum(a(1:offset)) + sum(a(offset + 1:offset + period)) * num + &
    sum(a(offset + 1:offset + rem))
end program sequence_sum

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

using namespace std;

#define INF 1000000007
#define LINF (1LL << 62)

typedef long long i64;
typedef pair<i64,i64> P;


int a,b;

int main(){
	cin >> a >> b;
	
	int ans = 0;
	for(int i = 1; i <= a; i++){
		for(int j = 22; j <= b; j++){
			if(j % 10 < 2) continue;
			if(i == (j%10) * (j/10)){
				ans++;
			}
		}
	}
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
using namespace std;
const ll mod=1e9+7;
const ll inf = (ll)1e17;
const ld eps = 1e-12;
const ld PI = 3.14159265358979323846;
ll mul(ll a, ll b, ll m = mod) { return (ll)(a * b) % m;}
ll add(ll a, ll b, ll m = mod) { a += b; if(a >= m) a -= m; if(a < 0) a += m; return a;}
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin>>n;
    string a,b;
    cin>>a>>b;
    string s="";
    for(int i=0;i<n;i++){
        s+=a[i];
        s+=b[i];
    }
    cout<<s<<endl;
    return 0;

}


Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc=new Scanner(System.in);
		int K=sc.nextInt();
		int S=sc.nextInt();
		int count=0;
		for(int i=0;i<K+1;i++){
			for(int j=0;j<K+1;j++){
				int k=S-i-j;
				int sum=i+j+k;
				if(0<=k && k<=K)count++;
				
			}
		}
		System.out.println(count);
	}

}


Measured memory_bytes: 23764
/*~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=
* * WRITER:kakitamasziru/OxOmisosiru * *
~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=*/
#ifdef LOCAL_JUDGE
#define _GLIBCXX_DEBUG //FOR THE DEBUG! COMMENT OUT THIS WHEN SUBMITTING!
#endif
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <iomanip>
#include <limits>//setprecision
//#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <math.h>//pow,,,
#include <cmath>//abs,,,
#include <bitset> // bitset
//It is so troublesome that I include bits/stdc++.h !
using namespace std;

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; }
const long long INF = 1001001001001001;
const long long MOD = 1000000007;
typedef pair<long long,long long> P;
//NのM乗を求める(繰り返し二乗法)
long long mod_pow(long long N, long long M) {
    if (M == 0) return 1;
    long long res = mod_pow((N * N) % MOD, M / 2);
    //最下位ビット(*N)が1の時は単独でNをかける
    if (M & 1) res = (res * N) % MOD;

    return res %= MOD;
}
long long nCr(long long n, long long r) {
    long long A = 1, B = 1;
    //Aが分子Bが1/r!
    for (long long i = n - r + 1; i <= n; i++) {
        A = A * i % MOD;
    }
    for (long long i = 1; i <= r; i++) {
        B = B * i % MOD;
    }
    B = mod_pow(B, MOD - 2);
    B %= MOD;
    //Bは割るのではなく掛ける
    return (A * B) % MOD;
}

long long gcd(long long a, long long b) {
    if (b == 0) return a;
    else return gcd(b, a % b);
}
 
long long lcm(long long a, long long b) {
    return a * b / gcd(a, b);
}

long long A,B;
bool ok(long long key,long long index){
    string S = to_string(index);
    long long nagasa = S.size();
    if(index*A+nagasa*B > key) return true;
    else if(index*A+nagasa*B <= key) return false;
}
long long binary_search(long long key,long long size){
    //left,right,midはいずれもindex
    long long left = -1,right = size;
    while(right - left > 1){
        long long mid = left + (right-left)/2;
        long long hantei = ok(key,mid);
        if(hantei) right = mid;
        else left = mid;
    }
    if(left == -1)return 0;
    return left;
}

int main() {
    int N;cin >> N;
    vector<int> retu(N);
    for(int i = 0;i<N;i++) cin >> retu.at(i);
    sort(retu.begin(),retu.end());
    int ans = 0;

    //i→j→kの順で大きくなる
    for(int i = 0;i<N;i++){
        for(int j = i+1;j<N;j++){
            for(int k = j+1;k<N;k++){
                if(retu.at(k) < retu.at(j) + retu.at(i)){
                    ans++;
                }
            }
        }
    }
    cout << ans << endl;

    // PLEASE GIVE ME THE "ACCEPTED" !
}


Measured memory_bytes: 256
import qualified Data.ByteString.Char8 as B
import qualified Data.Vector.Unboxed as VU
import Data.Char

solve :: VU.Vector Int -> Int
solve xs = VU.foldl' step 0 xs
    where
        step n x
            | even x = n + loop x
            | otherwise = n
            where
                loop x
                    | even x = 1 + (loop $ x `quot` 2)
                    | otherwise = 0

main = do
    n <- readLn :: IO Int
    xs <- VU.unfoldrN n (B.readInt . B.dropWhile isSpace) <$> B.getLine
    print $ solve xs

Measured memory_bytes: 1148
cards = [*1..10]

while line = gets
  c1, c2, c3 = line.chomp.split.map(&:to_i)
  rest_cards = cards - [c1, c2, c3]
  puts (rest_cards.take_while { |x| x + c1 + c2 <= 20 }.size.to_f / rest_cards.size.to_f >= 0.5) ? :YES : :NO
end

Measured memory_bytes: 8656
// 3の倍数と3のつく数字のときだけ出力するプログラム
import java.util.Scanner;

class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		String str = scan.nextLine();
		int n = Integer.parseInt(str);
		int x = 0;

		for(int i=1; i<=n; i++){
			// 3の倍数処理
			if(( i % 3 ) == 0){
				System.out.print(" " + i);
			}
			// 3のつく数字処理
			else{
				x = i;
				while(true){
					if((x % 10) == 3){
						System.out.print(" " + i);
						break;
					}
					x /= 10;
					if(x == 0) break;
				}
			}
		}
		System.out.println();
	}
}


Measured memory_bytes: 28612
#include <bits/stdc++.h>
#define INF 1e9
#define INFLL 1ull<<60u
using namespace std;

#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ALL(a)  (a).begin(),(a).end()
#define endl "\n"

template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
typedef long long ll;

void solve() {
    int N; cin >> N;
    map<int,int> mp;
    REP(_,N) {
        int d; cin >> d;
        if(!mp.count(d)) mp[d] = 0;
        mp[d]++;
    }
    int M; cin >> M;
    REP(_,M) {
        int t; cin >> t;
        if (mp.count(t) && mp[t]) mp[t]--;
        else {
            cout << "NO" << endl;
            return;
        }
    }
    cout << "YES" << endl;
}

int main() {
    solve();
    return 0;
}

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

#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define MIN(a) *min_element(all(a))
#define MAX(a) *max_element(all(a))
#define SUM(a) accumulate(all(a), 0LL)
#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
#define RREP(i, n) for(int (i)=(n)-1; (i)>=0; (i)--)
#define FOR(i, m, n) for(int (i)=(m); (i)<(n); i++)
#define FORR(i, m, n) for(int (i)=(n)-1; (i)>=(m); i--)
#define debug(x) cerr << #x << " = " << x << endl
//#define int long long

typedef long long ll;
//ll const MOD = 998244353;
ll const MOD = 1e9+7;
int const inf = 1e9;
ll const INF = 1e18;

inline void ios_(){cin.tie(0); ios::sync_with_stdio(false);}
template<typename T> int size(const T& a){return (int)a.size();}
template<typename T> T Div(T a, T b){return (a + b - 1) / b;}
template<typename T> bool chmin(T& a, const T& b){if(a > b){a = b; return true;} return false;}
template<typename T> bool chmax(T& a, const T& b){if(a < b){a = b; return true;} return false;}

ll BinarySearch(ll ng, ll ok, const function<bool(ll)>& judge){
    while(abs(ok - ng) > 1){
        ll mid = (ok + ng) / 2;
        if(judge(mid)) ok = mid;
        else ng = mid;
    }
    return ok;
}

signed main(){
    int n;
    cin >> n;
    vector<ll> lo(n), hi(n);
    REP(i, n){
        cin >> lo[i] >> hi[i];
    }

    int t = Div(n,2);

    auto fn = [&](ll x){
        int l = 0, m = 0, h = 0;
        REP(i, n){
            if(hi[i] < x) l++;
            else if(lo[i] > x) h++;
            else m++;
        }
        if(l + m >= t) return true;
        else return false;
    };

    auto gn = [&](ll x){
        int l = 0, m = 0, h = 0;
        REP(i, n){
            if(hi[i] < x) l++;
            else if(lo[i] > x) h++;
            else m++;
        }
        if(l < t) return true;
        else return false;
    };

    ll l1 = BinarySearch(0LL, 1e18, fn);
    ll h1 = BinarySearch(1e18, 0LL, gn);

    t = Div(n+1,2);
    ll l2 = BinarySearch(0LL, 1e18, fn);
    ll h2 = BinarySearch(1e18, 0LL, gn);

    // debug(l1);
    // debug(h1);
    // debug(l2);
    // debug(h2);

    if(n%2 == 1){
        cout << h1 - l1 + 1 << endl;
    }else{
        cout << ((h1 + h2) - (l1 + l2)) + 1 << endl;
    }


    return 0;
}


Measured memory_bytes: 6428
//
//AtCoder Beginner Contest 169
//B - Multiplication 2
//

#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <ctime>
#include <queue>
#include <map>
#include <set>
#include <tuple>
#include <functional>
#include <cassert>

using namespace std;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define SIZE(x) (int)(x).size()
#define SIZEL(x) (ll)(x).size()
#define MSG(a) cout << #a << " " << a << endl;

using ll = long long;
using ld = long double;

const double PI = 3.14159265358979323846;

ll gcd(ll x, ll y) { return (x % y)? gcd(y, x % y): y; }    //最大公約数
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }            //最小公倍数

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

    vector<ll> a(n);
    REP(i, n) cin >> a[i];

    REP(i, n){
        if (a[i] == 0) {
            cout << 0 << endl;
            return 0;
        }
    }

    ll ans = 1;
    REP(i, n){
        ll bef  = ans;
        ans *= a[i];
        if (ans > 1000000000000000000) {
            ans = -1;
            break;
        }

        if (ans<0) {
            ans = -1;
            break;
        }

        if (ans < bef) {
            ans = -1;
            break;
        }

        if (bef != (ans / a[i])) {
            ans = -1;
            break;
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 4048
#include<iostream>
#include<algorithm>

using namespace std;
 
int main(){
  int x[10],tmp,i,j;

  for(i=0; i<10; ++i)
    cin >> x[i];

  sort(x,x+10,greater<int>());

  for(i=0; i<3; ++i)
    cout << x[i] << endl;

    return 0;
}

Measured memory_bytes: 1176
#include<bits/stdc++.h>
#include<iostream>
#include<list>
#include<vector>
#include<climits>
#define fast_io() ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0)
using namespace std;
typedef vector<int> vi;
typedef long long int ll;

int main()
{
    fast_io();
    int n,i;
    float sum=0.0;
    cin>>n;
    float lol[n];
    for(i=0;i<n;i++)
    {
        cin>>lol[i];
    }
    sort(lol,lol+n);
    for(i=1;i<n;i++)
    {
        lol[i]=(lol[i]+lol[i-1])/2;
        //cout<<lol[i]<<endl;
    }
    cout<<lol[n-1];
}


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

#define rep(i,n) for(long long int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(long long int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(long long int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define pb(q) push_back(q)
#define Size(n) (n).size()
#define Cout(x) cout<<(x)<<endl

typedef long long ll;

using namespace std;

const int INF = 1e9,MOD = 1e9 + 7,ohara = 1e6;
const ll LINF = 1e18;
long long int n,cnt=0,ans=0,a,b,c,d,cmp,cmpp,m,h,w,x,y,sum=0,pos;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl;
struct edge{int to,cost;};

//-------------------------↓↓↓↓↓↓------------------------

int main(void){
  
       cin.tie(0);
    ios::sync_with_stdio(false);
      
     cin>>n;
     rrep(i,n,ohara){
       s=to_string(i);
       map<char,ll> mp;
       fl=true;
       rep(j,Size(s)){
         if(mp[s[j]]==0&&j!=0)fl=false;
         mp[s[j]]++;
       }
       if(fl){
         Cout(i);
         return 0;
       }
     }
    
       
return 0;
}


Measured memory_bytes: 256
from collections import deque
n, k = map(int, input().split())
edges = deque()

if k > (n-1)*(n-2)/2:
    print(-1)
    exit()

for i in range(1, n):
    for j in range(i+1, n+1):
        edges.append((i, j))
m = int((n-1) + (n-1)*(n-2)//2 - k)
print(m)
for i in range(m):
    edge = edges.popleft()
    print(*edge)

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

#define int long long
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define rep(i,n) for(int i=0; i<(int)n; i++)
#define ll long long
#define all(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define COUT(x) cout << x << endl;
#define PB(x) push_back(x)
#define MP make_pair
int gcd(int a,int b){return b?gcd(b,a%b):a;}
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int INF = 1e9;
const int MOD = 1e9+7;

signed main(){
    int n,a,b; cin >> n >> a >> b;
    if(n<=a){cout<<n<<endl; return 0;}

    int res=0;
    int num=n/(a+b);
    res+=num*a;
    n%=(a+b);
    if(n<=a) res+=n;
    else res+=a;
    cout<<res<<endl;


}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <numeric>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;
 
int main() {
    ll k;
    cin >> k;

    out(50);

    ll x = k/50;
    ll y = k%50;

    vl a(50);
    rep(i, 50) {
        a[i] = i;
    }

    rep(loop, y) {
        a[0] += 50;
        exrep(i, 1, 49) {
            a[i]--;
        }
        sort(all(a));
    }

    rep(i, 50) {
        cout << x + a[i];
        if(i < 49) {
            cout << " ";
        }
    }
    
    cout << endl;
    re0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <numeric>
#include <algorithm>

using namespace std;

long int dp[100001];

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

    vector<int>v(n);
    fill(dp,dp+100001,1000000000);

    for(int i = 0;i < n;i++)
        cin >> v[i];
    
    dp[0] = 0;

    for(int i = 0;i < n-1;i++){
        dp[i+1] = min(dp[i+1],abs(v[i+1]-v[i])+dp[i]);
        dp[i+2] = min(dp[i+2],abs(v[i+2]-v[i])+dp[i]);
    }

    cout << dp[n-1] << endl;

    return 0;
}

Measured memory_bytes: 1408
import java.util.*;

public class Main {
    public static void main (String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        if (a + b >= 10) {
            System.out.println("error");
        } else {
            System.out.println(a+b);
        }
    }
}

Measured memory_bytes: 21204
n,t=map(int,input().split())
info=[tuple(reversed(list(map(int,input().split())))) for i in range(n)]

#(美味しさ,頼まなかったやつの美味しさ最大値)
dp=[(-10**9,-10**9)]*t
dp[0]=(0,0)

for _ in reversed(sorted(info)):
    good,time=_
    for i in range(t-1,-1,-1):
        g0,m0=dp[i]
        dp[i]=(g0,max(m0,good))
        if i>=time:
            g1,m1=dp[i-time]
            if g0+m0<g1+good+m1:
                dp[i]=(g1+good,m1)
ans=0
for a,b in dp:
    ans=max(ans,a+b)

print(ans)

Measured memory_bytes: 52696
import java.util.Scanner;

public class Main {

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

        int MAX = 101010;

        // エラトステネスのふるい
        int[] isPrime = new int[MAX];
        for (int i = 0; i < MAX; i++) isPrime[i] = 1;
        isPrime[0] = 0;
        isPrime[1] = 0;
        for (int i = 2; i < MAX; i++) {
            if (isPrime[i] == 0) continue;
            for (int j = i*2; j < MAX; j += i) isPrime[j] = 0;
        }

        // 2017-like
        int[] a = new int[MAX];
        for (int i = 0; i < MAX; i++) {
            if (i % 2 == 0) continue;
            if ((isPrime[i] & isPrime[(i+1)/2]) == 1) a[i] = 1;
        }

        // 累積和
        int[] s = new int[MAX+1];
        for (int i = 0; i < MAX; i++) s[i+1] = s[i] + a[i];

        int q = sc.nextInt();
        for (int i = 0; i < q; i++) {
            int l = Integer.parseInt(sc.next());
            int r = Integer.parseInt(sc.next());
            System.out.println(s[++r] - s[l]);
        }
    }
}


Measured memory_bytes: 49840
/*input
*/

// #include<bits/stdc++.h>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#include <cstdint>
#include <tuple>
#endif
 
using namespace std;
long long mod=1e9+7;
long long INF=1e7;
double EPS = 1e-12;
const long long lim = 2e5+10;
typedef long long int lld;
typedef long long ll;

#define rep(i,a,n) for(long long int i = (a); i <= (n); ++i)
#define mset(a, v) memset(a, v, sizeof(a))
#define Error(x...) { cout << "(" << #x << ")" << " = ( "; printIt(x); }
template <typename T1> void printIt(T1 t1) { cout << t1 << " )" << endl; }
template <typename T1, typename... T2>
void printIt(T1 t1, T2... t2) { cout << t1 << " , "; printIt(t2...); }


#define popcount __builtin_popcountll

ll powP(ll x, ll y) {
    ll ans = 1, po = x % mod;
    while(y > 0) {
        if(y & 1) ans = ans * po % mod;
        y >>= 1; po = po * po % mod;
    }
    return ans;
}


ll Array[lim],BArray[lim],dp[lim];
vector<ll> Parent[lim];

ll dfs(ll node,ll par) {
    // Error(node,par);
    for(auto i: Parent[node]) {
        if(i!=par) {
            dfs(i,node);
            dp[node] += max(ll(0),dp[i]);
        }
    }
}

void dfs_print(ll node,ll par) {
    for(auto i: Parent[node]) {
        if(i!=par and dp[i]>=0) dfs_print(i,node);
    }

    cout<<node<<" ";
    for(auto i: Parent[node]) {
        if(i!=par and dp[i]<0) dfs_print(i,node);
    }
}

int main(){

    ios::sync_with_stdio(0);
    cin.tie(0);
    #ifndef ONLINE_JUDGE
    // for getting input from input.txt
    freopen("input.txt", "r", stdin);
    // for writing output to output.txt 
    freopen("output.txt", "w", stdout);
    #endif

    lld T,i,p,j,l,e,r,b,c,k,q,a,d,w,x,y,u,v,z,t,curr,prev,sum=0,val,countA=0,indicator=0,pos,h,minA,maxA,type,n,m,ans=0,left,right;
    string A,B;
    val=0;
    cin>>k; 
    map<ll,ll> M;
    while(1) {
        if(M[(10*val+7)%k]==1) {ans=-1; break;}
        else if((10*val+7)%k == 0) {ans++; break; }
        M[(10*val+7)%k]=1; ans++; val = (10*val+7)%k;
    }

    cout<<ans<<endl;
    return 0;
}





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

typedef long long int ll;
typedef vector<long long>lve;
typedef vector<pair<ll,ll> > lvp;
typedef vector<vector<int> > ivve;

#define sp         ' '
#define endl       '\n'
#define F          first
#define S          second
#define pb         push_back
#define mp         make_pair 
#define GCD(x,y)   __gcd(x,y)
#define lb         lower_bound
#define up         upper_bound
#define setp       setprecision
#define bs         binary_search
#define all(x)     x.begin(),x.end()
#define LCM(x,y)   ((x*y)/__gcd(x,y))
#define spc(x)     cout<<fixed<<setp(x)

const   long long  inf = 1e18;
const   long long  cs =  200005;
const   long long  mod = 1000000007;
const   double     PI =  2 * acos(0.0);
void solve()
{
    ll t,n,m,a,b,c,d,e,i,j,k,x,y,z,cnt=0,cnt1=0;
    bool flag = false;
    
    string s;
    cin>>s;
    n=s.length();
    string s1{all(s)};
    reverse(all(s1));
    n/=2;
    for(i=0;i<n;i++)
    {
        if(s[i]!=s1[i]) cnt++;
    }
    cout<<cnt<<endl;
}
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);    cout.tie(NULL);

    // freopen ("input.txt","r",stdin);
    // freopen ("output.txt","w",stdout);

    // int32_t tc;
    // cin>>tc;
    // while(tc--)
    solve();

    return 0;
}

Measured memory_bytes: 3608
import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline

N,Q = map(int,input().split())
AB = [[x for x in map(int,input().split())] for _ in range(N-1)]
PX = [[x for x in map(int,input().split())] for _ in range(Q)]
 
graph = [[] for _ in range(N+1)]
for a,b in AB:
    graph[a].append(b)
    graph[b].append(a)
 
cnt = [0]*N
for p,x in PX:
    cnt[p-1] += x
 
def dfs(v):
    for w in graph[v]:
        cnt[w-1] += cnt[v-1]
        graph[w].remove(v)
        if len(graph[w]) > 0:
            dfs(w)
 
dfs(1)
 
print(*cnt)

Measured memory_bytes: 284540
#include<cstdio>
using namespace std;
#define R register
int n;
int t,a;
inline double Abs(R double x){return x > 0 ? x : -x;}
inline void read(R int &x)
{
	x = 0;R char ch = getchar();R bool f = false;
	for(;ch < 48 || ch > 57;ch = getchar())f |= (ch == '-');
	for(;ch > 47 && ch < 58;ch = getchar())x = (x << 3) + (x << 1) + (ch ^ 48);
	(f) && (x = -x);
}
int main()
{
	read(n);
	read(t);read(a);
	R double min = 1e8;R int minpa = 0;
	for(R int i = 1;i <= n; ++i)
	{
		R int k;
		read(k);
		R double ki = t - k * 0.006;
		if(Abs(a - ki) < min)
		{
			min = Abs(a - ki);
			minpa = i;
		}//printf("i = %d Abs(a - ki) = %lf min = %lf a = %d ki = %lf\n",i,Abs(a - ki),min,a,ki);
	}
	printf("%d",minpa);
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1000005;
struct Node {
  int val, size;
  Node *ls, *rs;
  Node(int _val, int _size, Node *_ls, Node *_rs) : val(_val), size(_size), ls(_ls), rs(_rs){}
  Node(){}
  inline void pushup() {
    if (!ls->size) return ;
    val = rs->val, size = ls->size + rs->size;
  }
}pool[MAXN<<1], *st[MAXN<<1], *root, *null; int cnt, a[MAXN];
inline Node *newNode(int val, int size, Node *ls, Node *rs) {
  return &(*st[cnt++] = Node(val, size, ls, rs));
}
Node *merge(Node *ls, Node *rs) {
  if (ls->size > rs->size * 4) 
    return ls->rs = merge(ls->rs, rs), ls->pushup(), ls;
  if (rs->size > ls->size * 4) 
    return rs->ls = merge(ls, rs->ls), rs->pushup(), rs;
  return newNode(rs->val, ls->size+rs->size, ls, rs);
}
Node *build(int l, int r) {
  if (l == r) return newNode(a[l], 1, null, null);
  int mid = l+r>>1;
  Node *cur = newNode(0, 0, build(l,mid), build(mid+1,r));
  return cur->pushup(), cur;
} 
inline void maintain(Node *cur) {
  Node *&ls = cur->ls, *&rs = cur->rs;
  if (ls->size > rs->size*4) 
    rs = merge(ls->rs, rs), st[--cnt] = ls, ls = ls->ls;
  if (rs->size > ls->size*4) 
    ls = merge(ls, rs->ls), st[--cnt] = rs, rs = rs->rs;
}

inline void insert(Node *cur, int x) {
  if (cur->size == 1) 
      cur->ls = newNode(min(x, cur->val), 1, null, null), 
      cur->rs = newNode(max(x, cur->val), 1, null, null);
  else insert(cur->ls->val >= x ? cur->ls : cur->rs, x);
  cur->pushup();
  maintain(cur);
}

inline void erase(Node *cur, Node *fa, int x) {
  if (cur->size == 1) *fa = fa->ls->val == x ? *fa->rs : *fa->ls;
  else erase(cur->ls->val >= x ? cur->ls : cur->rs, cur, x);
  cur->pushup();
}

inline int kth(Node *cur, int k) {
  if (cur->size == 1) return cur->val;
  return cur->ls->size>=k?kth(cur->ls, k) : kth(cur->rs, k-cur->ls->size);
}

inline int Rank(Node *cur, int x) {
  if (cur->size == 1) return x > cur->val;
  return cur->ls->val >= x ? Rank(cur->ls, x) : Rank(cur->rs, x) + cur->ls->size;
}

int main(void) {
  int n;
  scanf("%d",&n);
  for(int i = 0; i < (MAXN<<1); ++i) st[i] = &pool[i];  
  null = new Node(0, 0, 0, 0);
  root = newNode(2147483647, 1, null, null);
  for(int i = 1; i <= n; ++i) scanf("%d", a+i), insert(root, a[i]);
//  root = build(1, n);
	for(int i = 1; i <= n; ++i) {
		erase(root, null, a[i]);
		printf("%d\n", kth(root, n/2));
		insert(root, a[i]);
	}
  return 0;
}

Measured memory_bytes: 39808
#include<bits/stdc++.h>
using namespace std;
#define MOD (long long)(1e9+7)
typedef long long int ll;
typedef unsigned long long int ull;

ll modularExponentiation(ll x, ll y, ll  p){
  ll res = 1;
  x = x % p;
  while (y > 0){
      if (y & 1) res = (res*x) % p;
      y = y>>1;
      x = (x*x) % p;
  }
  return res;
}

bool isPrime(ll n){
    if (n <= 1)  return false;
    if (n <= 3)  return true;
    if (n%2 == 0 || n%3 == 0) return false;
    for (int i=5; i*i<=n; i=i+6)
        if (n%i == 0 || n%(i+2) == 0)
           return false;
    return true;
}

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ll T=1;
  // cin>>T;
  for(int t=0;t<T;t++){
    double n, m;
    double t1=0;
    cin>>n>>m;
    vector<double> a(n);
    for(int i=0;i<n;i++){
      cin>>a[i];
      t1+=a[i];
    }
    sort(a.begin(), a.end(), greater<double>());
    t1=t1/4;
    t1=t1/m;
    ll c=0;
    for(int i=0;i<n;i++) if(a[i]>=t1) c++;
    if(c>=m) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;

  }
  return 0;
}


Measured memory_bytes: 256
// include
// ----------------------------------------------------------------------------
#include<stdio.h>
#include<stdlib.h>
#include<ctype.h>
#include<math.h>
#include<string.h>
#include<stdbool.h>

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

// memory clear
// ----------------------------------------------------------------------------
#define CLRNUM(a) memset((a), 0, sizeof(a))
#define CLRBOOL(a, flag) memset((a), flag, sizeof(a))
#define CLRCHAR(a) memset((a), '\0', sizeof(a))

// debug
// ----------------------------------------------------------------------------
#define DEBUGINT(x) printf("%d\n", x);
#define DEBUGFLOAT(x) printf("%f\n", x);
#define DEBUGCHAR(x) printf("%c\n", x);
#define DEBUGSTR(x) printf("%s\n", x);
#define DEBUGFORINT(i, a, b, x) FOR(i, a, b){ printf("%d ", x[i]); }
#define DEBUGFORFLOAT(i, a, b,x ) FOR(i, a, b){ printf("%f ", x[i]); }
#define DEBUGFORCHAR(i, a, b, x) FOR(i, a, b){ printf("%c ", x[i]); }
#define DEBUGREPINT(i, n, x) REP(i, n){ printf("%d ", x[i]); }
#define DEBUGREPFLOAT(i, n, x) REP(i, n){ printf("%f ", x[i]); }
#define DEBUGREPCHAR(i, n, x) REP(i, n){ printf("%c ", x[i]); }

// other
// ----------------------------------------------------------------------------
#define PUTNL printf("\n")

// constant
// ----------------------------------------------------------------------------
#define INF 1000000000

int main(void)
{
    char serve[150];
    int A, B;
    int i;

    while (1){
        A = 0;
        B = 0;
        memset(serve, '\0', sizeof(serve));
        
        scanf("%s", serve);

        if (strcmp(serve, "0") == 0){
            break;
        }

        for (i = 1; serve[i - 1] != '\0'; ++i){
            if (serve[i] == 'A'){
                A++;
            }
            else if (serve[i] == 'B'){
                B++;
            }
        }
        
        if (A > B){
            A++;
        }
        else {
            B++;
        }

        printf("%d %d\n", A, B);
    }

    return 0;

}

Measured memory_bytes: 0
# include <iostream>
# include <algorithm>
#include <array>
# include <cassert>
#include <cctype>
#include <climits>
#include <numeric>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <tuple>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
# include <chrono>
# include <random>
# include <limits.h>
# include <unordered_map>
# include <unordered_set>
# include <deque>
# include <cstdio>
# include <cstring>
#include <stdio.h>
#include<time.h>
#include <stdlib.h>
#include <cstdint>
#include <cfenv>
#include<fstream>
//#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
long long MOD = 1000000000 + 7; //924844033 1000000000 + 9;
constexpr long long INF = numeric_limits<LL>::max();
const double PI = acos(-1);
#define fir first
#define sec second
#define thi third
#define debug(x) cerr<<#x<<": "<<x<<'\n'
typedef pair<LL, LL> Pll;
typedef pair<double, double> Dll;
typedef pair<LL, pair<LL, LL>> Ppll;
typedef pair<LL, pair<LL, bitset<100001>>> Pbll;
typedef pair<LL, pair<LL, vector<LL>>> Pvll;
typedef pair<LL, LL> Vec2;
struct Tll { LL first, second, third; };
struct Fll { LL first, second, third, fourth; };
typedef pair<LL, Tll> Ptll;
#define rep(i,rept) for(LL i=0;i<rept;i++)
#define Rrep(i,mf) for(LL i=mf-1;i>=0;i--)
LL h, w, n, m, k, t, s, p, q, last, first, cnt, sum, ans, dp[110][200000], a[200000], b[200000];
string str, ss;
bool f;
char c[800][800];
int di[4][2] = { { 0,1 },{ 1,0 },{ 0,-1 },{ -1,0 } };
struct Edge { LL to, cost; };
struct edge { LL from, to, cost; };
vector<Edge>vec[20000];
vector<edge>ed;
vector<LL>v[23];
map<string, LL>ma;
set<LL>st;
void YN(bool f) {
	if (f)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
}
void yn(bool f) {
	if (f)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}

int main() {
	cin >> n>>m;
	rep(i, n) {
		cin >> a[i] >> b[i];
	}
	rep(i, n + 1)rep(j, 110000)if(j)dp[i][j] = INF;
	dp[0][0] = 0;
	rep(i, n) {
		rep(j, 110000) {
			if (i)
				dp[i][j] = min(dp[i][j], dp[i - 1][j]);
			if (dp[i][j] == INF)continue;

			dp[i + 1][j + b[i]] = min(dp[i + 1][j + b[i]], dp[i][j] + a[i]);
		}

	}
	rep(i, 110000) {
		if (min(dp[n][i],dp[n-1][i]) <= m)
			ans = max(ans,i);
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 160512
#include <stdio.h>
#include <string.h>
#include <ctype.h>

int main()
{
	char input[100];
	int length;
	int i;
	gets(input);
	length=strlen(input);
	for(i=0; i<length; i++){
		if(isalpha(input[i])){
			input[i]=toupper(input[i]);
		}
	}
	printf("%s\n", input);
	return 0;
}

Measured memory_bytes: 524
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自动生成的方法存根

		Scanner in=new Scanner(System.in);
		String string=in.nextLine();
		int leng=string.length();
		int u=2;
		if (string.charAt(0)==string.charAt(leng-1)) {
			u=3;
		}
		if ((leng-u)%2==0) {
			System.out.println("Second");
		}else {
			System.out.println("First");
		}
	}

}

Measured memory_bytes: 28092
n = int(input())
dicti = dict({})
for i in range(1,n+1):
    dicti.update({i : 0})
arr = list(map(int,input().split()))
for x in arr:
    a = dicti[x]
    dicti.update({x : a+1})
for i in range(1,n+1):
    print(dicti[i])

Measured memory_bytes: 48856
#include <bits/stdc++.h>
using namespace std;
int mod=1e9+7;
int solve(vector<vector<int> >&dp,int x,int y,int n,int m,vector<vector<char> >& a){
    if(x>=n||y>=m||a[x][y]=='#')return 0;
    if(dp[x][y]!=-1)return dp[x][y];
    if(x==n-1&&y==m-1)return dp[x][y]=1;
    return dp[x][y]=(solve(dp,x+1,y,n,m,a)+solve(dp,x,y+1,n,m,a))%mod;
}
int main()
{
    int n,m,x,y;
    cin>>n>>m;
    vector<vector<char> > a(n,vector<char>(m));
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            cin>>a[i][j];
        }

    }
    vector<vector<int> >dp(n,vector<int>(m,-1));

    cout<<solve(dp,0,0,n,m,a)<<endl;
}


Measured memory_bytes: 8660
#include <stdio.h>
int n,G[100][100],d[100],T=0,f[100]={0};
void visit(int);
  
int main()
{
  int a,i,j,k,l,m;
 
  for(i=0;i<n;i++){
    d[i]=0;
  }
    scanf("%d",&n);
  
  for(i=0;i<n+1;i++){
    for(j=0;j<n+1;j++) {
      G[i][j] = 0;
    }
  }
 
  for(i=0;i<n;i++){
    scanf("%d%d",&k,&m);
    for(j=0;j<m;j++) {
      scanf("%d",&a);
      G[k-1][a-1]=1;
    }
  }
  for(i=0;i<n;i++){
    if(d[i]==0) 
      visit(i);
  } 
  for(i=0;i<n;i++){
    printf("%d %d %d\n",i+1,d[i],f[i]);
  }
  return 0;
}
void visit(int u) {
  int i,j,v;
  T++;  
  d[u]=T;
  for(v=0;v<n;v++){
    if(G[u][v]==1&&d[v]==0){
      visit(v);
    }
  }
  T++;
  f[u]=T;
}
 

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

int main() {
    string s;
    cin >> s;
    cout << s.substr(0, 4) << " " << s.substr(4, 8) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define fi first
#define se second
using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> ii;
typedef pair<double,double> dd;
typedef pair<char,char> cc;
typedef vector<ii> vii;
typedef long long ll;
typedef pair<ll, ll> l4;
typedef long double ld;
typedef pair<ld,ld> ldd;
const ld pi = acosl(-1);
const int maxn = 200010;
const ll mod = 998244353;
const ll inf = 1e18;
const ld eps = 1e-10;

string s;
int bit[maxn], vis[maxn], last[26];
void add(int x, int a) {
    while (x < maxn) {
        bit[x] += a;
        x += x&-x;
    }
}
int sum(int x) {
    int ret = 0;
    while (x) {
        ret += bit[x];
        x -= x&-x;
    }
    return ret;
}

int main() {
    cin >> s;
    rep(i, 0, s.length()) vis[s[i]-'a']++;
    int cnt = 0;
    rep(i, 0, 26) cnt += vis[i]%2, last[i] = s.length();
    rep(i, 0, s.length()) add(i+1, 1);
    if (cnt > 1) {
        printf("-1\n");
        return 0;
    } else {
        memset(vis, 0, sizeof(vis));
        ll ans = 0;
        int i = 0, cnt = 0;
        while (cnt < s.length()/2) {
            if (vis[i]) {
                i++;
                continue;
            }
            while (s[--last[s[i]-'a']] != s[i]);
            vis[last[s[i]-'a']] = 1;
            if (last[s[i]-'a'] == i) {
                ans += s.length()/2-sum(i);
                continue;
            }
            add(last[s[i]-'a']+1, -1);
            ans += sum(s.length())-sum(last[s[i]-'a']);
            cnt++;
            i++;
        }
        printf("%lld\n",ans);
    }
}


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

int main(){
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	while(a>0&&c>0){
		c-=b;
		if(c<=0){
			cout<<"Yes";
			return 0;
		}
		a-=d;
	}
	cout<<"No";
	return 0;
}

Measured memory_bytes: 3596
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <climits>
#include <cstdlib>

using namespace std;

int N, M;
vector< pair<int,int> > student;
vector< pair<int,int> > point;

int main(void){
    cin >> N >> M;

    student.resize(N);
    for(int i=0; i<N; ++i){
        cin >> student[i].first >> student[i].second;
    }

    point.resize(M);
    for(int i=0; i<M; ++i){
        cin >> point[i].first >> point[i].second;
    }

    pair<int,int> ans;
    for(int i=0; i<N; ++i){
        ans.first = 0;
        ans.second = INT_MAX;

        for(int j=0; j<M; ++j){
            int dis = abs(student[i].first-point[j].first) + abs(student[i].second-point[j].second);
            if(ans.second > dis){
                ans.first = j;
                ans.second = dis;
            }
        }
        cout << ans.first + 1 << endl;
    }
}


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

using namespace std;

#define ll long long

int main()
{
    ll n,k;
    cin>>n>>k;
    ll a[n];
    ll sum = 0;
    for(int i = 0;i<n;i++)
    {
        cin>>a[i];
    }
   if(n<=k)
   {
       cout<<0;
       return 0;
   }
   else
   {
       sort(a,a+n,greater<int>());
       for(int i = k;i<n;i++)
       {
           sum+=a[i];
       }
       cout<<sum;
   }
   return 0;
}

Measured memory_bytes: 1792
using System;
using System.Collections.Generic;
using System.Linq;

class Program {
    static Scanner cin = new Scanner();

    static void Main(string[] args) {
        int n = cin.Int();
        int a = cin.Int();
        int b = cin.Int();
        var p = cin.ArrayInt(n);

        int first = 0, second = 0, third = 0;
        foreach (var x in p) {
            if (x <= a) first++;
            else if (a < x && x <= b) second++;
            else if (b < x) third++;
        }
        Console.WriteLine(Math.Min(first, Math.Min(second, third)));
        Console.ReadLine();
    }
}

class Scanner //標準入力
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int Int()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = Int() + add;
        }
        return Array;
    }

    public long Long()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = Long() + add;
        }
        return Array;
    }

    public double Double()
    {
        return double.Parse(next());
    }


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = Double() + add;
        }
        return Array;
    }
}


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

using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
//order_of_key(x) : number of items less than x
//find_by_order(x) : iterator to x

#define mem(dp,a)           memset(dp,a,sizeof dp)
#define rep(i,a,b)          for(ll i=a;i<b;i++)
#define pb(x)               push_back(x)
#define mp(x,y)             make_pair(x,y)
#define fastio              ios_base::sync_with_stdio(false);cin.tie(NULL)
#define F                   first
#define S                   second
#define all(v)              (v).begin(),(v).end()
#define pi                  3.14159265359
ll INF=1e18+10;
ll MOD=998244353;
ll mod=1e9+7;

int main()
{
    ll n,m;cin>>n>>m;
    ll ans=n*(n-1)/2;
    ans+=((m*(m-1))/2);
    cout<<ans;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
using namespace std;
const int mo=998244353;
const int maxn=3010;
int n,s,a[maxn];
long long dp[maxn][maxn],ans;
int main()
{
	scanf("%d%d",&n,&s);
	for (int i=1;i<=n;i++) scanf("%d",&a[i]);
	for (int i=1;i<=n;i++)
	{
		for (int j=0;j<s;j++) dp[i][j]=dp[i-1][j];
		dp[i][a[i]]=(dp[i][a[i]]+i)%mo;
		for (int j=1;j<=s-a[i];j++) dp[i][j+a[i]]=(dp[i][j+a[i]]+dp[i-1][j])%mo;
		if (dp[i][s]) ans=(ans+dp[i][s]*(n-i+1)%mo)%mo;
	}
	printf("%lld\n",ans);
return 0;
}

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

using namespace std;
typedef long long ll;

void LOL() {
/*#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif*/
    ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
}

ll LCM(ll a, ll b) {
    return ((a * b) / __gcd(a, b));
}

bool sortbysec(const pair<int, int> &a,
               const pair<int, int> &b) {
    return (a.second < b.second);
}

const double EPS = (1e-8);
const int N = 1e6 + 3, E = 1e7 + 2, OO = 0x3f3f3f3f;
bool vis[10];
bool valid(int n){
    while(n>0){
        if(vis[n%10])return false;
        n/=10;
    }
    return true;
}
int main() {
    LOL();
    int n,k, d;
    cin>>n>>k;
    while(k--){
        cin>>d; vis[d]=1;
    }
    for (int i = n;; ++i) {
        if(valid(i)){
            return cout<<i,0;
        }

    }
    return 0;

}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;

public class Main {

	static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

	public static int nextInt() throws IOException {
		return Integer.parseInt(br.readLine());
	}

	public static long nextLong() throws IOException {
		return Long.parseLong(br.readLine());
	}

	public static String next() throws IOException {
		return br.readLine();
	}

	public static int[] sortArr(int arr[]) throws IOException {
		ArrayList<Integer> a = new ArrayList<Integer>();
		for (int i : arr)
			a.add(i);

		Collections.sort(a);

		for (int i = 0; i < a.size(); i++)
			arr[i] = a.get(i);
		return arr;
	}

	public static int[] desortArr(int arr[]) throws IOException {
		ArrayList<Integer> a = new ArrayList<Integer>();
		for (int i : arr)
			a.add(i);

		Collections.sort(a, Collections.reverseOrder());

		for (int i = 0; i < a.size(); i++)
			arr[i] = a.get(i);
		return arr;
	}

	public static int[] nextArr() throws IOException {
		String elements[] = br.readLine().split(" ");
		int arr[] = new int[elements.length];
		for (int j = 0; j < elements.length; j++)
			arr[j] = Integer.parseInt(elements[j]);
		return arr;
	}

	public static void printArr(char arr[]) {
		for (int i = 0; i < arr.length; i++)
			System.out.print(arr[i] + " ");
	}

	public static void main(String[] args) throws IOException {

		int T = 1;
	
		while (T-- > 0) {
			long n = Long.parseLong(next());
			
			String s = "";

			while (n > 0) {
				n -= 1;
				s += (char) (97 + n % 26);
				n = n / 26;
			}
			System.out.println(new StringBuilder(s).reverse());
		}
	}

}


Measured memory_bytes: 37048
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

int main() {
    int a, b;
    cin >> a >> b;
    cout << (a+b)/2 << "\n";
    return 0;
}


Measured memory_bytes: 3088