akhauriyash/Code-Regression huggingface dataset:
from sys import stdin
import sys
import math
from functools import reduce
import functools
import itertools
from collections import deque,Counter,defaultdict
from operator import mul
import copy
# ! /usr/bin/env python
# -*- coding: utf-8 -*-
import heapq
sys.setrecursionlimit(10**6)
# INF =  float("inf")
INF = 10**18
import bisect
import statistics
mod = 10**9+7
# mod = 998244353

N, x = map(int, input().split())
a = [0] + list(map(int, input().split()))

ans = 0
for i in range(1,N+1):
    y = a[i-1] + a[i]
    if y > x:
        ans += y-x
        a[i] -= y-x
print(ans)

Measured memory_bytes: 92440
#include <stdio.h>
int main(void) {
    char s[200001];
    int i,a,b;
    scanf("%s",s);
    for (i = 0;i < sizeof(s);i++) {
        if (s[i] == 'A') {
            a = i;
            break;
        }
    }
    for (i = 0;;i++) {
        if (s[i] == 'Z') {
            b = i;
        }
        if (s[i] == '\0') {
            break;
        }
    }
    printf("%d\n",b - a + 1);
    return 0;
}

Measured memory_bytes: 384
function Main(input) {
    // 1行目がinput[0], 2行目がinput[1], …に入る
    tmp = input.split(" ");
    tmp =tmp.map(Number);

    if(tmp[0] <= 8 && tmp[1] <= 8){
        console.log("Yay!")
    }else{
        console.log(":(")
    }
    
    //console.log(t);
    //console.log(d);
    

    
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


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

int main(){

  int64_t K,X,D;
  cin >> X >> K >> D;

  if(X<0)
    X = (-1) * X;

  int64_t ans=0;

  if(log(X) >= log(K) + log(D) )
    ans = X - K*D;
  else{
    if(D <= X){
      int div = X / D;
      X -= div * D;
      K -= div; 
    }
    if(K%2 == 1) ans = (-1) * (X-D);
    else ans = X;
  }

  cout << ans << endl;

}


Measured memory_bytes: 3768
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#include <tuple>
#define mkp make_pair
#define mkt make_tuple
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define all(v) v.begin(),v.end()
using namespace std;
typedef long long ll;
const ll MOD=1e9+7;
template<class T> void chmin(T &a,const T &b){if(a>b) a=b;}
template<class T> void chmax(T &a,const T &b){if(a<b) a=b;}

#include <functional>
#include <climits>

//SegmentTree<int> seg(N,[](int a,int b){return min(a,b);},INT_MAX);
template< typename T>
class SegmentTree{
private:
  void resize(int size){
      n=1;
      while(n<size) n*=2;
      tree.resize(2*n-1,def);
  }
public:

  using F = function<T(T,T)>;

  int n;
  vector<T> tree;
  F operation;
  T def;

  SegmentTree(){}
  SegmentTree(int size,F _operation,T _def):operation(_operation),def(_def){
    resize(size);
  }

  void embody(int size,F _operation,T _def){
    operation=_operation;
    def=_def;
    resize(size);
  }

  void initialize(const vector<T> &v){
    int size=v.size();
    resize(size);

    for(int i=0;i<size;i++) tree[i+n-1]=v[i];
    for(int i=n-2;i>=0;i--) tree[i]=operation(tree[2*i+1],tree[2*i+2]);
  }

  void update(int index,T value){
    index+=n-1;

    tree[index]=value;
    while(index>0){
      index=(index-1)/2;
      tree[index]=operation(tree[2*index+1],tree[2*index+2]);
    }
  }

  T query(int a,int b,int k=0,int l=0,int r=-1){//[a,b)
    if(r<0) r=n;

    if(r<=a||b<=l) return def;
    else if(a<=l&&r<=b) return tree[k];
    else{
      T lval=query(a,b,2*k+1,l,(l+r)/2);
      T rval=query(a,b,2*k+2,(l+r)/2,r);
      return operation(lval,rval);
    }
  }

  T get(int index){
      return tree[index+n-1];
  }

  int find(int x,int k=0,int l=0,int r=-1){// a[0]+...+a[i]>=x (i:minimal)
    if(r<0) r=n;
    if(tree[k]<x) return -1;
    if(r-l==1) return k-(n-1);
    if(tree[2*k+1]>=x) return find(x,2*k+1,l,(l+r)/2);
    else return find(x-tree[2*k+1],2*k+2,(l+r)/2,r);
  }

  //right -> change vl to vr   (notice doesn't contain b. range [a,b))
  int find_left(int a,int b,T x,int k=0,int l=0,int r=-1){// max(a[a],...,a[i])>=x (i:minimal)
      if(r<0) r=n;
      if(tree[k]<x||r<=a||b<=l) return -1;
      if(r-l==1) return k-(n-1);
      int vl=find_left(a,b,x,2*k+1,l,(l+r)/2);
      if(vl>=0) return vl;
      return find_left(a,b,x,2*k+2,(l+r)/2,r);
  }
};

const ll INF=1e18;

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

  int N,Q;
  cin>>N>>Q;
  vector<ll> A(N);
  rep(i,N) cin>>A[i];

  SegmentTree<ll> seg(N,[](ll a,ll b){return max(a,b);},-INF);
  seg.initialize(A);
  rep(q,Q){
      int T;cin>>T;
      if(T==1){
          int X;ll V;
          cin>>X>>V;
          X--;
          seg.update(X,V);
      }else if(T==2){
          int L,R;
          cin>>L>>R;
          L--;R--;
          cout<<seg.query(L,R+1)<<"\n";
      }else{
          int X;ll V;
          cin>>X>>V;
          X--;
          int left=seg.find_left(X,N,V);
          if(left==-1) cout<<N+1<<"\n";
          else cout<<left+1<<"\n";
      }
  }

  return 0;
}


Measured memory_bytes: 8988
//satyaki3794
#include <bits/stdc++.h>
#define ff first
#define ss second
#define pb push_back
#define MOD (1000000007LL)
#define LEFT(n) (2*(n))
#define RIGHT(n) (2*(n)+1)
 
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> ii;
typedef pair<int, ii> iii;
 
ll pwr(ll base, ll p, ll mod = MOD){
ll ans = 1;while(p){if(p&1)ans=(ans*base)%mod;base=(base*base)%mod;p/=2;}return ans;
}
 
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;
}



int main(){

    ios_base::sync_with_stdio(0);

    string str;
    cin>>str;

    int n = str.length(), ans = 0, temp = 0;
    for(int i=0;i<n;i++)
        if(str[i] == 'g'){
            if(temp > 0){
                temp--;
                ans++;
            }
            else{
                temp++;
            }
        }
        else{
            if(temp > 0){
                temp--;
            }
            else{
                temp++;
                ans--;
            }
        }

    cout<<ans;
    return 0;
}






Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i) = 0; (i) < (n); (i)++)
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }


int main() {
    string s;
    cin >> s;
    string news = "";
    for(int i = 0; i < s.size(); i++){
        if(i+1 < s.size() && s[i] == 'B' && s[i+1] == 'C'){
            news += 'X';
            i++;
        }
        else{
            news += s[i];
        }
    }
    ///cout << news << endl;
    ll ans = 0, numa = 0;
    for(int i = 0; i < news.size(); i++){
        if(news[i] == 'A') numa++;
        else if(news[i] == 'X' && numa > 0){
            ans += numa;
        }else numa = 0;
    }
    cout << ans << endl;
}


Measured memory_bytes: 776
import java.util.*;

class Main{
    public static void main(String[] args) {
        Scanner stdIn = new Scanner(System.in);
        int n = stdIn.nextInt();
        int h[] = new int[n];
        Arrays.setAll(h, i -> stdIn.nextInt());
        int cou = 0;
        int ans = 0;

        for(int i = 0 ; i < n-1; i++){
            if(h[i] >= h[i+1]) cou++;
            else cou = 0;

            if(ans < cou){
                ans = cou;
            }
        }
    
        System.out.println(ans);
    }
}

Measured memory_bytes: 52524
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define vi vector<int>
#define ff first
#define ss second
#define file_se_input  freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#define pp long long int
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define pb push_back
#define mp make_pair
#define pi 3.141592653589793238
#define eb emplace_back
#define rep(i,a,b) for (int i = a; i <= b; i++)
#define zip(i,a,b) for(int i=a;i<b;i++)
#define rzip(i,a,b) for(int i=a;i>=b;i--)
#define ll unsigned long long int
#define test int t;cin>>t; while(t--)
#define um unordered_map
#define en '\n'
#define us unordered_set
typedef pair<int, int>     pii;
typedef pair<char, int>    pci;
typedef pair<char, char>   pcc;
typedef vector<pii>       vii;
typedef long double ld;
#define all(v) v.begin(), v.end()
#define INF (1e18+5)
#define inf (1e9+5)
#define mod 1000000007


bool check_prime(long long n)
{
	int flag = 0;
	for (long long i = 2; i * i <= n; i++)
	{
		if (n % i == 0)
		{
			flag = 1;
			break;
		}
	}
	if (n == 1)
		return false;
	else if (flag == 0 || n == 2 || n == 3)
	{
		return true;
	}
	else
	{
		return false;
	}

}

int BE(int x, int n, int m) //function to calculate x raise to power n modulo m
{
	int result = 1;
	while (n > 0)
	{
		if (n % 2 == 1)
			result = result * x % m;
		x = x * x % m;
		n = n / 2;
	}
	return result;
}

int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(0);
#ifndef ONLINE_JUDGE
	if (fopen("input.txt", "r"))
	{
		freopen ("input.txt" , "r" , stdin);
		freopen ("output.txt" , "w" , stdout);
	}
#endif
	//_______________________________-code starts-_______________________________________________


	int a[5];
	int ans = 0;
	zip(i, 0, 5)
	{
		cin >> a[i];
		if (a[i] == 0)
		{
			ans = i + 1;
		}
	}
	cout << ans << en;


	return 0;
}



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

// #define int long long
#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) int(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const ll INF = 1e15;
const int MOD = 1e9+7;
const ll LINF = 1e18;

class UnionFind{
private:
  vector<ll> Parent; 
 public:
  UnionFind(ll N){
    Parent = vector<ll>(N, -1);
  }
  
  ll root(ll A){
    if(Parent[A] < 0) return A;
    return Parent[A] = root(Parent[A]);
  }
  
  ll size(ll A){
    return -Parent[root(A)]; 
  }
  
  bool connect(ll A, ll B){
    A = root(A);
    B = root(B);
    if(A == B){
      return false;
    }
    if(size(A) < size(B)) swap(A, B);
    Parent[A] += Parent[B];
    Parent[B] = A;
    return true;
  }
  
  bool isSame(ll A, ll B){
    return root(A) == root(B);
  }
};

signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  ll n,m; cin>>n>>m;
  vll a(m),b(m);
  rep(i,m){
    cin>>a[i]>>b[i];
    a[i]--,b[i]--;
  }
  
  UnionFind uf(n);
  
  vll ans(m);
  ans[m-1]=n*(n-1)/2;
  for(ll i=m-1; i>0; i--){
    if(!uf.isSame(a[i],b[i])){
      ll preva=uf.size(a[i]);
      ll prevb=uf.size(b[i]);
      uf.connect(a[i],b[i]);
      ll nowa=uf.size(a[i]);
      ans[i-1]=ans[i]+(preva*(preva-1)/2+prevb*(prevb-1)/2)-nowa*(nowa-1)/2;
    }else{
      ans[i-1]=ans[i];
    }
  }
  rep(i,m){
    cout<<ans[i]<<endl;
  }
}

Measured memory_bytes: 4480
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = 0;
		String b = "Good";
		String a = sc.nextLine();
		String[] ar = a.split("");
		String c = "";
		String d = "";
		for(int i = 0 ; i < 3 ; i++) {
			n = i+1;
			c = ar[i];
			d = ar[n];
			if(c.equals(d)) {
				b = "Bad";
			}
		}
		System.out.println(b);
	}
}


Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
int n,q;
vector<int> edge[200010];
int f[200010];
bool book[200010];
int ans[200010];
void solve(int x,int tot)
{
    if(book[x]) return;
    book[x]=1;
    tot+=f[x];
    ans[x]=tot;
    for(vector<int>::iterator it=edge[x].begin();it!=edge[x].end();it++)
    solve(*it,tot);
}
int main()
{
    scanf("%d%d",&n,&q);
    for(int i=1;i<n;i++)
    {
    	int x,y;
    	scanf("%d%d",&x,&y);
    	edge[x].push_back(y);
    	edge[y].push_back(x);
    }
    for(int i=1;i<=q;i++)
    {
    	int x,y;
    	scanf("%d%d",&x,&y);
    	f[x]+=y;
    }
    solve(1,0);
    for(int i=1;i<=n;i++) printf("%d ",ans[i]);
    }

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

int main() {
  int N, N2, s, x;
  cin >> N;
  N2 = N;
  
  for (int i = 0; i < 9; i++) {
    s += N % 10;
    N /= 10;
    //cout << s << endl;
  }
  
  x = N2 % s;
  
  if (x == 0) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys,collections,itertools,re,math,fractions,decimal,random,array,bisect,heapq

# decimal.getcontext().prec = 50
# sys.setrecursionlimit(10000)
# MOD = 10**9 + 7

def solve(f):
    n, m = f.read_int_list()
    g = {}
    for i in xrange(1, n+1):
        g[i] = set(range(1, n+1))
        g[i].remove(i)
    for _ in xrange(m):
        a, b = f.read_int_list()
        g[a].remove(b)
        g[b].remove(a)

    c = [0]*(n+1)

    def dfs(v, ci):
        if c[v] == ci: return True
        if c[v] != 0 and c[v] != ci: return False
        c[v] = ci
        res = True
        for vi in g[v]:
            res &= dfs(vi, -ci)
        return res

    for i in xrange(1, n+1):
        if c[i] == 0:
            res = dfs(i, i)
            if not res: return -1

    cnt = collections.Counter(c[1:])
    grp = []
    for i in xrange(1,n+1):
        if cnt[i] > 0 or cnt[-i] > 0:
            grp.append((cnt[i], cnt[-i]))

    dp = [False] * (n+1)
    dp[0] = True
    for i,j in grp:
        dp2 = dp[:]
        for k in xrange(n+1):
            if dp[k]:
                dp2[k+i] = True
                dp2[k+j] = True
                if i > 0 and j > 0: dp2[k] = False
        dp = dp2

    ans = float('inf')
    for i in xrange(n+1):
        if dp[i]: ans = min(ans, i*(i-1)/2+(n-i)*(n-i-1)/2)

    return ans


class Reader(object):
    def __init__(self, filename=None):
        self.file = open(filename) if filename is not None else None
        self.case = 1

    def __readline(self):
        return self.file.next().strip() if self.file else raw_input()

    def next_case(self):
        self.file.next()
        self.case += 1

    def read_int(self): return int(self.__readline())
    def read_float(self): return float(self.__readline())
    def read_long(self): return long(self.__readline())
    def read_decimal(self): return decimal.Decimal(self.__readline())
    def read_str(self): return self.__readline()

    def read_int_list(self): return map(int, self.__readline().split())
    def read_float_list(self): return map(float, self.__readline().split())
    def read_long_list(self): return map(long, self.__readline().split())
    def read_decimal_list(self): return map(decimal.Decimal, self.__readline().split())
    def read_str_list(self): return self.__readline().split()

if __name__ == '__main__':
    filename = sys.argv[1] if len(sys.argv) > 1 else None
    f = Reader(filename)
    if f.file:
        while True:
            print "Case #%d\n"%f.case, solve(f)
            try:
                f.next_case()
            except StopIteration:
                break
    else:
        print solve(f)


Measured memory_bytes: 35100
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <set> 
#include <map>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstring>
#include <iomanip>
#define REP(i,n) for(int i=0; i<(n); ++i)
#define FOR(i,a,b) for(int i=(a); i<(b); ++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 100100100;
const ll INFLL = 100100100100100100;
const int MOD = (int)1e9 + 7;
const ll MODLL = (ll)1e9 + 7;
const double EPS = 1e-9;
 
int main () {
    
    int n,x; cin >>n>>x;
    vector<int> l(n); REP(i,n) cin >> l[i];

    vector<int> d(n+1, 0);
    for (int i = 0; i < n; i++) {
        d[i+1] = d[i] + l[i];
    }

    int ans = 0;
    for (int i = 0; i < n+1; i++) {
        if (d[i] <= x) {
            ans++;
        } 
    }
    
    cout << ans << endl;
    return 0;
}


 

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

#define BR "\n"
#define SP " "
#define SHOW(x) for(int i = 0; i < x.size(); i++) { cout << x[i] << SP; } cout << BR;
#define SHOW2(x) for(int j = 0; j < x.size(); j++) { SHOW(x[j]); } cout << BR;

int main() {
  ll N, M;
  cin >> N >> M;

  vector<ll> a(M, 0);
  for (int i = 0; i < N; i++) {
    ll K;
    cin >> K;

    for (int j = 0; j < K; j++) {
        ll temp;
        cin >> temp;
        a[temp-1]++;
    }
  }

  ll ans = 0;
  for (int i = 0; i < M; i++) {
      if (a[i] == N) ans++;
  }

  cout << ans << "\n";
  return 0;
}

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

using namespace std;

#define ALL(x) (x).begin(), (x).end()
#define ALLTRUE(xs) all_of(ALL(xs),[](bool x){return x;})
#define AND(x,y,z) set_intersection((x).begin(),(x).end(),(y).begin(),(y).end(),inserter((z),(z).end()))
#define ANYTRUE(xs) any_of(ALL(xs),[](bool x){return x;})
#define CONCAT(x,y) (x).insert((x).end(),(y).begin(),(y).end())
#define DUMP(xs) for (auto x:xs) cout<<x<<' ';cout<<endl
#define DUMPP(xs) for (auto x:xs) cout<<'('<<x.first<<','<<x.second<<')';cout<<endl
#define FOR(i,a,b) for (int i=(int)(a);i<(int)(b);++i)
#define OR(x,y,z) set_union((x).begin(),(x).end(),(y).begin(),(y).end(),inserter((z),(z).end()))
#define OUT(x) cout<<x<<endl
#define REP(i,n) FOR(i,0,n)

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

struct edge { int to,cost; };

int main() {
  ll X,Y,Z,K;cin>>X>>Y>>Z>>K;
  vector<ll> AS(X),BS(Y),CS(Z);
  // 組み合わせ
  REP(i,X) cin>>AS[i];
  REP(i,Y) cin>>BS[i];
  REP(i,Z) cin>>CS[i];

  // X*Y*ZがKと同じなら全部
  if (X*Y*Z==K) {
    vector<ll> res;
    REP(x,X)REP(y,Y)REP(z,Z) {
      res.push_back(AS[x]+BS[y]+CS[z]);
    }
    sort(ALL(res),greater<ll>());
    REP(i,K) {
      OUT(res[i]);
    }
    return 0;
  }

  // 以下はX*Y*Z>K
  sort(ALL(AS),greater<ll>());
  sort(ALL(BS),greater<ll>());
  sort(ALL(CS),greater<ll>());

  // XとYの組み合わせの最大Kまで
  vector<ll> XY;
  REP(x,X)REP(y,Y) XY.push_back(AS[x]+BS[y]);
  sort(ALL(XY),greater<ll>());
  vector<ll> XYtop(XY.begin(),XY.begin()+K);

  vector<ll> res;
  REP(z,Z)REP(xy,XYtop.size()) res.push_back(CS[z]+XYtop[xy]);
  sort(ALL(res),greater<ll>());
  REP(i,K) {
    OUT(res[i]);
  }

  return 0;
}

Measured memory_bytes: 43240
#include<stdio.h>
int main()
{
	int a,b,x,y,z;
	scanf("%d %d",&a,&b);
	x=a+b;
	y=a-b;
	z=a*b;
	if(x>=y&&x>=z){
		printf("%d\n",x);
	}
	if(y>x&&y>z){
		printf("%d\n",y);
	}
	if(z>x&&z>y){
		printf("%d\n",z);
	}
	return 0;
}


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

#define FastIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define rep(i,a,b) for(int i=a; i<b; i++)
#define ll long long
#define pb push_back
#define inf 1e+18L
#define MOD 1000000007

int main()
{
    FastIO 
    int n, m;
    cin >> n >> m;
    vector<int> a(n);
    int totalVotes = 0;
    rep(i,0,n)
    {
        cin >> a[i];
        totalVotes += a[i];
    }
    sort(a.begin(), a.end());
    int min_val;
    if(totalVotes%(4*m) == 0) min_val = totalVotes/(4*m);
    else min_val = totalVotes/(4*m) + 1;
    int i = lower_bound(a.begin(), a.end(), min_val) - a.begin();
    if(i != a.size())
    {
        if(n - i >= m) cout << "Yes\n";
        else cout << "No\n";
    }
    else cout << "No\n";
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n;
  string ans = "No";
  cin >> n;

  //２重ループ文
  for (int a = 1; a <= 9; ++a) {
    for(int b = 1; b <= 9; ++b){
      if (n == a * b){
        ans = "Yes";
        break;
      }
    }
  }

  cout << ans << endl;
}


Measured memory_bytes: 256
#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>;
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
int main() {
  // 無限大の値
const long long INF = 1LL << 60;

// DP テーブル
long long dp[100010];

// DP テーブル全体を初期化 (最小化問題なので INF に初期化)
for (int i = 0; i < 100010; ++i) dp[i] = INF;

// 初期条件
dp[0] = 0;

int n;cin>>n;

int H[n];

rep(i,n){
    cin>>H[i];
}

// ループ
for (int i = 0; i < n; ++i) {
    if(i>0) chmin(dp[i], dp[i-1] + abs(H[i]-H[i-1]));
    if(i>1) chmin(dp[i], dp[i-2] + abs(H[i]-H[i-2]));
}
// 解を得て出力
cout << dp[n-1] << endl;
}

Measured memory_bytes: 4792
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<iostream>
#include<fstream>
#include<iomanip>
#include<cstdio>
#include<string>
#include<cstring>
#include<climits>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<deque>
#include<tuple>
#include<list>
#include<unordered_map>
#include<unordered_set>
#include<random>
#include<functional>
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pp pair<pair<ll, ll>,pair<ll, ll>>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define vii vector<int>
#define vll vector<ll>
#define mat vector<vector<ll>>
#define lb lower_bound
#define pb push_back
#define mp make_pair
#define fi first
#define sc second
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define LB(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define UB(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
#define ERASE(v) v.erase(unique(v.begin(),v.end()),v.end())
// #define int ll
using namespace std;
const ll INF = (1 << 30 ) - 1;
const ll LLINF = (1LL << 60LL);
const ll MOD = 1000000007;
const ll mod = 998244353;
const ll MAX = 1100000;
const double pi = acos(-1);
const double eps = 1e-10;
ll dx[4] ={1,0,-1,0} , dy[4] ={0,1,0,-1};


signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    string s;
    cin>>s;
    ll ans=0;
    rep(i,s.size()-1){
        if(s[i]=='B'&&s[i+1]=='W') ans++;
        else if(s[i]=='W'&&s[i+1]=='B') ans++;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 512
S = gets.chomp
s = S.length.even? ? S : S.chop

(1..Float::INFINITY).each do |i|
  t = s.dup
  (i * 2).times { t.chop! }
  if t[0,t.length/2] == t[(t.length/2)..-1]
    p S.length - (i * 2)
    exit
  end
end


Measured memory_bytes: 1788
W,H,N=map(int, input().split())
 
X=[]
Y=[]
A=[]
for i in range(N):
    x,y,a=map(int, input().split())
    X.append(x)
    Y.append(y)
    A.append(a)
 
T=W*H
Ws=0
Hs=0
Wh=W
Hh=H
for i in range(N):
    if A[i]==1:
        if X[i]-Ws>=0:
            T-=(X[i]-Ws)*(Hh-Hs)
            Ws=X[i]
    elif A[i]==2:
        if Wh-X[i]>=0:
            T-=(Wh-X[i])*(Hh-Hs)
            Wh=X[i]
    elif A[i]==3:
        if Y[i]-Hs>=0:
            T-=(Y[i]-Hs)*(Wh-Ws)
            Hs=Y[i]
    elif A[i]==4:
        if Hh-Y[i]>=0:
            T-=(Hh-Y[i])*(Wh-Ws)
            Hh=Y[i]
    if T<=0:
        T=0
        break
 
print(T)

Measured memory_bytes: 3064
import sys
N = int(input())
a = [int(x) for x in input().split()]
b = []
for i in reversed(range(int(N/2))):
    b = i
    stack = 0
    while b < N:
        stack += a[b]
        stack %= 2
        b += i+1
    a[i] = stack
c = sum(a)
if c == 0:
    print(c)
    sys.exit()
print(c)
for j in range(N):
    if a[j] == 1:
        print(j+1, end=" ")
print()

Measured memory_bytes: 7276
#include<bits/stdc++.h>
using namespace std;
using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
using pqueg = priority_queue<int, vector<int>, greater<int>>;
using pquel = priority_queue<int, vector<int>, less<int>>;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
int lcm(int a, int b){
  return a / __gcd(a, b) * b;
}
int r_int(int a, int b){
  return rand() % b + a;
}
const lint mod=1e9+7;



int main()
{
  int n, k;
  cin >> n >> k;
  set<int> sunuke;
  REP(i,k){
    int d;
    cin >> d;
    REP(j,d){
      int tmp;
      cin >> tmp;
      sunuke.insert(tmp);
    }
  }

  cout << n-sunuke.size() << "\n";
  return 0;
}


Measured memory_bytes: 3640
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <functional>
#include <queue>
#include <set>
#include <map>
#include <numeric>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cctype>

#define rep(i, a) REP(i, 0, a)
#define REP(i, a, b) for(int i = a; i < b; ++i)
#define repll(i, a) REPLL(i, 0, a)
#define REPLL(i, a, b) for(ll i = a; i < b; ++i)

typedef long long ll;
typedef unsigned long long ull;
typedef std::pair<int, int> P;
typedef std::pair<P, int> PP;
const double PI = 3.14159265358979323846;
const double esp = 1e-9;
const int infi = (int)1e+9 + 10;
const ll infll = (ll)1e+17 + 10;

int n;
std::map<int, int> ind;
int dat[101], s[101], e[101];
int calc[105];

int main(){
	while (std::cin >> n, n){
		ind.clear();
		memset(dat, 0, sizeof(dat));
		memset(s, 0, sizeof(s));
		memset(e, 0, sizeof(e));
		memset(calc, 0, sizeof(calc));
		rep(i, n){
			std::cin >> dat[i] >> s[i] >> e[i];
			ind[s[i]] = 0;
			ind[e[i]] = 0;
		}

		int cnt = 0;
		for (auto it = ind.begin(); it != ind.end(); ++it){
			it->second = cnt;
			++cnt;
		}

		rep(i, n){
			calc[ind[s[i]]] += dat[i];
			calc[ind[e[i]]] -= dat[i];
		}

		bool flg = true;
		rep(i, ind.size()){
			if (i != 0)calc[i] += calc[i - 1];
			if (calc[i] > 150)flg = false;
		}
		std::cout << (flg ? "OK" : "NG") << std::endl;
	}
	return 0;
}

Measured memory_bytes: 1196
import Data.List
import Data.Maybe

find_last f xs
    | i /= Nothing = find_last f $ drop (fromJust i + 1) xs
    | i == Nothing = length xs
    where
        i = findIndex f xs

main = do
    s <- getLine
    print $ length s - (find_last (\x -> x == 'Z') s) - fromJust (findIndex (\x -> x == 'A') s)

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

using namespace std;

typedef pair< long long, long long > P;
typedef pair< long long, P > PP;
typedef pair< P, P > PPP;

const long long MOD = 1e9 + 7;
const long long  INF = 5e18;
const double DINF = 5e14;
const double eps = 1e-10;
const int di[4] = { 1,0,-1,0 }, dj[4] = { 0,1,0,-1 };

#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define pb push_back
#define eb emplace_back
#define fr first
#define sc second

int n, k[10010];


int main() {
	while (true) {
		cin >> n;
		if (!n)break;
		bool fl = false;
		int ans = 0;
		for (int i = 0;i < n;i++) {
			cin >> k[i];
			if (k[i] > 1)fl = true;
		}
		if (!fl) {
			cout << "NA" << endl;
			continue;
		}
		for (int i = 0;i < n;i++) {
			if (k[i])ans++;
		}
		cout << ans + 1 << endl;
	}
	return 0;
}




Measured memory_bytes: 3144
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSR(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
int n,x[105],y[105],h[105];
int main(){
	cin>>n;
	rep(i,n) cin>>x[i]>>y[i]>>h[i];
	rep(a,101) rep(b,101){
		vector<P>vec;
		ll ans = -1;
		rep(c,n){
			vec.pb(mp(h[c],abs(x[c]-a)+abs(y[c]-b)));
			if(h[c]) ans = h[c]+abs(x[c]-a)+abs(y[c]-b);
		}
		if(ans == -1) continue;
		rep(c,n){
			int val = max(0LL,ans-vec[c].sc);
			if(val != vec[c].fi) goto fail;
		}
		printf("%d %d %d\n",a,b,ans);
		return 0;
		fail:;
	}
	rep(a,101) rep(b,101) rep(H,305){
		vector<P>vec;
		rep(c,n){
			int val = max(0,H-(abs(x[c]-a)+abs(y[c]-b)));
			if(val != h[c]) goto fail2;
		}
		printf("%d %d %d\n",a,b,H);
		return 0;
		fail2:;
	}
}

Measured memory_bytes: 256
import java.util.*;

public class Main{
    int[] parent;
    int[] size;

    void solve(){
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int m = scan.nextInt();
        parent = new int[n];
        size = new int[n];
        for(int i = 0; i < n; i++){
            parent[i] = i;
            size[i] = 1;
        }
        for(int i = 0; i < m; i++){
            int a = scan.nextInt() - 1;
            int b = scan.nextInt() - 1;
            unite(a, b);
        }
        int out = -1;
        for(int i = 0; i < n; i++) out = Math.max(out, size[i]);
        System.out.println(out);
    }

    int root(int x){
        if(parent[x] == x) return x;
        return parent[x] = root(parent[x]);
    }

    boolean same(int x, int y){
        return root(x) == root(y);
    }

    void unite(int x, int y){
        x = root(x);
        y = root(y);
        if(x == y) return;
        if(size[x] < size[y]){
            parent[y] = x;
            size[x] += size[y];
        }else{
            parent[x] = y;
            size[y] += size[x];
        }

    }


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


Measured memory_bytes: 61572
#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>
#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>
#define endl "\n"
using namespace std;
using ll = long long;
using bnum = int64_t;
ll pi= static_cast<ll>(3.1415926535897932384626433l);

int main(){
    vector<ll> s(3);
    for(int i = 0;i<3;++i){
        cin >> s[i];
    }sort(s.begin(),s.end());
    ll d = floor(s.at(2) / 2);;
    cout << ((s.at(2) - d) * s.at(1) * s.at(0)) - (d * s.at(1) * s.at(0)) << endl;
}


Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N = 1e6 + 10;
#define fi first
#define se second
#define pb push_back
#define wzh(x) cerr<<#x<<'='<<x<<endl;
int n,a[N];
int vis[N],can[N];
int main() {
  ios::sync_with_stdio(false);
  cin>>n;
  for(int i=1;i<=n;i++)cin>>a[i],vis[a[i]]++;
  for(int i=1;i<=1000000;i++)if(vis[i]){
    for(int j=vis[i]==1?2*i:i;j<=1000000;j+=i){
      can[j]=1;
    }
  }
  int ans=0;
  for(int i=1;i<=n;i++){
    ans+=can[a[i]]^1;
  }
  cout<<ans<<'\n';
  return 0;
}

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

int main() {
  int N,count,min;
  cin >> N;
  vector<int> a(N);
  for(int i=0;i<N;i++)
    cin >> a.at(i);
  min = 1024;
  for(int i=0;i<N;i++){
    count=0;

    while(a.at(i)%2==0){
      a.at(i)=a.at(i)/2;
      count++;
    }
    if(min>count){
      min=count;
    }
    count=0;
  }
  cout << min << endl;
}

Measured memory_bytes: 384
main = do
    a <- readLn :: IO Integer
    b <- readLn :: IO Integer
    c <- readLn :: IO Integer
    d <- readLn :: IO Integer
    e <- readLn :: IO Integer
    k <- readLn :: IO Integer
    let ls = [ b - a
               , c - a
               , d - a
               , e - a
               , c - b
               , d - b
               , e - b
               , d - c
               , e - c
               , e - d
               ]
    if all (distance k) ls
    then putStr "Yay!"
    else putStr ":("
    
distance k d =
    if abs d <= k
    then True
    else False


Measured memory_bytes: 508
#include <bits/stdc++.h>
#include <unordered_set>
using namespace std;
#define ll long long
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repeat(i,s,n) for(int (i)=s; (i)<(n); (i)++)
#define revrep(i,n) for(int (i)=(n)-1;i>=0; i--)

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<setprecision(std::numeric_limits<float>::max_digits10);
  ll a,b;
  cin>>a>>b;
  if(a*b<=0) {
    cout << "Zero" << endl;
  } else {
    if(b>0) {
      cout << "Positive" << endl;
    } else {
      if((b-a+1)%2==0) {
        cout << "Positive" << endl;
      } else {
        cout << "Negative" << endl;
      }
    }
  }
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <array>

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

    long int n;

    while (std::cin >> n, n) {
        long int age;
        std::array<long int, 7> arr{{}};

        while (n--) {
            std::cin >> age;
            age < 70 ? ++arr[age / 10] : ++arr[6];
        }
        
        for (const auto& cnt : arr) {
            std::cout << cnt << '\n';
        }
    }

    return 0;
}

Measured memory_bytes: 1196
#include<stdio.h>
int main()
{
    long long int a,b,x,c,d,e,f,m,i,gcd,lcm;
    scanf("%lld%lld%lld%lld",&a,&b,&c,&d);
    e=(int)c;
    f=(int)d;
    if(e>=f)
    {
        m=f;
    }
    else
    {
        m=e;
    }
    while(e!=0&&f!=0)
    {
        gcd=f;
        f=e%f;
        e=gcd;
    }
    lcm=(c*d)/gcd;
    x=b/c+b/d-b/lcm-(a-1)/c-(a-1)/d+(a-1)/lcm;
    printf("%lld",(b-a+1-x));
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define ull unsigned long long
#define ll long long
#define INF 0x3f3f3f3f
using namespace std;
void close(){
       std::ios::sync_with_stdio(false);
       std::cin.tie(0);
}
int n,m,x[55];
vector<pair<int,int>> v[55];
ll dp[1<<20];
bool dfs(int a,int b,int c,int d){
	if(a==c) return 1;
	for(auto &i:v[a]){
		if(i.first!=b && dfs(i.first,a,c,d)){
			x[i.second]^=1<<d;
			return 1;
		}
	}
	return 0;
}
int main(){
	close();
	cin>>n;
	int a,b;
	for(int i=1;i<n;i++){
		
		cin>>a>>b;
		v[a].emplace_back(b,i);
		v[b].emplace_back(a,i);
	}
	cin>>m;
	for(int i=0;i<m;i++){
		cin>>a>>b;
		dfs(a,0,b,i);
	}
	dp[0]=1;
	for(int i=1;i<n;i++){
		for(int j=(1<<m)-1;j>=0;j--){
			dp[j|x[i]]+=dp[j];
		}
	}
	cout<<dp[(1<<m)-1]<<endl;
}

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

int main() {
  string S;
  cin>>S;
  int N=700;
  if(S.at(0)=='o')
    N+=100;
  if(S.at(1)=='o')
    N+=100;
  if(S.at(2)=='o')
    N+=100;
  cout<<N<<endl;
}

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

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)n; ++i)
#define FOR(i, a, b) for(int i = a; i < (int)b; ++i)
#define rrep(i, n) for(int i = ((int)n - 1); i >= 0; --i)

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

const int Inf = 1e9;
const double EPS = 1e-9;
const int MOD = 1e9 + 7;
const int n = 1e7;

template <typename T>
T gcd(T a, T b) {
    if (b == 0) {
        return a;
    } else {
        return gcd(b, a % b);
    }
}

vector<pair<ll, int> > primeFactorize(ll n) {
  vector<pair<ll, int> > res;
  for (ll i = 2; i * i <= n; ++i) {
    if (n % i) continue;
    res.push_back(make_pair(i, 0));
    while (n % i == 0) {
      n /= i;
      res.back().second++;
    }
  }
  if (n != 1) res.push_back(make_pair(n, 1));
  return res;
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(0);
    ll a, b;
    cin >> a >> b;
    ll g = gcd(a, b);
    auto v = primeFactorize(g);
    cout << v.size() + 1 << endl;
    
    return 0;
}



Measured memory_bytes: 256
#include<cstdio>
//scanf,printfが使える//
#include<cstring>
//char型の配列で構成された文字列を操作するための様々な関数が使える//
int main(){
    char s[201],t[101],p[101];
    
    scanf("%s %s", s,p);
    //%sは文字列として代入// //%cは文字として代入//
    strcpy(t,s);
    //tにsをコピーする//
    strcat(s,t);
    //sにtを連結させる//
    
    if(strstr(s,p) == NULL) printf("No\n");
    //sからpを探す//
    else printf("Yes\n");
    
    return 0;
    
}


Measured memory_bytes: 2744
# coding: utf-8
# hello worldと表示する
#float型を許すな
#numpyはpythonで
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi,factorial
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7

n=I()//2
lis=LI()
lis1=[]
lis2=[]
for i in range(n):
    lis1.append(lis[2*i])
    lis2.append(lis[2*i+1])
x=Counter(lis1).most_common(2)
y=Counter(lis2).most_common(2)
#print(x)
#print(y)
if len(x)==1:
    x.append((0,0))
if len(y)==1:
    y.append((-1,0))
#print(x)
#print(y)
if x[0][0]!=y[0][0]:
    print(2*n-x[0][1]-y[0][1])
else:
    cands=[]
    #print(2*n-x[0][1]-y[1][]))
    if x[1][0]!=y[0][0]:
        cands.append(2*n-x[1][1]-y[0][1])
    if x[0][0]!=y[1][0]:
        cands.append(2*n-x[0][1]-y[1][1])
    if x[1][0]!=y[1][0]:
        cands.append(2*n-x[1][1]-y[1][1])
    print(min(cands))
    
            
    
    

Measured memory_bytes: 99616
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int k = sc.nextInt();
        int a = sc.nextInt();
        int b = sc.nextInt();
        boolean flg = false;
        for (int i = a; i <= b; i++) {
            if ((i % k) == 0) {
                flg = true;
                break;
            }
        }
        if (flg) {
            System.out.println("OK");
        } else {
            System.out.println("NG");
        }

        sc.close();
    }

}


Measured memory_bytes: 35620
#include<cstdio>
#include <iostream>
#include<sstream>
#include<fstream>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<complex>
#include <cstring>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<numeric>
#include<limits>
#include<climits>
#include<cfloat>
#include<functional>
#include<iterator>
#include <random>
#define inf  1000000000
#define mod  1073741824
#pragma GCC optimization ("O3")
using namespace std;
const long long int N = 6999999;
#define all(x) begin(x),end(x)
int main()
{
   
    // freopen("input.txt","r",stdin);
    // freopen("output.txt","w",stdout);
    //ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
  	int n,r;
    cin >> n >> r;
    if(n >= 10)
      cout << r;
    else
    {
      cout << r+100*(10-n);
    }
  	return 0;
}	

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

int main(void) {
    int N,a;
    int cnt = 0;
    cin >> N;
    map<int,int> mp;
    for(int i=0;i<N;i++) {
        cin >> a;
        mp[a]++;
    }

    for(auto m:mp) {
        if(m.second > m.first) {
            cnt += m.second - m.first;
        } else if(m.second < m.first) {
            cnt += m.second;
        }
    }

    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 4736
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>

/* define*/
#define Yes(X) puts ( X ? "Yes" : "No")
#define YES(X) puts ( X ? "YES" : "NO")
#define FOR(i, a, b) for ( i = a; i < b ; i++)
#define REP(i, n) for ( i = 0; i < n ; i++)
#define DER(i, n) for ( i = n; n ; i--)
#define max(a, b) (((a) > (b)) ? (a) : (b))
#define min(a, b) (((a) < (b)) ? (a) : (b))
#define max3(a, b, c) ((max((a), (b)) > (c)) ? max((a), (b)) : (c))
#define min3(a, b, c) ((min((a), (b)) < (c)) ? min((a), (b)) : (c))

/* const */
const int MOD = 1e9 + 7;

/* alias */
typedef long long ll;

/* function */
int cmp(const void *a, const void *b) {
	return *(int*)a - *(int*)b;
}
int cmp2(const void *a, const void *b) {
	return *(int*)b - *(int*)a;
}

/* main */
int i, j, k;

int main() {
	int sx, sy, tx, ty, x, y;
	scanf("%d%d%d%d", &sx, &sy, &tx, &ty);
	x = tx - sx;
	y = ty - sy;
	REP(i, x) printf("R");
	REP(i, y + 1) printf("U");
	REP(i, x + 1) printf("L");
	REP(i, y + 1) printf("D");
	printf("R");
	//2nd
	REP(i, y) printf("U");
	REP(i, x + 1) printf("R");
	REP(i, y + 1) printf("D");
	REP(i, x + 1) printf("L");
	printf("U");	
	return 0;
}

Measured memory_bytes: 128
s=input()
a='YES'
while len(s)!=0:
  if s[len(s)-5:len(s)]=='dream' or s[len(s)-5:len(s)]=='erase':
    s=s[0:len(s)-5]
  elif s[len(s)-7:len(s)]=='dreamer':
    s=s[0:len(s)-7]
  elif s[len(s)-6:len(s)]=='eraser':
    s=s[0:len(s)-6]
  else:
    a='NO'
    break
print(a)

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

using namespace std;

typedef long long ll;

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

    int n;
    cin >> n;

    vector<ll> data(1 << n);
    for(int i = 0; i < (1 << n); ++i)
        cin >> data[i];

    ll f, s, best = 0;
    for(int msk = 1; msk < (1 << n); ++msk){
        f = 0, s = -1;
        for(int sub = msk; sub > 0; sub = msk & (sub - 1)){
            if(data[sub] > data[f]){
                s = f;
                f = sub;
                continue;
            }
            if(s == -1 || (sub != f && data[sub] > data[s]))
                s = sub;
        }
        best = max(best, data[f] + data[s]);
        cout << best << "\n";
    }

    return 0;
}//RUL0

Measured memory_bytes: 5248
import java.util.*;

public class Main {
  public static void main(String[] args ) throws Exception {
    Scanner sc = new Scanner(System.in);
    double A = sc.nextDouble();
    int count=0; 
    double B=0;
    for(int i=1;i<=A;i++){
    	if(i%2==1){
        	count++;
        }
    }
    B=count/A;
    System.out.println(B);
  }
}

Measured memory_bytes: 25172
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define FORD(i,a,b) for(int i=a;i>=b;i--)
#define REP(i,n) FOR(i,0,n)
#define pb push_back
#define en "\n"
#define LL long long
#define ITER(i,a) for( typeof(a.begin()) i=a.begin();i!=a.end();i++)
#define mod 1000000007
#define mpp make_pair
#define mes(a,b) memset((a),(b),sizeof((a))
typedef map<int,int> MI;
typedef pair<int,int>   PI;
typedef vector<int> VI;
int main() {
	// your code goes here
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    long long int n,ans=0,p,q;
    cin>>n;
    long long int a[n],b[n];
    for(long long int i=0;i<n;i++)
    cin>>a[i];
    b[0]=a[0];
    for(int i=1;i<n;i++)
    {
        b[i]=a[i]+b[i-1];
    }
    
    for(int i=0;i<n-1;i++)
    {
        p=a[i];
        q=(b[n-1]-b[i]);
        p=p%mod;
        q=q%mod;
        //cout<<p<<" "<<q<<en;
        p=(p*q)%mod;
        //cout<<p<<" ";
        ans=ans+p;
        //cout<<ans<<en;
        ans=ans%mod;
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 6768
x=int(input())
l=[2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313]
for i in range(1000):
    m=0
    for j in range(len(l)):
        if (x+i)%l[j]==0 and l[j]!=x+i:
            break
        elif l[j]==x+i:
            m=len(l)
            break
        else:
            m+=1
    if m==len(l):
        break
    else:
        continue
    
print(x+i)


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
using P = pair<int, int>;
const int M = 1000000007;


int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    int n, k, s, t;
    cin >> n >> k >> s >> t;
    if ((s | t) != t) {
        cout << 0 << '\n';
        return 0;
    }
    vector<int> a;
    for (int i = 0; i < n; ++i) {
        int aa;
        cin >> aa;
        if ((aa & s) == s && (aa | t) == t) {
            a.push_back(aa);
        }
    }
    n = a.size();
    k = min(n, k);
    vector<P> cond;
    for (int i = 0; i < 18; ++i) {
        if (((s >> i) & 1) == 0) {
            cond.push_back({ i, 0 });
        }
        if (((t >> i) & 1) == 1) {
            cond.push_back({ i, 1 });
        }
    }
    vector<unordered_map<long long, long long>> dp(k + 1);
    for (int i = 0; i <= k; ++i) {
        dp[i].reserve(1 << 20);
    }
    dp[0][0] = 1;
    for (int i = 0; i < n; ++i) {
        long long mask = 0;
        for (int j = 0; j < (int)cond.size(); ++j) {
            if (((a[i] >> cond[j].first) & 1) == cond[j].second) {
                mask ^= 1LL << j;
            }
        }
        for (int j = k - 1; j >= 0; --j) {
            for (auto& l : dp[j]) {
                dp[j + 1][l.first | mask] += l.second;
            }
        }
    }
    long long ans = 0;
    for (auto& i : dp) {
        ans += i[(1LL << (int)cond.size()) - 1];
    }

    cout << ans << '\n';

    return 0;
}


Measured memory_bytes: 491128
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <functional>
#include <map>
#define REP(i,n) for(int (i)=0; (i)<(n); (i)++)
using namespace std;
using ll = long long;
const ll MOD = 1e9+7;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int n;
  cin >> n;
  vector<int> d(n);
  REP(i,n){
    cin >> d[i];
  }
  sort(d.begin(), d.end());
  int l = d[n/2-1];
  int r = d[n/2];
  //cout << l << "," << r << endl;
  if(l==r){
    cout << 0 << endl;
  }else{
    cout << r-l << endl;
  }
  return 0;
} 


Measured memory_bytes: 640
// Confessions of a Dangerous Mind

/*
	"We know what we are, but know not what we may be."
*/

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

const int N = 2e5 + 3;
const int M = 1e6 + 7;
const long long MOD = 1e9 + 7;
const long long INF = 1e18 + 9;
const int SM = 1e3 + 5;
const int logN = 20, BL = 400;
const double EPS = 3e-16;

/*
	"You never know how strong you are until being strong is the only choice you have."
*/

int main(){
//  freopen(".in", "r", stdin);
//  freopen(".out", "w", stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);

/*
	"With self-discipline most anything is possible."
*/	
	
	long long n, m; cin >> n >> m;

	if(n == 1 || m == 1) cout << 1;
	else cout << (n * m + 1) / 2;

	return 0;
}

/*
	"Reach for it. Push yourself as far as you can."
*/

Measured memory_bytes: 256
import math

A, B = [int(x) for x in input().strip().split()]

lA = math.ceil(A / 0.08)
uA = (A + 1) / 0.08
if uA.is_integer():
    uA = int(uA) - 1
else:
    uA = int(uA)

lB = math.ceil(B / 0.1)
uB = (B + 1) / 0.1
if uB.is_integer():
    uB = int(uB) - 1
else:
    uB = int(uB)

if uA < lB or uB < lA:
    print(-1)
else:
    print(max(lA, lB))


Measured memory_bytes: 3064
#include <stdio.h>

int main() {
	int r, d, x[15];

	scanf("%d", &r);
	scanf("%d", &d);
	scanf("%d", &x[0]);

	for (int i = 0; i < 10; ++i) {
		x[i + 1] = r * x[i] - d;
		printf("%d\n", x[i+1]);
	}

}

Measured memory_bytes: 128
#include <iostream>
using namespace std;
int main(int argc, const char * argv[]) {
    int a, b, m;
    bool b1 = false;
    string s;
    //first question
    cin>> a>> b;
    b += 3*a;
    b = b/2;
    cout << b;
        
    return 0;
}

Measured memory_bytes: 256