akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#define ll long long //data types used often, but you don't want to type them time by time
#define ull unsigned long long
#define ui unsigned int
#define mod 1000000007
#define inf 100000000000010
#define us unsigned short
#define IOS ios_base::sync_with_stdio(0); //to synchronize the input of cin and scanf
#define INF LONG_MAX
#define PI 3.1415926535897932384626
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define rep(x,j,n)for(int x=j;x<n;x++)
#define all(x) (x).begin(), (x).end()

typedef vector<pair<ll,ll>> vpi;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll,ll> pi;

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

ll modexp(ll a,ll b,ll m)
{
    ll r=1;
    a=a%m;
    while(b>0)
    {
        if(b&1)r=(r*a)%m;
        b = b>>1;
        a=(a*a)%m;
    }
    return r%m;
}

struct CustomCompare
{
    bool operator()(const int& lhs, const int& rhs)
    {
        return lhs < rhs;
    }
};

bool comp(pair<ll, ll>a,pair<ll,ll>b)
{
    return a.fi>=b.fi;
}

ll builtin_popcount(ll x)
{
    ll cnt = 0;
    for(ll i=60;i>=0;i--)
    {
        if((1LL<<i)&x)cnt++;
    }
    return cnt;
}

ll addmod(ll a,ll b)
{
    a%=mod;
    b%=mod;
    return (a+b)%mod;
}
ll mulmod(ll a,ll b)
{
    a%=mod;
    b%=mod;
    return (a*b)%mod;
}
/*
const int mxn = 5*(1e6) +10;
vi spf(mxn);
void sieve()
{
    for(ll i =0;i<mxn;i++)spf[i]  = i;
    for(ll i=2;i<mxn;i+=2)spf[i] = 2;
    for(ll i = 3;i*i<mxn;i++)
    {
        if(spf[i]==i)
        {
            for(ll j = i*i;j<mxn;j+=i)
            {
                if(spf[j]==j)spf[j] = i;
            }
        }
    }
}
*/




int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);cout.tie(0);
ll n;cin>>n;
vi arr(n);
rep(i,0,n)cin>>arr[i];
ll ans = 0;
ll mx = arr[0];
rep(i,0,n)
{
    if(mx>arr[i])ans += (mx-arr[i]);
    mx = max(mx,arr[i]);
}
cout<<ans<<endl;
return 0;

}
/*
1
4
1 2
2 3
3 4
2
2 2
*/


Measured memory_bytes: 4780
#pragma comment(linker, "/STACK:102c000000,102c000000")
#include <iostream>
#include <cstdio>
#include <cstring>
#include <sstream>
#include <string>
#include <algorithm>
#include <list>
#include <map>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>
#include <cstdlib>
// #include <conio.h>
using namespace std;
#define clc(a,b) memset(a,b,sizeof(a))
#define inf 0x3f3f3f3f
#define lson l,mid,rt<<1
#define rson mid+1,r,rt<<1|1
const int N = 3*1e6+10;
const int MOD = 1e9+7;
#define LL long long
#define mi() (l+r)>>1
double const pi = acos(-1);

void fre() {
    freopen("in.txt","r",stdin);
}

// inline int r() {
//     int x=0,f=1;char ch=getchar();
//     while(ch>'9'||ch<'0') {if(ch=='-') f=-1;ch=getchar();}
//     while(ch>='0'&&ch<='9') { x=x*10+ch-'0';ch=getchar();}return x*f;
// }

int a[210];
int main(){
    int n;
    cin>>n;
    for(int i=0;i<2*n;i++){
        cin>>a[i];
    }
    sort(a,a+2*n);
    int ans=0;
    for(int i=0;i<2*n;i+=2){
        ans+=a[i];
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
import sys
input=lambda: sys.stdin.readline().rstrip()
mod=10**9+7
n=int(input())
edge=[[] for i in range(n)]
for i in range(n-1):
  a,b=map(int,input().split())
  edge[a-1].append(b-1)
  edge[b-1].append(a-1)
inf=10**6
Par=[inf]*n
Par[0]=-1
Deg=[0]*n
Deg[0]=0
Chk=[0]
while Chk:
  c=Chk.pop()
  for next in edge[c]:
    if Par[next]==inf:
      Par[next]=c
      Deg[next]+=1
      Chk.append(next)

from collections import deque
TS=list(v for v in range(n) if Deg[v]==0)
D=deque(TS)
while D:
  v=D.popleft()
  for t in edge[v]:
    if t!=Par[v]:
      Deg[t]-=1
      if Deg[t]==0:
        D.append(t)
        TS.append(t)

Used=[False]*n
C=[0]*n
for i in reversed(range(n)):
  v=TS[i]
  Used[v]=True
  for g in edge[v]:
    if not Used[g]:
      C[g]+=C[v]+1

H=[0]*n
H[0]=1
H[1]=pow(2,mod-2,mod)
for i in range(2,n):
  H[i]=(H[i-1]*H[1])%mod

ans=0
for i in range(n):
  if len(edge[i])==1:
    continue
  else:
    A=[]
    for e in edge[i]:
      if e==Par[i]:
        A.append(n-1-C[i])
      else:
        A.append(C[e]+1)
    cur=1+(len(edge[i])-1)*H[-1]
    for a in A:
      cur-=H[n-1-a]
    ans+=cur
print((ans*H[1])%mod)


Measured memory_bytes: 103160
#include <bits/stdc++.h>
using namespace std;
 
#define int long long
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define FOR(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define SORT(c) sort((c).begin(),(c).end())
#define ve vector
#define vei vector<int>
#define vep vector<pair<int,int>>
#define vvi vector<vector<int>>
 
typedef long long ll;
const ll INF = LLONG_MAX - 100;
const ll mod = 1e9 + 7;
const int MAX_N = 2e5 + 5;
int dx[] = {-1,0,1,0}, dy[] = {0,1,0,-1};
vector<ll> prime;
 
int fac[MAX_N], inv[MAX_N];
 
template <class T = ll> T in() {T x; cin >> x; return (x);}
void DEBUG(vector<int> a) {for(int i=0;i<a.size();i++){cout<<a[i]<<" ";cout<<endl;}}
ll GCD(ll a, ll b) {ll c; while (b != 0) {c = a % b; a = b; b = c;}return a;}
ll LCM(ll a, ll b) {return a * b / GCD(a, b);}
ll POW(ll a, ll b) {ll c = 1LL; while (b > 0) {if (b & 1LL) {c = a * c%mod;}a = a * a%mod; b >>= 1LL;}return c;}
void _nCr() {fac[0] = 1LL; for (int i = 1LL; i < MAX_N; i++) {fac[i] = fac[i - 1LL] * i%mod;}for (int i = 0; i < MAX_N; i++) {inv[i] = POW(fac[i], mod - 2);}}
ll nCr(ll n, ll r) {return (fac[n] * inv[r] % mod)*inv[n - r] % mod;}
void PRI(ll n) {bool a[n + 1LL]; for (int i = 0; i < n + 1LL; i++) {a[i] = 1LL;}for (int i = 2; i < n + 1LL; i++) {if (a[i]) {prime.pb(i); ll b = i; while (b <= n) {a[b] = 0; b += i;}}}}
template <typename T> T chmin(T& a, T b) {if(a>b)a=b;return a;}
template <typename T> T chmax(T& a, T b) {if(a<b)a=b;return b;}


bool solve() {
	int ans = 0;
	int a[3];REP (i,3) {cin >> a[i];ans += a[i];}
	sort(a,a+3);
	ans -= a[2];
	cout << ans << endl;
}

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

	solve();
}

Measured memory_bytes: 256
#include <iostream>

int main()
{
    int D;
    std::cin >> D;
    std::cout << "Christmas"; 
    if (D < 25)
    {
        std::cout << " Eve";
    }
    if (D < 24)
    {
        std::cout << " Eve";
    }
    if (D < 23)
    {
        std::cout << " Eve";
    }
    std ::cout << std::endl;
    return 0;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

const (
	initialBufSize = 10000
	maxBufSize     = 100000000
)

var sc *bufio.Scanner = func() *bufio.Scanner {
	sc := bufio.NewScanner(os.Stdin)
	buf := make([]byte, initialBufSize)
	sc.Buffer(buf, maxBufSize)
	return sc
}()

/////////////////////////////////////////
///////////////// Input /////////////////
/////////////////////////////////////////
// Input number
func scanIntNum() (num int) {
	sc.Scan()

	num, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return num
}

func scanIntNums() (nums []int) {
	sc.Scan()
	numString := strings.Split(sc.Text(), " ")

	nums = make([]int, len(numString))
	var err error

	for i := 0; i < len(nums); i++ {
		nums[i], err = strconv.Atoi(numString[i])
		if err != nil {
			panic(err)
		}
	}
	return nums
}

func main() {
	inputs := scanIntNums()
	N := inputs[0]
	K := inputs[1]
	sumap := make(map[int]int, N)

	for i := 0; i < K; i++ {
		_ = scanIntNum()
		A := scanIntNums()
		for _, su := range A {
			sumap[su]++
		}
	}

	var ans int
	for i := 1; i <= N; i++ {
		if sumap[i] == 0 {
			ans++
		}
	}
	fmt.Println(ans)

}


Measured memory_bytes: 2064
# https://atcoder.jp/contests/abc149/tasks/abc149_e

# すべての握手の組み合わせN**2を列挙しソートしM番目までを足し合わせればOK
# だけど制約からこれを行うことは困難
# すべてを列挙しなくともM番目の値を知ることは二分探索で可能(参考:億マス計算)
# Aの累積和を保持しておけば、M番目の値の探索中にMまでの値の合計もついでに計算できる
# 以下reverseでソート済みだと仮定
# XがM番目の数→X以上である数はM個以上(cntとする)→cntがM個以上の条件を満たすうちの最大となるXがM番目の値
# そのあと余分な分を引く処理とか必要

from bisect import bisect_right, bisect_left
import sys
read = sys.stdin.readline


def read_ints():
    return list(map(int, read().split()))


class cumsum1d:
    def __init__(self, ls: list):
        '''
        1次元リストを受け取る
        '''
        from itertools import accumulate
        self.ls_accum = [0] + list(accumulate(ls))

    def total(self, i, j):
        # もとの配列lsにおける[i,j)の中合計
        return self.ls_accum[j] - self.ls_accum[i]


N, M = read_ints()
A = read_ints()
A.sort()  # bisectを使う都合上 reverseは抜き
A_reversed = list(reversed(A))
A_rev_acc = cumsum1d(A_reversed)


def is_ok(X):
    # M番目の数はXである→X以上の個数>=M となるうちで最大のX(もっとも左の方のX)
    # X以上の個数>=Mを返す
    # X以下の個数はai+aj>=Xを満たす個数
    cnt = 0
    ans = 0
    for a in A:
        aa = X - a
        idx_reverse = N - bisect_left(A, aa)  # 大きい方からだと何番目か
        # これはbisect_right(A_reversed,aa)に等しい
        cnt += idx_reverse
        ans += A_rev_acc.total(0, idx_reverse) + idx_reverse * a
    return cnt >= M, ans, cnt


def meguru_bisect(ng, ok):
    '''
    define is_okと
    初期値のng,okを受け取り,is_okを満たす最小(最大)のokを返す
    ng ok は  とり得る最小の値-1 とり得る最大の値+1
    最大最小が逆の場合はよしなにひっくり返す
    '''
    while (abs(ok - ng) > 1):
        mid = (ok + ng) // 2
        flg, ans, cnt = is_ok(mid)
        if flg:
            ok = mid
            ans_true = ans  # さいごにokとなる状態がans
            cnt_true = cnt
        else:
            ng = mid
    return ans_true, ok, cnt_true


ans_tmp, M_th_num, M_plus_alpha_th = \
    meguru_bisect(2 * 10 ** 5 + 1, 0)
# print(ans_tmp, M_th_num, M_plus_alpha_th)
print(ans_tmp - (M_plus_alpha_th - M) * M_th_num)


Measured memory_bytes: 14440
#include<iostream>
#include<vector>
#include<iterator>
#include<algorithm>
int main(){
	int n = 5;
	std::cin >> n;

	std::vector<int> v;
	
	for (size_t i = 0; i < n; i++)
	{
		v.push_back(*std::istream_iterator<int>(std::cin));
	}
	 
		
	int count = 0;
	for (size_t i = 0; i < n-2; i++)
	{
		auto min = *std::min_element(v.begin()+ i,v.begin() + i + 3);
		auto max = *std::max_element(v.begin()+ i,v.begin() + i + 3);
      	if(min < v[i+1] && v[i+1] < max){
			count++;
		}
	}
	std::cout << count;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define pb push_back
const int maxn = 10000;
const int INF32 = 1'050'000'000;
const long long INF64 = 4'000'000'000'000'000'000;
const int MOD7 = 1'000'000'007;
const int MOD9 = 1'000'000'009;

ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
int dx[] = {-1, 0, 1, 0};
int dy[] = {0, -1, 0, 1};

int h, w;
vector<vector<char>> G;
vector<vector<int>> vis;
struct P
{
	int x;
	int y;
	int step;
};

int bfs()
{
	queue<P> que;
	P p; p.x=0; p.y=0; p.step=0;
	que.push(p);
	vis[0][0] = 0;
	while(!que.empty()){
		P np = que.front();
		que.pop();
		if(np.x == h-1 && np.y == w-1) return np.step;
		rep(i,4){
			int nx = np.x + dx[i];
			int ny = np.y + dy[i];
			if(nx<0 || nx>=h || ny<0 || ny>=w ||
			 vis[nx][ny]!=-1 || G[nx][ny]=='#')
				continue;
			P nnp; nnp.x = nx; nnp.y = ny; nnp.step = np.step + 1;
			que.push(nnp);
			vis[nx][ny] = nnp.step;
		}
	}
	return -1;
}

int main()
{
	cin >> h >> w;
	G.resize(h);
	rep(i,h) G[i].resize(w);
	int cnt = 0;
	rep(i,h)rep(j,w){
		cin >> G[i][j];
		if(G[i][j] == '#') cnt++;
	}
	vis.resize(h);
	rep(i,h) vis[i].assign(w,-1);
	int min_cost = bfs();
	if(min_cost == -1) cout << -1 << endl;
	else cout << h*w - (cnt+min_cost+1) << endl;
}


Measured memory_bytes: 256
N,T=map(int,input().split())
li=[]
a=0
for i in range(N):
    li.append(list(map(int,input().split())))
    if li[i][1]<=T:
        a+=1
li.sort()
if a==0:
    print('TLE')
else:
    for i in range(N):
        if li[i][1]<=T:
            print(li[i][0])
            break


Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
#include<stdio.h>
#include<string.h>
#include <bitset>

using namespace std;
#define int  long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000
#define DEBUG_OUT true
#define ALL(x) (x).begin(),(x).end()

// int DP[MEM_SIZE][MEM_SIZE] = {0};
// int GMEM[MEM_SIZE][MEM_SIZE] = {0};
template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return; std::cout << e <<" ";}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){std::cout<< e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T,class... Ts> void DEBUG(T d, Ts... e){if(DEBUG_OUT == false)return;DEBUG(d);DEBUG(e...);};
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

//FUNCTION
void solve(void)
{
   int N,A,B; cin>>N; cin>>A;cin>>B;  
   string str; cin>>str;
   int cnt_B = 0,cnt_ALL = 0;
   for (int i = 0; i < N; i++)
   {
     if(str[i] == 'c')
     {
       cout<<"No"<<endl;
     }
     else if(str[i] == 'a')
     {
       if(cnt_ALL < A + B)
       {
         cout<<"Yes"<<endl;
         cnt_ALL++;
       }
       else
       {
         cout<<"No"<<endl;
       }
       
     }
     else if(str[i] == 'b')
     {
       if(cnt_ALL < A+B && cnt_B < B)
       {
         cout<<"Yes"<<endl;
         cnt_ALL++;cnt_B++;
       }
       else
       {
         cout<<"No"<<endl;
       }
       
     }
   }
   
  return;
}

int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(15);
  solve();

  return 0;
}


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


int main(){
  string s,t;
  cin >>s>>t;
  int a,b;
  cin >>a>>b;
  string u;
  cin >>u;

  if(s==u){
    a-=1;
  }
  if(t==u){
    b-=1;
  }
  cout<<a<<" "<<b<<endl;
}


Measured memory_bytes: 256
/*
 
@author
_      _          _                 _      _
\\    // /\    | | \  |     |    /\ \\    //     
 \\  // /__\   | |_/  |_____|   /__\ \\  //
  \\// /    \  | | \  |     |  /    \ \\//
   \/ /      \ | |_/  |     | /      \ \/
@ Indian Institute of Technology Bhilai
*/
 
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ul;
#define fr(i,start,end, inc) for(ll i=(start); i<(end); i+=inc)
#define rf(i,end,start, inc) for(ll i=(start-1); i>=(end); i-=inc)
#define rep(i,n) for(ll i=0; i<n; i++)
#define rep1(i,n) for(ll i=1; i<n; i++)
#define pb push_back
#define pl pair<ll, ll>
#define fi first
#define se second
#define all(v) v.begin(), v.end()
#define alla(arr,n) arr, arr+n
#define yes cout<<"Yes\n"
#define no cout<<"No\n"
#define fsync ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
const ll maxx =  1e9+7;


bool compare(const pl &a, const pl &b){
    return a.fi<b.fi || (a.fi==b.fi && a.se<b.se);
}
ll inline power(ll a, ll b, ll p){
    a %= p;
    ll ans = 1;
    while(b>0){
        if(b & 1)
            ans = (ans*a)%p;
        a = (a*a)%p;
        b >>= 1;
    }
    return ans;
}

ll inv(ll n, ll p){
    return power(n,p-2, p);
}
inline vector<ll> allinv(ll n, ll p){
    vector<ll> arr(n);
    arr[1]=1;
    fr(i,2,n,1){
        arr[i] = (p - (p/i)*arr[p%i]%p)%p;
    }
    return arr;
}
vector<ll> inline allncr(ll n, ll p){
    vector<ll> nci(n+1);
    nci[0]=1;
    nci[n]=1;
    vector<ll> v = allinv(n,p);
    fr(i,1,n,1){
        nci[i]=(nci[i-1]*(n-i-1))%p;
    }
    return nci;
}

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

template<class T>
void printv(T &v, ll n){
    if(n==-1)
        n = v.size();
    rep(i,n)
        cout << v[i] << " ";
    cout << "\n";
}
//------------fenwick--------------
/*vector<ll> f(maxn,0);
void fenwick_update(ll idx, ll val){
    while(idx <= maxn){
        f[idx]+=val;
        idx += (idx & -idx);
    }
}
ll read_fenwick(ll idx){
    ll sum = 0;
    while(idx > 0){
        sum += f[idx];
        idx -= (idx & -idx);
    }
    return sum;
}*/

void solve(){
    string s;
    cin >> s;
    if(s[2]==s[3] && s[4]==s[5])
        yes;
    else
        no;
}

int main(){
    fsync
    ll test=1;
    // cin >> test;
    while(test--){
        solve();

    }
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>


using namespace std;
typedef long long ll;

#define mod 10000
#define INF 2000000000
#define LLINF 4000000000000000000
#define SIZE 50010

char A[510],B[510];
int M;

int memo[501][2][10][500][3];

// h=?????° Z = true->up false->down b=1???????????°??? m=(modM)
// a=0..???MAX&?????± 1..???MAX&??¶????????? 2..???MAX-1&?????± c=0..A 1..B

// O(500*2*10*500*3*2 = 15000000)

int MAX_a,C[510];

int dfs(int h,bool Z,int b,int m,int a){
    int ret = 0;
    
    if(h == MAX_a && a==2) return 0;
    
    if(m==0 && h > 0 && !(h==1 && Z==false))
        ret = 1;
    
    if((h == MAX_a) || (h == MAX_a-1 && a==2)){
        return ret;
    }
    
    if(memo[h][Z][b][m][a]>0){
        return memo[h][Z][b][m][a];
    }
    
    //[s,e)
    int s=0,e=10;
    
    if(h==0) s =1;
    
    if(Z==true){
        s = b+1;
    }else{
        e = b;
    }
    
    if(a == 1){
        
        for(int i=s;i<e;i++){
            if(C[h] < i)
                ret+=dfs(h+1,!Z,i,(m*10+i)%M,2);
            else if(C[h]==i)
                ret+=dfs(h+1,!Z,i,(m*10+i)%M,1);
            else
                ret+=dfs(h+1,!Z,i,(m*10+i)%M,0);
        }
        
    }else{
        for(int i=s;i<e;i++){
            ret+=dfs(h+1,!Z,i,(m*10+i)%M,a);
        }
    }
    
    memo[h][Z][b][m][a] = ret%mod;
    
    return ret%mod;
}

int is_ZigZag(){
    bool Z;
    
    if(MAX_a==1)
        return 1;
    
    if(C[0]==C[1])
        return 0;
    
    if(MAX_a==2){
        return 1;
    }
    
    Z = (C[0] > C[1]);
    
    for(int i=2;i<MAX_a;i++){
        if(!(Z==true && C[i-1] < C[i]) && !(Z==false && C[i-1] > C[i])){
            return 0;
        }
    }
    
    return 1;
}

int main(){
    int ans_A,ans_B,length_A=0,length_B=0;
    
    scanf("%s %s %d",A,B,&M);
    
    while(A[length_A]!='\0') length_A++;
    while(B[length_B]!='\0') length_B++;

    for(int i=0;i<length_A;i++){
        C[i] = A[i]-'0';
    }
    
    MAX_a = length_A;
    ans_A = dfs(0,1,-1,0,1) + dfs(0,0,10,0,1);
    
    ans_A -= is_ZigZag();
    
    for(int i=0;i<501;i++){
        for(int j=0;j<2;j++){
            for(int k=0;k<10;k++){
                for(int l=0;l<500;l++){
                    for(int m=0;m<3;m++){
                        memo[i][j][k][l][m] = 0;
                    }
                }
            }
        }
    }
    
    for(int i=0;i<length_B;i++){
        C[i] = B[i]-'0';
    }
    MAX_a = length_B;
    ans_B = dfs(0,1,-1,0,1) + dfs(0,0,10,0,1);
    
    
    printf("%d\n",(ans_B+mod-(ans_A%mod))%mod);
    
    return 0;
}

Measured memory_bytes: 59952
#include <algorithm>
#include <cstdio>
#define LL long long
#define maxn 600010
using namespace std;
struct node{
	int v,c;
}a[maxn];
int cmp(node a,node b){
	return a.v>b.v;
}
int main(){
	int X,Y,A,B,C,i,cnt;//1,2,0
	LL sum=0;
	scanf("%d%d%d%d%d",&X,&Y,&A,&B,&C);
	for(i=1;i<=A;i++)scanf("%d",&a[i].v),a[i].c=1;
	for(i=A+1;i<=A+B;i++)scanf("%d",&a[i].v),a[i].c=2;
	for(i=A+B+1;i<=A+B+C;i++)scanf("%d",&a[i].v),a[i].c=0;
	sort(a+1,a+1+A+B+C,cmp);
	cnt=0;
	for(i=1;i<=A+B+C;i++)
		if(a[i].c==1){
			if(X>0)X--,sum+=a[i].v;
			if(X+Y==cnt)break;
		}else if(a[i].c==2){
			if(Y>0)Y--,sum+=a[i].v;
			if(X+Y==cnt)break;
		}else if(a[i].c==0){
			cnt++;
			sum+=a[i].v;
			if(X+Y==cnt)break;
		}
	printf("%lld\n",sum);
	return 0;
}

Measured memory_bytes: 4224
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(),v.end()
#define INF INT_MAX;
typedef long long ll;
using namespace std;

int main(){
  int time[5];
  int mark = 0 ,m = 124;
  rep(i,5){
    cin >> time[i];
    if(time[i]%10!=0&&time[i]%10<m){
      m=time[i]%10;
      mark = i;
    }
  }

  if(m==124) m=0;

  int ans =0;

  rep(i,5){
    if(i==mark) ans += time[i]/10*10;
    else ans += (time[i]+9)/10*10;
  }
  cout << ans + m << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
 int a,b;
 scanf("%d %d",&a,&b);
 if(a<b){
  printf("a < b\n");
 }
 else if(a>b){
  printf("a > b\n");
 }
 else{
  printf("a == b\n");
 }
 return 0;
}

Measured memory_bytes: 580
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <iomanip>
#include <queue>
#include <unordered_map>
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
using namespace std;
typedef long long ll;

int H,N;
int A[1000];
int B[1000];
int dp[10001];

int main(){
    cin>>H>>N;
    rep(i,N) cin>>A[i]>>B[i];

    repn(i,H){
        int res=1001001001;
        rep(j,N){
            if(i<=A[j]) res=min(res,B[j]);
            else res=min(res,dp[i-A[j]]+B[j]); 
        }
        dp[i]=res;
        //cout<<i<<":"<<dp[i]<<endl;
    }

    int ans=dp[H];
    cout<<ans<<endl;
}

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

using namespace std;
#define INF 1<<29

typedef int Weight; 

struct Edge{
    int src;
    int dst;
    Weight weight;

    Edge(int src, int dst, Weight weight):
        src(src), dst(dst), weight(weight){ }
};

struct Node{
    int index;
    Weight cost;
    int prev;

    Node(int index, Weight cost, int prev) :
        index(index), cost(cost), prev(prev){ }
};

bool operator <(const Node &a, const Node &b){
    if(a.cost == b.cost){
        return a.index > b.index;
    }else{
        return a.cost > b.cost;
    }
}

void dijkstra(int s, vector<Weight> &costs, vector<int> &prev, vector<vector<Edge> > &edges){
    int n=costs.size();
    priority_queue<Node> q;

    costs.assign(n,INF);
    prev.assign(n,-1);
    costs[s] = 0;
    q.push(Node(s,0,-2));

    while(!q.empty()){
        Node fix = q.top(); 
        q.pop();
        if(prev[fix.index] != -1) continue;
       
        costs[fix.index] = fix.cost;
        prev[fix.index] = fix.prev;

        for(int i=0;i<edges[fix.index].size();i++){ //foreach edge from fixed
            if(costs[edges[fix.index][i].dst] > costs[fix.index] + edges[fix.index][i].weight){
                q.push(Node(edges[fix.index][i].dst, edges[fix.index][i].weight + costs[fix.index], fix.index));
            }
        }
    }
}

int main(){
    int n,tmp;
    cin >> n;
    vector<Weight> costs(n);
    vector<int> prev(n);
    vector<vector<Edge> > edges(n);

    for(int i=0;i<n;i++){
        cin >> tmp;
        if(tmp == 0){
            for(int j=1;j<=6;j++){
                edges[i].push_back(Edge(i,min(n-1,i+j),1));
            }
        }else{
            edges[i].push_back(Edge(i,min(n-1,i+tmp),0));
        }
    }
    dijkstra(0,costs,prev,edges);
    cout << costs[n-1] << endl;
}

Measured memory_bytes: 7364
#include<iostream>
using namespace std;
int main()
{
	int a,b,c;
	cin>>a>>b>>c;
	if(a==5&&b==7&&c==5)
	cout<<"YES"<<endl;
	else
		if(a==5&&b==5&&c==7)
			cout<<"YES"<<endl;
	else
		if(a==7&&b==5&&c==5)
			cout<<"YES"<<endl;
	else
		cout<<"NO"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
static const int MOD = 1000000007;
string s;
long long dp[100001][4];

void add(long long &a, long long b) {
  a += b;
  if (a >= MOD) a %= MOD;
}

int main(){
  cin >> s;

  for(int i=0;i<100001;i++) for(int j=0;j<4;j++) dp[i][j] = 0;

  dp[0][0] = 1;
  for(int i=0;i<s.size();i++){
    for(int j=0;j<4;j++){
      if(s[i]!='?') add(dp[i+1][j],dp[i][j]);
      else add(dp[i+1][j],dp[i][j] * 3 % MOD);
    }
    if(s[i] == 'A' || s[i] == '?') add(dp[i+1][1],dp[i][0]);
    if(s[i] == 'B' || s[i] == '?') add(dp[i+1][2],dp[i][1]);
    if(s[i] == 'C' || s[i] == '?') add(dp[i+1][3],dp[i][2]);
  }
  cout << dp[s.size()][3] << endl;
  return 0;
}


Measured memory_bytes: 3584
//http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=2607???"Invest Master"
//???????§£?????????????????£????????????????????????????????£????¨???¶?????????
//DP????§????????????????
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
using namespace std;
typedef pair<int,int> P;
 
int dp[11][100001];
int n, d, x;
int p[10][10];
 
int main(){
    cin >> n >> d >> x;
    rep(i,d) rep(j,n) cin >> p[i][j];
    rep(i,d) rep(j,100001) dp[i][j] = j;
    for(int i = d-2; i >= 0; i--){
        for(int j = 1; j <= 100000; j++){
            rep(k,n){
                if(p[i][k] > j || p[i][k] >= p[i+1][k]) continue;
                dp[i][j] = max(dp[i][j],p[i+1][k]+dp[i][j-p[i][k]]);
            }
        }
    }
    int ans = x;
    for(int i = 0; i <= d-2; i++) ans = dp[i][ans];
    cout << ans << endl;
}

Measured memory_bytes: 5248
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mod 1000000007
void rishabh(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}
const int mxn = 2e5+5;
int n, m, who[mxn];
vector<int> adj[mxn], adj2[mxn], st, co;
bool vis[mxn];
void dfs(int i){
    vis[i]=true;
    for(auto x: adj[i]){
        if(!vis[x]){
            dfs(x);
        }
    }
    st.push_back(i);
}
void dfs2(int i){
    vis[i]=false;
    for(auto x: adj2[i]){
        if(vis[x]){
            dfs2(x);
        }
    }
    co.push_back(i);
}
int main(){
    rishabh();
    float n;
    cin>>n;
    cout<<ceil(n/1000)*1000-n;
}


Measured memory_bytes: 13192
#include<cstdio>
#include<algorithm>
#include<memory.h>
#include<string>
using namespace std;

int DP[10][100];
int N;

int main()
{
	while(scanf("%d",&N)!=EOF)
	{
		memset(DP,0,sizeof(DP));
		DP[0][0]=1;
		for(int i= 0;i<=4;i++)
		{
			for(int j=0;j<=N;j++)
			{
				for(int k=0;k<10;k++)
				{
					DP[i+1][j+k]+=DP[i][j];
				}
			}
		}
		printf("%d\n",DP[4][N]);
	}

}

Measured memory_bytes: 0
#define _USE_MATH_DEFINES
#include <iostream>
#include <algorithm>
#include <queue>
#include <stack>
#include <deque>
#include <climits>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
//#include <tuple>

#define INF INT_MAX>>1 
#define SIZE 100010
#define MOD 1000000007
#define rep(i, n) for(int i=0; i<(int)(n); i++)
#define rep2(i, from, to) for(int i=(from); i<(int)(to); i++)
#define all(obj) (obj).begin(), (obj).end()
#define lpair pair<ll, ll>
#define vint vector<ll>
#define vinput(name) for(int i=0; i<(int)(name.size()); i++) cin >> name[i];
#define voutput(name) for(int i=0; i<(int)(name.size()); i++) cout << name[i] << endl;
typedef long long ll;

using namespace std;

ll ans = 0;

int main(void){
	int x; cin >> x;
	ans += (x/500)*1000;
	x %= 500;
	ans += (x/5)*5;
	cout << ans << endl;
	return 0;
}

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

int main() {
	int W,H,x,y,r;
	cin >> W >> H >> x >> y >> r;
	if(x-r < 0 || x+r > W || y-r < 0 || y+r > H){
		cout << "No" <<endl;
	}else{
		cout << "Yes" <<endl;
	}
	return 0;
}

Measured memory_bytes: 1160
#include<stdio.h>
//小さい順にソート
int c[200002][3];
void merge(int i,int j,int s[][3]){
  if(i!=j){
    merge(i,(i+j)/2,s);
    merge((i+j)/2+1,j,s);
    int a=i,b=(i+j)/2+1;
    int d;
    for(d=i;d<=j;d++){
      if((i+j)/2<a){
        c[d][0]=s[b][0];
        c[d][1]=s[b][1];
        b++;
      }
      else if(j<b){
        c[d][0]=s[a][0];
        c[d][1]=s[a][1];
        a++;
      }
      else if(s[a][1]<s[b][1]){
        c[d][0]=s[a][0];
        c[d][1]=s[a][1];
        a++;
      }
      else{
        c[d][0]=s[b][0];
        c[d][1]=s[b][1];
        b++;
      }
    }
    for(d=i;d<=j;d++){
      s[d][0]=c[d][0];
      s[d][1]=c[d][1];
    }
  }
}

int main(){
  int n,i,count=0;
  scanf("%d",&n);
  int a[n+1][3];
  for(i=0;i<n;i++)
    scanf("%d%d",&a[i][0],&a[i][1]);
  merge(0,n-1,a);
  for(i=0;i<n;i++){
    count+=a[i][0];
    if(count>a[i][1]){
      printf("No\n");
      return 0;
    }
  }
  printf("Yes\n");
  return 0;
}


Measured memory_bytes: 4864
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
   	
int main() {
	int n, s1 = 0, s2 = 0, diff = 10007, dif;

	cin >> n;

	int a[n];

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

	for (int i = 1; i < n; i++)
	{
		s1 = s2 = 0;
		for (int j = 0; j < i; j++)
		{
			s1 = s1 + a[j];
		}

		for (int k = i; k < n; k++)
		{
			s2 = s2 + a[k];
		}
		if ((s1 - s2) < 0)
		{
			dif = s2-s1;
		}
		else
		{
			dif = s1 -  s2;
		}

		diff = min(diff, dif);

	}

	cout << diff ;

	return 0;
}



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

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

    static class TaskA {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int a = in.nextInt();
            int b = in.nextInt();
            int c = in.nextInt();
            if (c >= a && c <= b) {
                out.println("Yes");
            } else {
                out.println("No");
            }
        }

    }
}



Measured memory_bytes: 21716
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using vb=vector<bool>;
using vvb=vector<vb>;
using pii = pair<int,int>;
using pli = pair<ll,int>;
using pll = pair<ll,ll>;
using vpii = vector<pii>;
using vpli = vector<pli>;
using vpll = vector<pll>;

#define rep(i, n) for(int i=0;i<(int)n;i++)
#define rep2(i, s, n) for(int i=(s);i<(int)n;i++)
int INF=1e9+7;

vi par,ran;

void init(int n) {
  rep(i,n) {
    par.push_back(i);
    ran.push_back(0);
  }
}

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

void unite(int x,int y) {
  x=find(x);
  y=find(y);
  if(x==y) return;
  if(ran[x]<ran[y]) par[x]=y;
  else {
    par[y]=x;
    if(ran[x]==ran[y]) ran[x]++;
  }
}

bool same(int x,int y) {
  return find(x)==find(y);
}

int main() {
  int N,M;
  cin >> N >> M;
  vi X(M),Y(M),Z(M);
  init(N);
  rep(i,M) {
    cin >> X[i] >> Y[i] >> Z[i];
    X[i]--;Y[i]--;
    unite(X[i],Y[i]);
  }
  
  int ans=1;
  rep2(i,1,N) {
    if(!same(0,i)) {
      unite(0,i);
      ans++;
    }
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 5440
#include <bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef pair<int,int>P;
vector<vector<vector<P> > >v;
int dp[51][51][51][51];
string s[51];
int h,w;
int dfs(int ly,int lx,int ry,int rx){

  int res=-1e7;

  if(ly<0||ry<0||ly>=h||ry>=h)return -1e7;
  if(lx<0||rx<0||lx>=w||rx>=w)return -1e7;
  if(s[ly][lx]=='#'||s[ry][rx]=='#')return -1e7;
  if(ly==ry&&lx==rx)return dp[ly][lx][ry][rx]=0;
  if(ly==ry&&lx==rx+1)return dp[ly][lx][ry][rx]=0;
  if(ly==ry+1&&lx==rx)return dp[ly][lx][ry][rx]=0;
  if(ly==ry+1&&lx==rx+1)return dp[ly][lx][ry][rx]=0;
  if(ly>ry||lx>rx)return -1e7;
  if(dp[ly][lx][ry][rx]!=-1e8)return dp[ly][lx][ry][rx];

  res=max(res,dfs(ly+1,lx,ry,rx));
  res=max(res,dfs(ly,lx+1,ry,rx));
  res=max(res,dfs(ly,lx,ry-1,rx));
  res=max(res,dfs(ly,lx,ry,rx-1));

  if(islower(s[ly][lx])){

    if(isupper(s[ry][rx])&&s[ly][lx]==tolower(s[ry][rx])){
      res=max(res,dfs(ly+1,lx,ry-1,rx)+1);
      res=max(res,dfs(ly,lx+1,ry-1,rx)+1);
      res=max(res,dfs(ly+1,lx,ry,rx-1)+1);
      res=max(res,dfs(ly,lx+1,ry,rx-1)+1);
    }

    else r(i,v[ly][lx].size()){
      int y=v[ly][lx][i].first;
      int x=v[ly][lx][i].second;
      if(!(ly<=y&&y<=ry&&lx<=x&&x<=rx))continue;
      res=max(res,dfs(ly,lx,y,x)+dfs(y,x,ry,rx));
    }

  }

  return dp[ly][lx][ry][rx]=res;
}
int main(){
  while(cin>>h>>w,h){
    r(i,51)r(j,51)r(k,51)r(l,51)dp[i][j][k][l]=-1e8;
    v.clear();
    v.resize(h,vector<vector<P> >(w));
    r(i,h)cin>>s[i];
    r(i,h)r(j,w)r(y,h)r(x,w){
      if(i<=y&&j<=x){
        if(islower(s[i][j])&&isupper(s[y][x])){
          if(s[i][j]==tolower(s[y][x])){
            v[i][j].push_back(P(y,x));
          }
        }
      }
    }
    cout<<(dfs(0,0,h-1,w-1)<0?-1:dp[0][0][h-1][w-1])<<endl;
  }
}


Measured memory_bytes: 29652
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define SORT(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
int main()
{
	int n,m,now,ans;
	cin >> n;
	cin >> m;
	now=m;
	ans=m;
	for(int i=0;i<n;i++)
	{
		int a,b;
		cin >> a >> b;
		now=now+a-b;
		if(now<0)
		{
			cout << 0 << endl;
			return 0;
		}
		ans=max(ans,now);
	}
	cout << ans << endl;
	return 0;
}

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

#define pb push_back
#define eb emplace_back
#define ff first
#define ss second
#define endl '\n'
#define boost ios::sync_with_stdio(false) ; cin.tie(NULL); cout.tie(NULL);

const int N = 3001;
pair<int , pair<int,int> >  dp[3001][3001];

template < class T > T maxx(T a , T b){
    
    if(a>b)
        return a;
    return b;
}

signed main(){

   string a , b;
   cin>>a>>b;

   int n = a.size();
   int m = b.size();

   for(int i = 1 ; i <= n ; ++i)
    for(int j = 1 ; j <= m ; ++j){

        if(a[i-1]==b[j-1]){
            dp[i][j].ff = 1 + dp[i-1][j-1].ff;
            dp[i][j].ss = {i-1,j-1};
        }
        else{
           dp[i][j] = maxx(dp[i][j-1],dp[i-1][j]);
        }
    }

   // cout<<dp[n][m].ff<<endl;
    string s;
    pair<int,int> prev = dp[n][m].ss;
    pair<int,int> zero;
    zero = {0,0};
    while(1){

        s.pb(a[prev.ff]);
        if(prev==zero)
            break;
        prev = dp[prev.ff][prev.ss].ss;
    }
    reverse(s.begin(),s.end());

    if(s.size()>dp[n][m].ff)
        s.erase(s.begin());
    cout<<s<<endl;
}

Measured memory_bytes: 105728
#include<bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long
#define ld long double
#define pll pair<ll,ll>
#define vll vector<pll>
#define vl vector<ll>
#define f first
#define s second
#define N 50000
#define pb push_back
#define MAP map<ll,ll>
#define MAPs map<<ll,sl>
#define MAPv map<ll,vl>
#define  mset(x,val) memset(x,val,sizeof(x))
#define mod 1000000007
#define foo(i,a,b) for(ll i=(a);i<=(b);i++)
#define rep(i,a,b) for(ll i=(a);i>=(b);i--)
#define FOR(i,v) for(auto &(i):(v))
#define sl set<ll>
#define sll set<pll>
#define ub upper_bound
#define lb lower_bound
using namespace std;

const ll   INF = 0x7f7f7f7f7f7f7f7f;
const ll NINF = -INF;
const ll MAXN  = 1e+6 + 8;

int dx8[] = {0, 1, 1, 1, 0, -1, -1, -1}, dy8[] = {1, 1, 0, -1, -1, -1, 0, 1};
int dx4[] = {0, 1, 0, -1}, dy4[] = {1, 0, -1, 0};
//<<-----Declare Variable Here------->>//
ll n, k, a[200005];
//<<-----Implement Functions Here---->>//


//<<-----Start of Main--------------->>//
void MAIN() {
    cin >> n >> k;
    foo(i, 1, n) cin >> a[i];

    vl v;
    foo(i, k + 1, n) {
        if (a[i] > a[i - k]) {cout << "Yes\n";}
        else cout << "No\n";
    }


}

int main() {
    fastio;
    ll t = 1;
    // cin>>t;
    while (t--) {
        MAIN();
    }

    // #ifndef ONLINE_JUDGE
    // cout<<"\nTime Elapsed: " << 1.0*clock() / CLOCKS_PER_SEC << " sec\n";
    // #endif
}

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

int main(){
    int A,B,C;
    cin>>A>>B>>C;
    vector<int>vec(3);
    vec={A,B,C};
    sort(vec.begin(),vec.end());
    int sum=vec[2]*10+vec[1]+vec[0];
    cout<<sum<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
using namespace std;
int main(){
  int a[100][100],b[1000];
  int n,m,i,j,c=0;
  scanf("%d %d",&n,&m);
  for(i=0;i<n;i++){
    for(j=0;j<m;j++){
      scanf("%d",&a[i][j]);
    }
  }
  for(j=0;j<m;j++){
scanf("%d",&b[j]);
  }
  for(i=0;i<n;i++){
    for(j=0;j<m;j++){
      c+=a[i][j]*b[j];
    }
   printf("%d\n",c);
   c=0;
 
  }  
return 0;
}

Measured memory_bytes: 1228
/*	
*  Sachin Mittal
*/
#include<bits/stdc++.h>
#define int long long
#define M 998244353
#define mod 1000000007
#define all(v) v.begin(),v.end()
#define rep(i,j,n) for(int i=j;i<n;i++)
#define F first
#define S second
#define lb lower_bound
#define mem0(dp) memset(dp,0,sizeof(dp))
#define mem1(dp) memset(dp,-1,sizeof(dp))
#define pb push_back
#define sz(s) (int)(s.size())
#define debug(x) cout << #x << " = " << x << '\n';
using namespace std;

void solve()
{
    int k, a, b;
    cin >> k >> a >> b;
    rep(i,a,b+1){
    	if(i%k==0){
    		cout<<"OK\n";
    		return;
    	}
    }
    cout<<"NG";
}

int32_t main(){
ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
int tst=1;
//cin>>tst;
while(tst--)
{
	solve();
}
}

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

int main() {
    
    int N;
    string S;
    cin >> S;
    N = S.size();
    char pre = S.at(0);
    int count = 0;
    for(int i=1;i<N;i++){
        if(pre == S.at(i)){
            count++;
            if(pre=='0'){
                pre = '1';
            }else{
                pre = '0';
            }
        }else{
            pre = S.at(i);
        }
    }
    cout << count;

    return 0;

}

Measured memory_bytes: 512
function GCD() {
  m=$1 n=$2
  if ((m<n)); then
    ((tmp=n,n=m,m=tmp))
  fi
  while ((n)); do
    ((tmp=n,n=m%n,m=tmp))
  done
  echo $m
}

function LCM() {
  m=$1 n=$2
  echo $(((m*n)/$(GCD $m $n)))
}

read A B C D
echo $((
  A--,
  lcm=$(LCM $C $D),
  (B-A)-((B/C-A/C)+(B/D-A/D)-(B/lcm-A/lcm))
))

Measured memory_bytes: 632
/*input
30
001110011011011101010111011100
*/
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define F first
#define S second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define eb emplace_back
#define pb push_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define EL cout<<'\n'
template<typename T1,typename T2>
ostream& operator<<(ostream& out,pair<T1,T2> P){
	out<<'('<<P.F<<','<<P.S<<')';
	return out;
}
template<typename T>
ostream& operator<<(ostream& out,vector<T> V){
	REP(i,SZ(V)) out<<V[i]<<((i!=SZ(V)-1)?" ":"");
	return out;
}
#define version 20190814
//}}}
const ll maxn=400005;
const ll maxlg=20;
const ll INF64=1e18;
const int INF=0x3f3f3f3f;
const ll MOD=998244353;
const ld PI=acos(-1);
const ld eps=1e-9;
//const ll p=880301;
//const ll P=31;

ll mypow(ll a,ll b){
	ll res=1LL;
	while(b){
		if(b&1) res=res*a%MOD;
		a=a*a%MOD;
		b>>=1;
	}
	return res;
}

int n;
string s;

bool ok[maxn];

ll cnt[maxn];

ll ex[maxn];

void check(int k){
	if(n/k%2==0) return;

	ok[k+k]=1;

	ll ret=0;
	for(int i=0;i<k;i++){
		ret=ret*2+(s[i]=='1');
		if(ret>=MOD) ret-=MOD;
	}
	string tmp=string(s,0,k);
	string t;
	REP(i,n/k){
		if(i%2){
			for(char c:tmp) t.pb(char('1'+'0'-c));
		}
		else{
			for(char c:tmp) t.pb(c);
		}
	}	
	if(t<=s) ret++;
	if(ret==MOD) ret-=MOD;
	cnt[k+k]=ret;
	// cout<<k<<' '<<ret<<'\n';
}

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

	ex[0]=1;
	for(int i=1;i<=n;i++){
		ex[i]=ex[i-1]<<1;
		if(ex[i]>=MOD) ex[i]-=MOD;
	}

	for(int i=1;i*i<=n;i++) if(n%i==0){
		check(i);
		check(n/i);
	}
	ll ans=0;
	for(int i=1;i<=n+n;i++) if(ok[i]){
		for(int j=i+i;j<maxn;j+=i) if(ok[j]){
			cnt[j]-=cnt[i];
			if(cnt[j]<0) cnt[j]+=MOD;
		}
		ans=(ans+i*cnt[i])%MOD;
	}
	cout<<ans<<'\n';
	return 0;
}


Measured memory_bytes: 6668
S = input().strip()

# 左右から詰めていく
l = 0
r = len(S)-1
ans = 0
while l != r and l <= r:
  if S[l] == 'x' and S[r] != 'x':
    l += 1
    ans += 1
  elif S[l] != 'x' and S[r] == 'x':
    r -= 1
    ans += 1
  elif S[l] != S[r]:
    print(-1)
    exit()
  else:
    l += 1
    r -= 1
  
print(ans)

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

#define ll long long
#define rep(i,x,y) for(int i=x;i<y;i++)
#define rel(i,x,y) for(int i=x-1;i>=y;i--)
#define all(x) x.begin(),x.end()

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int r;
    cin >> r;
    cout << r * r << endl;
}

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();
		int count = 0;
		
		for(int i = 1; i <= 3; i++) {
			if(a*b*i % 2 == 1) {
				count++;
			}
		}
		if(count == 0) {
			System.out.println("No");
		}else {
			System.out.println("Yes");
		}
	}

}

Measured memory_bytes: 23632
#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <cmath>
#include <iomanip>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <algorithm>
#include <random>
#define ll long long
#define fr(i,k,N) for(ll i=k; i<N;i++)
#define rep(i,N) for(ll i=0; i<N;i++)
#define alll(v) v.begin(),v.end()
using namespace std;
template <class X> void pr(X test){cout<<test<<endl;}
template <class X> void prr(X test){for(auto it:test){cout<<it;}cout<<endl;}

int main(){
    string s;
    ll n;
    cin>>n;
    vector<ll> v(5,0);
    rep(i, n) {
        cin >> s;
        if(s[0]=='M') v[0]++;
        if(s[0]=='A') v[1]++;
        if(s[0]=='R') v[2]++;
        if(s[0]=='C') v[3]++;
        if(s[0]=='H') v[4]++;
    }
    ll sum=0;
    rep(i, 5) fr(j,i, 4) fr(k,j, 3)
    for (i=0; i<5; i++) {
        for (j=i+1; j<5; j++) {
            for (k=j+1; k<5; k++) {
                sum+=v[i]*v[j]*v[k];}}
    }
    pr(sum);
    return 0;
}



Measured memory_bytes: 888
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<algorithm>
#include<vector>
#include<string>
using namespace std;
#define rep2(x,from,to) for(int x=from;x<to;x++)
#define rep(x,to) rep2(x,0,to)
int n;
string s;
int b[100006];
int a[100006];
int ans,m;
int main()
{
    cin>>n;
    cin>>m;
    cin>>s;
    rep(i,n-1)
    {
        if(s[i]==s[i+1])
        {
            ans++;
        }
    }
    rep(i,m)
    {
        
            ans=min(ans+2,n-1);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 512
#[allow(unused_imports)]
use std::io::{stdin, Read, StdinLock};
#[allow(unused_imports)]
use std::cmp::{max, min, Ordering};
#[allow(unused_imports)]
use std::str::FromStr;
#[allow(unused_imports)]
use std::collections::{HashSet, HashMap, BinaryHeap};
#[allow(unused_imports)]
use std::vec::Vec;

#[allow(dead_code)]
const INF: i32 = 1000_000_000;
#[allow(dead_code)]
const INFLL: i64 = 1000_000_000_000_000_000;
#[allow(dead_code)]
const EPS: f64 = 1.0e-10;
#[allow(dead_code)]
const MOD: i32 = 1000_000_007;

struct Scanner<'a> {
    cin: StdinLock<'a>,
}

impl<'a> Scanner<'a> {
    #[allow(dead_code)]
    fn new(cin: StdinLock<'a>) -> Scanner<'a> {
        Scanner {cin: cin}
    }

    #[allow(dead_code)]
    fn read1<T: FromStr>(&mut self) -> Option<T> {
        let token = self.cin.by_ref().bytes().map(|c| c.unwrap() as char)
                    .skip_while(|c| c.is_whitespace())
                    .take_while(|c| !c.is_whitespace())
                    .collect::<String>();
        token.parse::<T>().ok()
    }

    #[allow(dead_code)]
    fn read<T: FromStr>(&mut self) -> T {
        self.read1().unwrap()
    }
}

fn main() {
    let cin = stdin();
    let cin = cin.lock();
    let mut sc = Scanner::new(cin);
    let n: usize = sc.read();
    let mut a: Vec<i32> = vec![0; n];
    for i in 0..n {
        a[i] = sc.read();
    }

    let mut idx = 0;
    for i in 0..n {
        if a[idx].abs() < a[i].abs() {
            idx = i;
        }
    }
    println!("{}", 2 * n - 2);
    for i in 0..n {
        if i == idx { continue; }
        println!("{} {}", idx + 1, i + 1);
        a[i] += a[idx];
    }
    if a[idx] < 0 {
        for i in 0..n-1 {
            println!("{} {}", n - i, n - i - 1);
            a[n - i - 2] += a[n - i - 1];
        }
    } else {
        for i in 0..n-1 {
            println!("{} {}", i + 1, i + 2);
            a[i + 1] += a[i];
        }
    }
    //for x in a {
    //    println!("{}", x);
    //}
}

Measured memory_bytes: 4476
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define M1 1000000007
#define M2 998244353
#define fl(i,a,b) for(ll i=a;i<b;i++)
#define ifl(i,a,b) for(ll i=b-1;i>=a;i--)
#define V(a) vector<a>
#define bn "\n"

const int inf=1e9+5;


ll modI(ll a,ll m);
ll gcd(ll a,ll b);
ll powM(ll x,ll y,ll m);
ll swap(ll a,ll b);
ll maxm(ll a,ll b,ll c);
ll addself(ll& a,ll b);

ll addself(ll& a,ll b)
{
    a=a+b;
}

ll maxm(ll a,ll b,ll c)
{
  ll temp =max(a,b);
  temp=max(temp,c);
  return temp;
}

void swap(ll& a,ll& b)
{
    ll tp=a;
    a=b;
    b=tp;
}

ll gcd(ll x,ll y)
{
    if(x==0) return y;
    return gcd(y%x,x);
}

ll powM(ll x,ll y,ll m)
{
    ll ans=1,r=1;
    x%=m;
    while(r>0&&r<=y)
    {
        if(r&y)
        {
            ans*=x;
            ans%=m;
        }
        r<<=1;
        x*=x;
        x%=m;
    }
    return ans;
}
 
ll modI(ll a, ll m)
{
    ll m0=m,y=0,x=1;
    if(m==1) return 0;
    while(a>1)
    {
        ll q=a/m;
        ll t=m;
        m=a%m;
        a=t;
        t=y;
        y=x-q*y;
        x=t;
    }
    if(x<0) x+=m0;
    return x;
}

int main() {
	
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(0);
	int t=1;
    //cin>>t;
	while(t--)
	{
	   int n,k;
	   cin>>n>>k;
	   vector< int > h(n);
	   fl(i,0,n)
	   cin>>h[i];
	   vector< int >dp(n,inf);
	   dp[0]=0;
	   fl(i,0,n)
	   {
	       fl(j,i+1,i+k+1)
	       {
	           if(j<n)
	           {
	               dp[j]=min(dp[j],dp[i]+abs(h[i]-h[j]));
	           }
	       }
	   }
	   
	   cout<<dp[n-1]<<bn;
	 
	}
	
	return 0;
}


Measured memory_bytes: 1024
# coding: utf-8
# Your code here!

l,r = map(int,input().split())

modl = [0 for i in range(2019)]

if r - l > 2019:
    modl = [1 for i in range(2019)]
else:
    for i in range(l,r+1):
        modl[i%2019] = 1

ans = float("inf")
for i in range(2019):
    for j in range(i+1, 2019):
        if modl[i] == 1 and modl[j] == 1:
            tmp = i * j % 2019
            if tmp < ans:
                ans = tmp
print(ans)

Measured memory_bytes: 41436