akhauriyash/Code-Regression huggingface dataset:
// header {{{
#include <bits/stdc++.h>
#include <string>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <boost/foreach.hpp>
#include <vector>
#include <algorithm>
using namespace std;

#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x,y) x ## y

#define ASSERT(expr...) assert((expr))

using i8 = int8_t;
using u8 = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;

using f32 = float;
using f64 = double;
using f80 = __float80;
// }}}

constexpr i64 INF = 1'010'000'000'000'000'017LL;

constexpr i64 MOD = 1'000'000'007LL;

constexpr f64 EPS = 1e-12;

constexpr f64 PI = 3.14159265358979323846;

// util {{{
#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)

#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }

template<typename T, size_t N>
i64 SIZE(const T(&)[N]) { return static_cast<i64>(N); }

template<typename T, typename U, typename Comp = less<>>
bool chmax(T& xmax, const U& x, Comp comp = {}) {
	if (comp(xmax, x)) {
		xmax = x;
		return true;
	}
	return false;
}

template<typename T, typename U, typename Comp = less<>>
bool chmin(T& xmin, const U& x, Comp comp = {}) {
	if (comp(x, xmin)) {
		xmin = x;
		return true;
	}
	return false;
}
// }}}

// init {{{
struct ProconInit {
	static constexpr int IOS_PREC = 15;
	static constexpr bool AUTOFLUSH = false;

	ProconInit() {
		cin.tie(nullptr);
		ios::sync_with_stdio(false);
		cout << fixed << setprecision(IOS_PREC);
		if (AUTOFLUSH)
			cout << unitbuf;
	}
} PROCON_INIT;
// }}}

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

signed main() {


	i64 ans = 0;
	string ANS = "APPROVED";
	int B, C, N;
	std::vector<int> A;
	cin >> N;
	for (int i = 0; i < N; i++)
	{
		cin >> B;
		if ((B % 2) == 0 && !((B % 3) == 0 || (B % 5) == 0)) {
			ANS = "DENIED";
			break;
		}
	}

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


Measured memory_bytes: 256
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <cfloat>
#include <complex>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

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

int main() {
  string str;
  
  cin >> str;

  bool conda = (str[0] == str[1]) && (str[1] == str[2]);
  bool condb = (str[2] == str[3]) && (str[1] == str[2]);
  string ans = "No";
  if (conda || condb) ans = "Yes";
  
  cout << ans << endl;

  return 0;
}


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

using namespace std;

int main(){
	int n,t,A;
	cin>>n>>t>>A;
	double a[n];
	double mx=1e9,ans=0;
	for(int i=0;i<n;i++){
		cin>>a[i];
		double x=t-a[i]*0.006;
		if(abs(A-x)<mx){
			mx=abs(A-x);
			ans=i+1;
		}
	}
	cout<<ans;

}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		if (a % 2 == 0 || b % 2 == 0) {
			System.out.println("Even");
		} else {
			System.out.println("Odd");
		}
	}
}

Measured memory_bytes: 21844
#include<iostream>
#include<string>
#include<stack>

using namespace std;

typedef long long ll;

class MultiFirst{
    public: 

    string s;
    size_t i;
    MultiFirst(string s): s(s){}
    ll parse(){
        i = 0;
        return expr(&i);
    }

    private:

    ll num(size_t *i){
        return stoll(s.substr(*i, 1));
    }

    ll term(size_t *i){
        ll ret = num(i); (*i)++;
        while(*i < s.length() && s[*i] == '*'){
            (*i)++; // *
            ret *= num(i);
            (*i)++;
        }
        return ret;
    }

    ll expr(size_t *i){
        ll ret = term(i);
        while(*i < s.length() && s[*i] == '+'){
            (*i)++; // +
            ret += term(i);
        }
        return ret;
    }
};

class LeftToRight{
    public: 

    string s;
    size_t i;
    LeftToRight(string s): s(s){}
    ll parse(){
        stack<int> st;
        st.push(s[0]-'0');
        for(size_t i=1;i<s.length();i++){
            if(st.top() < 0){
                if('0' <= s[i] && s[i] <= '9'){
                    int op = st.top(); st.pop();
                    int a = st.top(); st.pop();
                    int b = s[i] - '0';
                    if(op == -1){
                        st.push(a+b);
                    }else{
                        st.push(a*b);
                    }
                }
            }else{
                if('0' <= s[i] && s[i] <= '9'){
                    st.push(s[i]-'0');
                }else if(s[i] == '+'){
                    st.push(-1);
                }else{
                    st.push(-2);
                }
            }
        }
        return st.top();
    }
};

int main(){
    string s;
    ll bob;
    cin >> s >> bob;

    ll m = MultiFirst(s).parse();
    ll l = LeftToRight(s).parse();

    if(bob == m){
        if(bob == l){
            cout << 'U' << endl;
        }else{
            cout << 'M' << endl;
        }
    }else{
        if(bob == l){
            cout << 'L' << endl;
        }else{
            cout << 'I' << endl;
        }
    }
}


Measured memory_bytes: 3228
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using VI = vector<int>;
using VL = vector<ll>;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);(i)++)
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);(i)++)
#define rFOR(i,a,n) for(int (i)=(n)-1;(i)>=(a);(i)--)
#define erFOR(i,a,n) for(int (i)=(n);(i)>=(a);(i)--)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
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; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }

int main() {
    init();

    int n;
    cin >> n;
    VL p(n), index(n);
    FOR(i, 0, n) {
        cin >> p[i];
        index[--p[i]] = i;
    }

    ll ans = 0;
    multiset<ll> set = { -1,-1,n,n };
    rFOR(i, 0, n) {
        set.insert(index[i]);
        auto b = --set.lower_bound(index[i]);
        auto d = set.upper_bound(index[i]);
        auto a = b, e = d;
        a--, e++;
        ll c = (*b - *a) * (*d - index[i]) + (index[i] - *b) * (*e - *d);
        ans += c * (i + 1LL);
    }
    cout << ans << "\n";
}


Measured memory_bytes: 6528
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<set>
#include<map>
#include<queue>
#define REP(i,a) for (int i = 0;i < (a);++i)
#define FOR(i,a,b) for (int i = (a);i < (b); ++i)
#define FORR(i,a,b) for (int i = (a);i >= (b); --i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SORT(list) sort(ALL((list)));
#define MOD 1000000007
using namespace std;
using ll = long long;
int main(){
    int n;
    string s;
    cin >> n >> s;
    if(n %2){
        cout << "No" << endl;
        return 0;
    }
    if(s.substr(0,n/2) == s.substr(n/2,n/2))
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int n,a;
int main(){
    ios::sync_with_stdio(false);
    cin >> n;
    for(int i=0;i<n;i++){
    	cin >> a;
    	if(a%2!=0){
    		cout << "first";
    		return 0;
		}
	}
	cout << "second";
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <queue>
typedef long long ll;

using namespace std;

const int N=1e5+5;


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
   int n,k=2;
   cin>>n;
   int arr[N]={},dp[N]={};
   for(int i=0;i<n;i++)
    cin>>arr[i];
   memset(dp,-1,sizeof(dp));
   dp[0]=0;
   for(int i=0;i<n;i++)
   {

     for(int j=1;j<=k;j++)
     {
         if(i-j>=0)
         {
             if(dp[i]==-1)
             {
                 dp[i]=dp[i-j]+abs(arr[i]-arr[i-j]);
             }
             else
             {
                 dp[i]=min(dp[i],dp[i-j]+abs(arr[i]-arr[i-j]));


             }


         }

     }




   }
   cout<<dp[n-1];

   return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
 
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n)  for(int i=0;i<(n);++i)
#define REPr(i, n) for(int i=(n)-1;i>=0; --i)
#define FORq(i, m, n) for(int i = (m);i <= (n);++i)
#define FORqr(i, m, n) for(int i = (n);i >=(m);--i)
#define PB push_back
#define MP make_pair
#define DEBUG printf("%s\n","debug")
#define fst first
#define snd second
#define SIN(x, S) (S.count(x) != 0)
#define M0(x) memset(x,0,sizeof(x))
#define FILL(x, y) memset(x,y,sizeof(x))
#define MM(x) memset(x,-1,sizeof(x))
#define ALL(x) (x).begin(),(x).end()
using namespace std;
typedef pair<int, int> PII;
typedef pair<long long, long long> PLL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<long long> VL;
typedef long long ll;
typedef long long integer;
///////////////////////////////////////////////
/* (๑╹◡╹) */
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll MOD = 1000000007;
template<class T>
inline bool chmin(T &a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
 /* (๑╹◡╹)(๑╹◡╹)(๑╹◡╹)*/
template<class T>
inline bool chmax(T &a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}
/* (๑╹◡╹)(๑╹◡╹)(๑╹◡╹)(๑╹◡╹)(๑╹◡╹)(๑╹◡╹) */
///////////////////////////////////////////////

int main() {
ll ans = 0;
	int n;
	cin >> n;
	vector<int> O; //奇数
	vector<int> E; //偶数
	rep(i,n)
	{
		int v; cin >> v;
		if(i%2 == 1) O.PB(v);
		else E.PB(v);
	}
	int m = n/2;
	vector<int> Oc(100002);
	vector<int> Ec(100002);
	rep(i,m){Oc.at(O.at(i)) ++;}
	rep(i,m){Ec.at(E.at(i)) ++;}
	vector<pair<int,int>> Op;
	vector<pair<int,int>> Ep;
	FOR(i,1,100000){Op.PB(MP(Oc.at(i),i));}
	FOR(i,1,100000){Ep.PB(MP(Ec.at(i),i));}
	sort(ALL(Op));reverse(ALL(Op));
	sort(ALL(Ep));reverse(ALL(Ep));
	int o = Op.at(0).first;
	int Oint = Op.at(0).second;
	int o0 = Op.at(1).first;
	int e = Ep.at(0).first;
	int Eint = Ep.at(0).second;
	int e0 = Ep.at(1).first;

	ans = n - o -e;
	if(Oint == Eint)ans = min(n-o0-e, n-o-e0);

	cout << ans << endl;

}

Measured memory_bytes: 3700
#include<stdio.h>
#define INF 1000000
void warshall_floyd(void);
int min(int,int);
int graph[101][101],n,c,d;

int main(void){
  int k,i,j,x,e,a,b;

  while(scanf("%d %d",&n,&k),n,k){

    for(i=0;i<=n;i++)
      for(j=0;j<=n;j++)
	graph[i][j]=(i==j?0:INF);

    for(i=0;i<k;i++){

      if(scanf("%d",&x),x){
	scanf("%d %d %d",&c,&d,&e);
	if(graph[c][d]>e){
	graph[c][d]=graph[d][c]=e;
	warshall_floyd();
	}
      }
      else{
	scanf("%d %d",&a,&b);
	if(graph[a][b]<INF)printf("%d\n",graph[a][b]);
	else printf("-1\n");
      }
    }
  }
  return 0;
}

void warshall_floyd(void){
  int i,j;
  
  for(i=1;i<=n;i++)
    for(j=1;j<=n;j++)
      graph[i][j]=graph[j][i]=min(graph[i][j],graph[i][c]+graph[c][d]+graph[d][j]);
}

int min(int x,int y){
  return (x<y)?x:y;
}

Measured memory_bytes: 460
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <queue>
#include <deque>
#include <list>
#include <map>
#include <set>
#include <cmath>
#include <cstring>
#include <string>
#include <bitset>
#include <fstream>
#include <iomanip>

using namespace std;

#define PB push_back
#define MP make_pair
#define X first
#define Y second
#define gcd __gcd

#define cil(a,b) ( ((a)%(b) == 0)?((a)/(b)):((a)/(b)+1) )
#define err(x) cerr << #x << " = " << x << endl;
#define read(a) freopen(a,"r",stdin)
#define write(a) freopen(a,"w",stdout)
#define forall(i,a,b) for(int i=a;i<b;i++)
#define foreach(v, c) for(typeof((c).begin())v=(c).begin();v!=(c).end();++v)

typedef long long ll;
typedef double db;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<double,double> pdd;
typedef vector<pii> vii;

clock_t start;
void Time(bool timeIt) {
	if (!timeIt) return;
	clock_t end = clock();
	double elapsed_time = ((db)end - (db)start) / (db)CLOCKS_PER_SEC;
	printf("Time elapsed = %0.4lf\n", elapsed_time); 
}

#define LINF (long long)1e18
#define EPS 1e-9
#define INF 1000000007ll
#define SIZE 100010
#define MAX_A 1000010

int main() {
	start = clock();
	int n, a, b;
	cin >> n >> a >> b;
	if (abs(a - b) % 2 == 0) cout << "Alice" << endl;
	else cout << "Borys" << endl;

	Time(false);
	return 0;
}

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

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

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

    unordered_map<long long, long long> mp;
    vector<long long> S(n + 1, 0);
    S[0] = 0;
    for(int i = 0; i < n; i++){
        S[i + 1] = S[i] + A[i];
    }

    for(int i = 0; i < n + 1; i++){
        mp[S[i]]++;
    }

    long long ans = 0;
    for(auto &x : mp){
        ans += x.second * (x.second - 1) / 2;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 10824
A,B,C = sorted(list(map(int, input().split())))


cnt = 0

while B < C:
	A += 1
	B += 1
	cnt += 1

if (B - A) % 2 == 0:
	cnt += (B-A) // 2
else:
	cnt += ((B-A) // 2 + 2)

print(cnt)

Measured memory_bytes: 3060
#include<bits/stdc++.h> //Ithea Myse Valgulious
namespace chtholly{
typedef long long ll;
#define re0 register int
#define rel register ll
#define rec register char
#define gc getchar
//#define gc() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<23,stdin),p1==p2)?-1:*p1++)
#define pc putchar
#define p32 pc(' ')
#define pl puts("")
/*By Citrus*/
char buf[1<<23],*p1=buf,*p2=buf;
inline int read(){
  int x=0,f=1;char c=gc();
  for (;!isdigit(c);c=gc()) f^=c=='-';
  for (;isdigit(c);c=gc()) x=(x<<3)+(x<<1)+(c^'0');
  return f?x:-x;
  }
template <typename mitsuha>
inline bool read(mitsuha &x){
  x=0;int f=1;char c=gc();
  for (;!isdigit(c)&&~c;c=gc()) f^=c=='-';
  if (!~c) return 0;
  for (;isdigit(c);c=gc()) x=(x<<3)+(x<<1)+(c^'0');
  return x=f?x:-x,1;
  }
template <typename mitsuha>
inline int write(mitsuha x){
  if (!x) return 0&pc(48);
  if (x<0) pc('-'),x=-x;
  int bit[20],i,p=0;
  for (;x;x/=10) bit[++p]=x%10;
  for (i=p;i;--i) pc(bit[i]+48);
  return 0;
  }
inline char fuhao(){
  char c=gc();
  for (;isspace(c);c=gc());
  return c;
  }
}using namespace chtholly;
using namespace std;
const int yuzu=2e5,mod=998244353;
typedef ll fuko[yuzu|10];
fuko rem[10],p10={1}; 
struct chtholly_tree{
  struct node{
    mutable int l,r,v;
    node(int nl,int nr=-1,int val=0):l(nl),r(nr),v(val) {}
    bool operator <(const node b) const {
      return l<b.l;
    } 
  };
  typedef set<node>::iterator it;
  set<node> s;
  ll yu;
  void insert(int l,int r,int v) {
    s.insert(node(l,r,v));
  }
  it split(int pos) {
    it p=s.lower_bound(pos);
    if (p!=s.end()&&p->l==pos) return p; --p;
    int l=p->l,r=p->r,v=p->v;
    s.erase(p);
    s.insert(node(l,pos-1,v));
    return s.insert(node(pos,r,v)).first;
  }
  void assign(int l,int r,int v,int n) {
    it p,itr=split(r+1),itl=split(l);
    for (p=itl;p!=itr;++p) 
      yu=(yu-rem[p->v][p->r-p->l+1]*p10[n-p->r]%mod+mod)%mod;
    s.erase(itl,itr);
    s.insert(node(l,r,v));
    yu=(yu+rem[v][r-l+1]*p10[n-r]%mod)%mod;
  } 
  void dfs() {
    for (auto p:s) {
      printf("%d %d %d\n",p.l,p.r,p.v);
    }
  }
}lxy;
int main() {
  int i,n,q,j;
  read(n),read(q);
  for (i=1;i<10;++i) {
    for (j=1;j<=yuzu;++j) 
      rem[i][j]=(rem[i][j-1]*10+i)%mod;
  }
  for (i=1;i<=yuzu;++i) p10[i]=p10[i-1]*10%mod;
  lxy.insert(1,n,1);
  lxy.yu=rem[1][n];
  for (int l,r,d;q--;) {
    read(l),read(r),read(d);
    lxy.assign(l,r,d,n);
    printf("%lld\n",lxy.yu);
  }
}

Measured memory_bytes: 31788
#include <iostream>
#include <vector>
using namespace std;
int main(){
  int n;
  cin >> n;
  int i;
  vector<int> a(n);
  for(i=0;i<n;i++) cin >> a[i];
  int cnt = 1;
  int cnt2 = 0;
  for(i=0;i<n;i++){
    if(a[i]==cnt) cnt++;
    else cnt2++;
  }
  if(cnt2==n) cnt2=-1;
  cout << cnt2 << "\n";
  return 0;
}


Measured memory_bytes: 1024
from sys import stdin
from collections import deque

num = int(input())

q = deque()

for i in range(num):

	cmd = stdin.readline().strip().split()

	if cmd[0] == "0":
		#末尾に挿入
		q.append(cmd[1])

	elif cmd[0] == "1":
		#要素の出力
		print(q[int(cmd[1])],sep='\n')
	else:
		#末尾の削除
		q.pop()




Measured memory_bytes: 20172
from __future__ import division, print_function

oo = 1000000000 + 5
N = 100000 + 5

def main():
    n = int(input())
    a = [int(_) for _ in input().split()]

    dp = [oo for _ in range(N)]
    dp[0] = 0
    for i in range(n):
        for j in (i + 1, i + 2):
            if (j < n):
                dp[j] = min(dp[j], dp[i] + fabs(a[i] - a[j]))

    print(int(dp[n - 1]))


# PyPy 2 Fast IO Template. Made by Pajenegod & C1729
py2 = round(0.5)
if py2:
    from future_builtins import ascii, filter, hex, map, oct, zip
    range = xrange

import os, sys
from io import IOBase, BytesIO

BUFSIZE = 8192
class FastIO(BytesIO):
    newlines = 0

    def __init__(self, file):
        self._file = file
        self._fd = file.fileno()
        self.writable = "x" in file.mode or "w" in file.mode
        self.write = super(FastIO, self).write if self.writable else None

    def _fill(self):
        s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
        self.seek((self.tell(), self.seek(0,2), super(FastIO, self).write(s))[0])
        return s

    def read(self):
        while self._fill(): pass
        return super(FastIO,self).read()

    def readline(self):
        while self.newlines == 0:
            s = self._fill(); self.newlines = s.count(b"\n") + (not s)
        self.newlines -= 1
        return super(FastIO, self).readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.getvalue())
            self.truncate(0), self.seek(0)

class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        if py2:
            self.write = self.buffer.write
            self.read = self.buffer.read
            self.readline = self.buffer.readline
        else:
            self.write = lambda s:self.buffer.write(s.encode('ascii'))
            self.read = lambda:self.buffer.read().decode('ascii')
            self.readline = lambda:self.buffer.readline().decode('ascii')

sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip('\r\n')

# Importing Modules
import math
import collections

from collections import Counter
from math import fabs

if __name__ == "__main__":
    # sys.stdin = open("../IO/in.txt", "r"); sys.stdout = open("../IO/out.txt", "w")
    main()

Measured memory_bytes: 11988
{-# LANGUAGE TupleSections #-}

main :: IO ()
main = do
    _ <- getLine
    xs <- getInts
    ys <- getInts
    print $ solve xs ys

solve :: [Int] -> [Int] -> Int
solve xs ys = (calc xs * calc ys) `mod` lim

calc :: [Int] -> Int
calc xs = getSum . foldMap (\(i,x) -> Sum $ (2*i-1-n)*x) $ zip [1..] xs
    where n = length xs

newtype Sum = Sum { getSum :: Int }

instance Monoid Sum where
    mempty = Sum 0
    mappend (Sum x) (Sum y) = Sum $ (x+y) `mod` lim

lim :: Int
lim = 7 + 10^9

getInts :: IO [Int]
getInts = map read . words <$> getLine


Measured memory_bytes: 142716
# coding: utf-8

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

N, M, C = read_ints()
B = read_ints()

correct = sum(
    sum(i * j for i, j in zip(read_ints(), B)) + C > 0 
    for k in range(N)
    )

print(correct)

Measured memory_bytes: 3060
#include <cstdio>
#include <algorithm>
using namespace std;
using Int = long long int;


const Int INF = 1LL << 30;
const int S = 100000;
Int N, H;
Int A[S+10], B[S+10];

int main() {
    scanf("%lld%lld", &N, &H);
    for(int i=0; i<N; i++) {
        scanf("%lld%lld", &A[i], &B[i]);
    }
    sort(A, A+N);
    sort(B, B+N);
    reverse(A, A+N);
    reverse(B, B+N);

    Int ub = INF, lb = -1;
    while(ub - lb > 1) {
        Int mid = (ub + lb) / 2;

        Int HP = H, rest = mid;
        for(int i=0; i<N && HP>0 && rest>0 && B[i] >= A[0]; i++, rest--) {
            HP -= B[i];
        }

        bool ok = (HP <= 0);
        if(!ok) {
            Int ope = (HP + A[0] - 1) / A[0];
            ok |= (ope <= rest);
        }

        (ok ? ub : lb) = mid;
    }

    printf("%lld\n", ub);
    return 0;
}

Measured memory_bytes: 1664
#include<stdio.h>
int main()
{
    int a,b;
    char op;
    while(1){
        scanf("%d %c %d",&a,&op,&b);
        if(op=='?'){
            break;
        }
        if(op=='+'){printf("%d\n",a+b);}
        if(op=='-'){printf("%d\n",a-b);}
        if(op=='*'){printf("%d\n",a*b);}
        if(op=='/'){printf("%d\n",a/b);}
    }
    return 0;
}


Measured memory_bytes: 2056
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<cstring>
using namespace std;

class dictionary {

private:
	string* hashtable;
	long long table_size;
	int coltimes; //?????????????????????
//	int el_num;
	long long hash1(long long);
	long long hash2(long long);
	long long str_n(string);
	int char_n(char);
public:
	dictionary(int n);
	void insert(string);
	bool find(string);
};
inline dictionary::dictionary(int n)
{
	hashtable= new string[n];
	if( !hashtable ){
		cout<<"Allocation Error"<<endl;
		abort();
	}

	table_size=n;
	coltimes=0;
//	el_num=0;
}
inline long long dictionary::hash1( long long key )
{
	return key % table_size;
}
inline long long dictionary::hash2( long long key )
{
	return 1 + ( key % (table_size - 1));
}

inline long long dictionary::str_n( string str )
{

/*
	long long str_n=0;

	for( unsigned int i=0; i<str.size(); i++ ){
		str_n = str_n * 5 + (long long)str[i] ; // str_n += (int)str[i] ?????????????????????????????????????????£???
	}
*/

	long long str_n=0;
	for( unsigned int i=0, p=1; i<str.size(); i++, p*=5 ){
		str_n += p * char_n(str[i]);
	}

	return str_n;
}
inline int dictionary::char_n( char c )
{
	switch(c){
	case 'A':
		return 1;
	case 'C':
		return 2;
	case 'G':
		return 3;
	case 'T':
		return 4;
	}
	return 0;
}

		

inline void dictionary::insert( string str )
{
/*
	if( el_num >= table_size ){
		cout<<"????????\????????????????????????"<<endl;
		abort();
	}
*/
/*
	long long hash_v;
	do{
		hash_v = ( hash1(str) + hash2(str)*coltimes )%table_size ;

//		printf("I ( hash1, hash2, hash )(coltimes) = ( %d, %d, %d)(%d)\n", hash1(str), hash2(str), hash_v, coltimes );

	}while( hashtable[ hash_v ].size() && hashtable[ hash_v ]!= str, coltimes++ );
	
	hashtable[ hash_v ] = str;
	coltimes=0;
	el_num++;
*/
	long long key=str_n(str), hash_v;

	for( ;; coltimes++ ){
		hash_v= (hash1(key) + hash2(key)*coltimes) % table_size;
		if( hashtable[ hash_v ] == str ){
			coltimes=0;
			return;
		}else if( !hashtable[ hash_v ].size() ){
			hashtable[ hash_v ]=str;
			coltimes=0;
			return;
		}
	}
}
inline bool dictionary::find( string str )
{
/*
	long long hash_v;
	do{
		
		hash_v = ( hash1(str) + hash2(str)*coltimes )%table_size ;
//		printf("F ( hash1, hash2, hash )(coltimes) = ( %d, %d, %d)(%d)\n", hash1(str), hash2(str), hash_v, coltimes );

		if( hashtable[ hash_v ] == str ){
			return true;
		}

		coltimes++;

	}while( hashtable[ hash_v ].size() &&  coltimes <= table_size);

	coltimes=0;

	return false;
*/
	long long hash_v, key=str_n(str);
	for( ;; coltimes++ ){
		hash_v=( hash1(key) + hash2(key)*coltimes )%table_size;
		if( hashtable[ hash_v ]==str ){
			coltimes=0;
			return true;
		}else if( !hashtable[ hash_v ].size() ){
			coltimes=0;
			return false;
		}
	}

}

int main()
{
	int n;
	scanf("%d", &n);
	char command[7], str[13];
	dictionary dic(1046527);

	for( int i=0; i<n; i++ ){
		scanf("%s %s", command, str);

		if( !strcmp(command, "insert") ){
			dic.insert(str);
		}else if ( !strcmp(command, "find") ){
			cout<<( dic.find(str)? "yes" : "no" )<<endl;
		}
	}
}

Measured memory_bytes: 22324
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int n,m,c=0,i;
    cin>>n>>m;
    for(i=0;i<n;i++)
    {
        long long int a,b,x;
        double y;
        cin>>a>>b;
        x=a*a + b*b;
        y=sqrt(x);
        if(y<=m)
            c++;
    }
    cout<<c;
}


Measured memory_bytes: 3624
n = int(input())

scores = sorted([int(input()) for i in range(0, n)])

def solve():
  total = sum(scores)
  if total % 10 == 0:
    for i in range(0, n):
      tmp = total- scores[i]
      if (tmp) % 10 != 0:
        print(tmp)
        return
    print(0)
    return

  print(total)
  return

def main():
  solve()

if __name__ == "__main__":
  main()

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using pint = pair<int,int>;
ll mod = 1000000007,mod2 = 998244353;

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

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 long long INF = 1LL<<60;
ll gcd(ll a,ll b){
    if(b == 0) return a;
    else return gcd(b,a%b);
}

bool is_prime[1000010];

int f[10010];

int main() {
    int l,r,d,ans = 0;
    cin >> l >> r >> d;
    for (int i = l;i <= r; ++i) {
        if(i%d == 0) ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3560
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define vi vector<int>
#define vii vector<int, int>
#define po pop_back
#define hell 1000000007
using namespace std;
 
void solve(){
	ll n;
	cin>>n;
	ll ans = n*(n+1)/2;
	ll t = n/3;
	ans -= ((3+3+(t-1)*3)*t)/2;
	t = n/5;
	ans -= ((5+5+(t-1)*5)*t)/2;
	t = n/15;
	ans += ((15+15+(t-1)*15)*t)/2;
	cout<<ans;
}
 
int main(){
	int t = 1;
	//cin>>t;
	while(t--){
		solve();
	}
}

Measured memory_bytes: 3592
#include "bits/stdc++.h"
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a),i##_len=(b);i<i##_len;++i)
#define MSVC_UNKO(x) x
#define rep(...) MSVC_UNKO(_overload3(__VA_ARGS__,repi,_rep,_rep)(__VA_ARGS__))
#define all(c) c.begin(),c.end()
#define mp make_pair
#define write(x) cout<<(x)<<"\n"
using namespace std; typedef long long ll; typedef vector<int> vi; typedef vector<ll> vll;
template<class T>using vv = vector<vector<T>>; template<class T>auto vvec(int n, int m, T v) { return vv<T>(n, vector<T>(m, v)); }
template<class T>bool chmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }
template<class T>bool chmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
constexpr int INF = 1 << 29, MOD = int(1e9) + 7; constexpr ll LINF = 1LL << 60;
struct aaa { aaa() { cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(10); }; }aaaa;

int main() {
    string s;
    cin >> s;

    sort(all(s));
    if (s[0] == s[1] && s[1] != s[2] && s[2] == s[3]) {
        write("Yes");
    }
    else {
        write("No");
    }
}

Measured memory_bytes: 764
#include <iostream>

int main()
{

  int n;
  char s;
  bool flag = false;

  std::cin >> n;

  for (int i = 0; i < n; ++i) {
    std::cin >> s;
    if (s == 'Y') { flag = true;}
  }
  
  if (flag == false) {
    std::cout << "Three" << std::endl;
  } else {
    std::cout << "Four" << std::endl;
  }

  return 0;
}


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

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

        String a = sc.next();

        if (a.charAt(0) == a.charAt(1) && (a.charAt(2) == a.charAt(3)) && (a.charAt(0) != a.charAt(2)))
            System.out.println("Yes");
        else if (a.charAt(0) == a.charAt(2) && (a.charAt(1) == a.charAt(3)) && (a.charAt(0) != a.charAt(1)))
            System.out.println("Yes");
        else if (a.charAt(0) == a.charAt(3) && (a.charAt(1) == a.charAt(2)) && (a.charAt(0) != a.charAt(1)))
            System.out.println("Yes");
        else
            System.out.println("No");
    }
}


Measured memory_bytes: 35588
#include <bits/stdc++.h>
#include <numeric>
long long int GCD(long long int a,long long int b){long long int c;while(b!=0){c=a%b;a=b;b=c;}return a;}
using namespace std;

int main() {
  int h,w;
  cin >> h >> w;
  int a,b;
  cin >> a >> b;
  cout << (h-a)*(w-b) << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
#define ld long double
#define f first
#define s second
#define pb push_back
#define eb emplace_back
#define mk make_pair
#define mt make_tuple
#define MOD 1000000007
#define fo(i,a,b) for(i=a;i<b;i++)
#define foe(i,a,b) for(i=a;i<=b;i++)
#define all(x) x.begin(), x.end()
#define vi vector<int>
#define vl vector <long long int>
#define pii pair <int,int>
#define pll pair <long long int, long long int>
#define vpii vector< pair<int,int> >
#define vpll vector < pair <long long int,long long int> >
#define boost ios::sync_with_stdio(false); cin.tie(0)
using namespace std;
const int inf = 1e9 + 5;
const ll inf64 = 1e18 + 5;
int main()
{
	boost;
	ld r;
	cin >> r;
	ld v = atan(1)*4;
	r = 2 * r * v;
	cout << fixed << setprecision(10) << r;
}


Measured memory_bytes: 3804
package main

import (
	"fmt"
	"runtime/debug"
	"sort"
)

func main() {
	var n int
	fmt.Scan(&n)

	debug.SetGCPercent(-1)

	xs := make([]int, n)
	for i := range xs {
		fmt.Scan(&xs[i])
	}

	ys := make([]int, n)
	copy(ys, xs)
	sort.Ints(ys)
	mid1 := ys[len(ys)/2-1]
	mid2 := ys[len(ys)/2]

	for _, x := range xs {
		if x <= mid1 {
			fmt.Println(mid2)
		} else {
			fmt.Println(mid1)
		}
	}
}


Measured memory_bytes: 20352
#include<stdio.h>
int main(){
    
    int h = 0;
    int w = 0;
    while(1){    
        scanf("%d %d\n",&h,&w);
        if(h+w==0){break;}
        for (int i = 0; i < h; i++){
            for ( int j = 0; j < w; j++ ){
                if((i>0&&i<h-1)&&(j>0&&j<w-1)){
                    printf(".");
                } else {
                    printf("#");
                }
            }
        printf("\n");
        }
        printf("\n");
    }
}


Measured memory_bytes: 2104
#include<iostream>
using namespace std;
int main(){
        int N, K;
        cin >> N >> K;
        int h;
        int j,i;
        j=0;
        for (i=0;i<N;i++){
                cin >> h;
                if(h >= K){
                        j++;
                }

        }
        cout << j;
        return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    long long n,ans;
    cin>>n;
    ans=n+3;
    map<long,long> fac;
    for(long long i=1;i*i<=n;i++){
        if(n%i==0){fac.insert(make_pair(i,n/i));}
    }
    for(auto it=fac.begin();it!=fac.end();it++){
        long long a=(*it).first,b=(*it).second;
        if(a+b<ans){ans=a+b;}
    }
    cout<<ans-2;
}




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

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

queue<vector<int>> que;

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

  vector<vector<int>> shogen(n, vector<int>(n, -1));
  rep(i, n){
    int a;
    cin >> a;
    rep(j, a){
      int x, y;
      cin >> x >> y;
      shogen.at(i).at(x-1) = y;
    }
  }

  int ans_max=0;

  for(int i=0; i<pow(2, n); i++){
    vector<int> kouho;
    int ans_kouho=0;

    int num = i;
    while(num!=0){
      int bit = num%2;
      kouho.push_back(bit);
      num = num/2;
    }
    
    //cout << "hoge";

    int size = kouho.size();
    while(size<n){
      kouho.push_back(0);
      size++;
    }
    
    reverse(begin(kouho), end(kouho));
    
    //cout << "ho1";
    //rep(m, kouho.size())cout << kouho.at(m);
    //cout << endl;
    
    bool ok = true;
    for(int k=0; k<n; k++){
      if(kouho.at(k)==1&&ok){
        for(int l=0; l<n; l++){
          if(shogen.at(k).at(l)==1&&kouho.at(l)==0) {ok=false; break;}
          if(shogen.at(k).at(l)==0&&kouho.at(l)==1) {ok=false; break;}
        }
        ans_kouho++;
      }
    }

    if(ans_max<=ans_kouho&&ok) ans_max = ans_kouho;
    //cout << ans_kouho << endl;
    //rep(m, kouho.size())cout << kouho.at(m);
    //cout << endl;
  }
  cout << ans_max;
}

Measured memory_bytes: 256
import java.util.Scanner;

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

		while (true) {
			int n = scan.nextInt();
			int x = scan.nextInt();
			int num = 0;
			for (int i = 1; i <= n; i++) {
				for (int j = i + 1; j <= n; j++) {
					for (int k = j + 1; k <= n; k++) {
						if (i + j + k == x)
							num++;
					}
				}
			}
			if (n == 0 && x == 0)
				break;
			str.append(num + "\n");

		}
		System.out.print(str);

	}

}

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

int main() {
    int k, x;
    cin >> k >> x;
    for(int i=x-k+1; i<x+k; i++){
        if(i>=-1000000 && i<=1000000){
            cout << i << ' ';
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<cstdlib>
using namespace std;
long long cur;
int w;
long long p[18],po[18];
int bs(int x)
{
	int l=-1,r=10;
	if(x==1)l=0;
	while(l+1<r)
	{
		int m=(l+r)/2;
		printf("? %lld\n",(cur*10LL+m)*po[11-x]+p[11-x]);
		char op;
		cin>>op;
		if(op=='N')l=m;else r=m;
	}
	return l;
}
int main()
{
	po[0]=1LL;
	for(int i=1;i<=17;i++)p[i]=p[i-1]*10LL+9,po[i]=po[i-1]*10LL;
	w=1;
	while(1)
	{
		if(w>10)
		{
			long long t=cur;
			long long cj=1LL;
			while(t%10==0)
			{
				t/=10LL;
				cj*=10LL;
			}
			t/=10LL;
			cj*=10LL;
			char op;
			do
			{
				t=t*10LL+9;
				cj/=10LL;
				printf("? %lld\n",t);
				cin>>op;
			}
			while(op=='N');
			long long res=cur/cj;
			/*if(res%10LL==9)
			{
				char op;
				printf("? %lld\n",(res/10LL)*100LL);
				cin>>op;
				if(op=='Y')res*=10LL;
			} */
			printf("! %lld",res);
			return 0;
		}
		int k=bs(w);
		cur=cur*10LL+k+1;
		w++;
	}
	return 0;
}

Measured memory_bytes: 596
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define FOR(i,start,end) for(int i=start;i<=end;i++)
const int INF = 1001001001;
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
typedef long long ll;
const ll MOD=1000000007;
using namespace std;
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; }
template<class T>auto MAX(const T& a) { return *max_element(a.begin(),a.end()); }
template<class T>auto MIN(const T& a) { return *min_element(a.begin(),a.end()); }
template<class T, class U>U SUM(const T& a, const U& v) { return accumulate(a.begin(),a.end(), v); }
template<class T, class U>U COUNT(const T& a, const U& v) { return count(a.begin(),a.end(), v); }
template<class T, class U>int LOWER(const T& a, const U& v) { return lower_bound(a.begin(),a.end(), v) - a.begin(); }
template<class T, class U>int UPPER(const T& a, const U& v) { return upper_bound(a.begin(),a.end(), v) - a.begin(); }
int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
int LCM(int a, int b) { int g = GCD(a, b); return a / g * b; }
typedef long double ld;
typedef unsigned long long int ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int, int>> vpii;
typedef vector<pair<ll, ll>> vpll;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<vc> vvc;
typedef vector<vs> vvs;
typedef vector<vll> vvll;
typedef map<int, int> mii;
typedef set<int> si;
//---------------------------------------------------------------------------------------------------

int main(void){
    // Your code here!
    int k, t; cin >> k >> t;
    vi a(t);
    rep(i,k) cin >> a[i];
    Rort(a);
    cout << max(a[0]-1-(k-a[0]),0) << endl;
}


Measured memory_bytes: 3600
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
using namespace std;

struct edge {
    int from, to;
};

using edges = vector<edge>;
using graph = vector<edges>;

void add_edge(graph& g, int from, int to) {
    g[from].push_back((edge){from, to});
}

void dfs(graph& g, int v, vector<bool>& used, set<int>& res) {
    used[v] = true;
    res.insert(v);
    for(int i=0; i<g[v].size(); ++i) {
        int u = g[v][i].to;
        if(!used[u]) {
            dfs(g, u, used, res);
        }
    }
}

int main() {
    int N, K, L;
    cin >> N >> K >> L;
    graph r(N), l(N);
    for(int i=0; i<K; ++i) {
        int p, q;
        cin >> p >> q;
        p--; q--;
        add_edge(r, p, q);
        add_edge(r, q, p);
    }
    for(int i=0; i<L; ++i) {
        int r, s;
        cin >> r >> s;
        r--; s--;
        add_edge(l, r, s);
        add_edge(l, s, r);
    }
    vector<bool> usedr(N, false);
    vector<bool> usedl(N, false);
    vector<bool> dummy(N, false);
    vector<int> res(N, 1);
    for(int i=0; i<N; ++i) {
        if(!usedr[i]) {
            set<int> s1;
            dfs(r, i, usedr, s1);
            if(s1.size() == 1) {
                usedl[i] = true;
                res[i] = 1;
                continue;
            }
            for(auto x : s1) {
                if(usedl[x]) continue;
                set<int> s2;
                fill(dummy.begin(), dummy.end(), false);
                dfs(l, x, dummy, s2);
                if(s2.size() == 1) {
                    usedl[x] = true;
                    res[x] = 1;
                    continue;
                }
                vector<int> v;
                set_intersection(s1.begin(), s1.end(), s2.begin(), s2.end(), back_inserter(v));
                for(auto y : v) {
                    usedl[y] = true;
                    res[y] = v.size();
                }
            }
        }
    }
    for(int i=0; i<N; ++i) {
        cout << res[i];
        if(i != N-1) {
            cout << " ";
        } else {
            cout << endl;
        }
    }
}


Measured memory_bytes: 24964
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String n1 = sc.nextLine();
		String n2 = sc.nextLine();
		if (n1.length() + 1 != n2.length()) {
			System.out.println("No");
		}else{
			String[] n1sp = n1.split("");
			String[] n2sp = n2.split("");
			int count = 0;
			for (int i = 0; i < n1.length(); i++) {
				if (!(n1sp[i].equals(n2sp[i]))){
				System.out.println("No");
				break;
				}else{
				count++;
				}
			}
			if(count == n1.length())
			System.out.println("Yes");
		}
    }
}

Measured memory_bytes: 35624
#include <bits/stdc++.h>
#define ALL(obj) begin(obj), end(obj)
#define debug(x) cerr << #x << ": " << x << '\n'
using namespace std;
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
template <class T>
bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}

using ll = long long;
using ull = unsigned long long;
const int INF = 1e9;
// const int MOD = 1e9 + 7;

int main() {
    int A, B;
    cin >> A >> B;
    if (B == 1) {
        cout << 0 << endl;
    } else if (B <= A - 1) {
        cout << 1 << endl;
    } else {
        cout << (B - A + A - 2) / (A - 1) + 1 << endl;
    }
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;
int main() {
	int n; cin >> n;
	vector<double> a(n);
	double ans = 0.0;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		a[i] = 1.0 / a[i];
		ans += a[i];
	}
	ans = 1.0 / ans;
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
main () {
	int N, denied = 0;
	cin>>N;
	int a[N];
	for (int i=0;i<N;i++) {
		cin>>a[i];
		if (a[i] % 2 == 0) {
			if ((a[i] % 3 != 0) && (a[i] % 5 != 0)) {
				denied++;
			}
		}
		
	}
	if (denied > 0) {
		cout<<"DENIED"<<endl;
	} else {
		cout<<"APPROVED"<<endl;
	}
}

Measured memory_bytes: 256
/* -*- coding:utf-8 -*- */

#include <iostream>

using namespace std;

int main()
{
  int money = 100000;
  int n;

  cin >> n;

  for(int i = 0; i < n; i++) {
    money *= 1.05;
    int p = money % 1000;
    
    if(p != 0) {
      money -= p;
      money += 1000;
    }
  }
  
  cout << money << endl;

  return 0;
}

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

typedef long long ll; // long longはデータモデル(LLP64, LP64, ...)によらず64bit.
ll gcd(ll a, ll b) {return b ? gcd(b, a%b) : a;}  // ユークリッドの互除法（aが長辺）
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}          // オーバーフローしないように先に割る

const ll INF = LLONG_MAX;
template<class T> inline bool chmin(T& a, T b) { // change minimum.
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) { // change maximum.
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

int main()
{
#ifdef LOCAL
    // 以降 cin の入力元が 'xxx.txt' になる
    std::ifstream in("frog1.txt");
    std::cin.rdbuf(in.rdbuf());
#endif

    int n;
    cin >> n;
    vector<ll> h(n);
    rep(i,n)
    {
        cin >> h[i];
    }

    vector<ll> dp(n);
    rep(i,n)
    {
        dp[i] = INF;
    }

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

    cout << dp[n-1];

    return 0;
}


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

int main() {
  int h, w;
  cin >> h >> w;


  vector<string> s(h);
  for(int i = 0; i < h; i++){
    for(int j = 0; j < w; j++){
      char c;
      cin >> c;
      s.at(i).push_back(c);
    }
  }
  for(int i = 0; i < h; i++){
    for(int j = 0; j < w; j++){
      if(s.at(i).at(j) == '#'){
        cout << s.at(i).at(j);
        continue;
      }
      int l = j-1, r = j+1;
      if(j == 0) l = j;
      if(j == w-1) r = j;

      int sum = 0;

      for(int k = l; k <= r; k++){
        if(i > 0 && s.at(i-1).at(k) == '#') sum++;
        if(j != k && s.at(i).at(k) == '#') sum++;
        if(i < h-1 && s.at(i+1).at(k) == '#') sum++;
      }

      cout << sum;
    }
    cout << endl;
  }

}


Measured memory_bytes: 256
#include <stdio.h>

int isPrime(int x)
{
    int i;
    if(x==2)
        return 1;
    if(x%2==0)
        return 0;
    for(i=3; i<=x/2; i+=2)
    {
        if(x%i==0)
            return 0;
    }
    return 1;
}

int main()
{
    int n, i;
    scanf("%d", &n);

    for(i=n; i<=1000000; i++)
    {
        if(isPrime(i))
        {
            printf("%d\n", i);
            break;
        }
    }

    return 0;
}


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

using namespace std;
using ll = long long;
using ld = long double;

namespace NyaGadget
{	// DFSライブラリ

	struct DFSedge
	{
		ll v = 0;	// 頂点
		DFSedge(ll vindex) { v = vindex; }
	};

	template <class TE = DFSedge> struct DFS
	{
		using Graph = vector<vector<TE>>;
		Graph graph;

		DFS(ll size) { graph.resize(size); }
		// 頂点xと接続されている頂点を全て取得したいときに使う演算子
		vector<TE>& operator [](int x) { return graph[x]; }

		/**
		@brief 辺を追加する関数
		@note
		 頂点v1とv2を結ぶ辺を追加する。
		**/
		void CreateEdge(ll v1, ll v2)
		{	// 後戻りも出来るようにv1→v2とv2→v1の両方の辺を追加する
			graph[v1].push_back(DFSedge(v2));
			graph[v2].push_back(DFSedge(v1));
		}
	};

}

#define all(collection) (collection).begin(), (collection).end()  // begin to end
#define ceil(a, b) ceil((ld) a / (ld) b);                         // div ceiling
#define each(e, collection) for(auto& e: collection)              // for each
#define rep(i, begin, end) for (ll i = begin; i < end; i++)       // repeat
#define repr(i, begin, end) for (ll i = begin; end < i; i--)      // repeat reverse
#define size(collection) ((ll) (collection).size())               // collection size

using namespace NyaGadget;

/**
@brief 深さ優先探索
@param r 根
@param v 頂点
@param dfs 処理するDFSグラフ
@param memo 前処理したメモ(加算するべきカウンタの値)
@param ans 出力する答えを格納する配列
@note
 DFSで全てのノードを処理する。
**/
void Solve(ll r, ll v, DFS<>& dfs, vector<ll>& memo, vector<ll>& ans)
{
	if (r != -1)
		ans[v] = ans[r] + memo[v];

	each(e, dfs[v])
	{	// 後戻りしないようにする
		if (e.v == r)
			continue;

		Solve(v, e.v, dfs, memo, ans);
	}
}

int main(void)
{
	ll n, q; cin >> n >> q;

	ll u, v;
	DFS<> dfs(n);
	rep(i, 0, n - 1)
	{
		cin >> u >> v;
		--u; --v;				// 0-indexにする
		dfs.CreateEdge(u, v);
	}

	vector<ll> p(q), x(q);
	rep(i, 0, q)
	{
		cin >> p[i] >> x[i];
		p[i]--;
	}

	// 頂点xで加算するべきカウンタの値をメモしておく。
	vector<ll> memo(n);
	rep(i, 0, q)
		memo[p[i]] += x[i];

	vector<ll> ans(n);
	ans[0] = memo[0];
	Solve(-1, 0, dfs, memo, ans);

	each(e, ans)
		cout << e << " ";

	return 0;
}


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

int main() {
	char x, y;
	cin >> x >> y;

	if ((int)x < (int)y) {
		cout << '<' << endl;
	}
	else if ((int)x > (int)y) {
		cout << '>' << endl;
	}
	else {
		cout << '=' << endl;
	}


	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <algorithm>
#include <queue>
using namespace std;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define REP(i,n) for(ll i=0;i<n;i++)
#define REPR(i,n) for(ll i=n-1;i>=0;i--)

typedef long long ll;
#define INF 1e18

void add(vector<ll> &n,ll p){
	n[p]++;
	FOR(i,p,n.size()){
		if(n[i]==10){
			n[i]=0;
			if(i==n.size()-1)n.push_back(0);
			n[i+1]++;
		}else{
			return;
		}
	}
}
void next(vector<ll> &n){
	ll i=0;
	while(1){
		if(i==n.size()-1){
			if(n[i]==9){
				n.push_back(0);
				i++;
			}
			break;
		}
		if(n[i+1]+1!=n[i] && n[i]!=9){
			break;
		}
		i++;
	}
	n[i]++;
	ll tmp=n[i];
	while(1){
		i--;
		tmp--;
		if(tmp<0)tmp=0;
		if(i<0)break;
		n[i]=tmp;
	}
}
int main(){
	ll n; cin>>n;
	vector<ll> num(1,0);
	REP(i,n){
		next(num);
		//cout << "num: "; REP(i,(signed)num.size()) cout<<num[i]<<" "; cout << endl;
	}
	REP(i,(signed)num.size()){
		cout<<num[num.size()-1-i];
	}
	cout << endl;
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int
main (void)
{
  int i, j, k, l, n, count;
  while (scanf ("%d", &n) != EOF)
    {
      count = 0;
      for (i = 0; i <= 9; i++)
	for (j = 0; j <= 9; j++)
	  for (k = 0; k <= 9; k++)
	    for (l = 0; l <= 9; l++)
	      if (i + j + k + l == n)
		count++;
      printf ("%d\n", count);
    }
  return 0;
}

Measured memory_bytes: 596
#include <iostream>
#include <cmath>
#include <iomanip>
#include <limits>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
using namespace std;



int main(){
    stack<int> s;
    string now;
    while(cin >> now){
        if(now == "+"){
            int a=s.top();
            s.pop();
            int b=s.top();
            s.pop();
            s.push(a+b);
        }
         else if(now == "-"){
            int a=s.top();
            s.pop();
            int b=s.top();
            s.pop();
            s.push(b-a);
        }
        else if(now == "*"){
            int a=s.top();
            s.pop();
            int b=s.top();
            s.pop();
            s.push(a*b);
        }
        else s.push(stoi(now));
    }
    cout << s.top() << endl;
}


Measured memory_bytes: 3152