akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#include <complex>
#include <cctype>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <assert.h>
#include <numeric>
#include <iomanip>
#define rep(i, a, b) for (int(i) = (a); i < (b); i++)
#define all(i) i.begin(),i.end()
#define debug(i) std::cout << i << "\n"

using ll = long long;
using P = std::pair<int, int>;

const int INF = 100000000;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll MOD = 1000000007;


int main()
{
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	//問題文中の添え字が0-indexか1-indexか確認!
    int n,a,b;
    std::cin>>n>>a>>b;
    if(n*a>b){
        std::cout<<b;
    }else{
        std::cout<<n*a;
    }
    return 0;
}

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

S = []
for _ in range(M):
    tmp = [int(x) for x in input().split()]
    k = tmp[0]
    S.append(tmp[1:])
P = [int(x) for x in input().split()]

ret = 0
# bitでN個のスイッチ押し方の全パターンを列挙する方針
for pt in range(1<<N):
    allOn = True
    # 電球iが点灯するかどうか
    for i in range(M):
        cnt = 0     # 電球iに対応したスイッチの中で押した数 
        for s in S[i]:
            if pt & (1 << (s-1)):
                cnt += 1
        if cnt % 2 != P[i]:
            allOn = False
    if allOn:
        ret += 1

print(ret)


    

Measured memory_bytes: 3064
#include<cstdio>
#include<cmath>
#include<string>
#include<iostream>
#include<algorithm>
#include<utility>
#include<vector>
#include<map>
#include<set>
#include<limits>
#include<bitset>
#include<array>
#include<numeric>
#include<iomanip>
#include<functional>

using namespace std;
typedef long long int ll;

#define C(I) cout<<(I)<<endl

ll n,m,a,b,c,x,y,aa[100010],ba[100010];
bool r,br,ar;
string sa,sb,sc;
char ca,cb;


int main(){
    
    cin>>sa>>sb>>sc;
    a=int('A')-int('a');
    cout<<char(sa[0]+a)<<char(sb[0]+a)<<char(sc[0]+a)<<endl;
    
    
    
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define ll long long
#define ld long double
#define all(a) (a).begin(),(a).end()
int main(){
  ll x;
  cin>>x;
  ld deposit=100;
  rep2(i,1,3761){
    deposit=floor(deposit*1.01/1);
    if(deposit>=x){
      cout<<i<<endl;
      return 0;
    }
 } 
return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
//#define int lint
typedef long long lint;
typedef pair<int,int> P;
const int    INF=(int)1e9;
const int    MOD=(int)1e9+7;
const double EPS=(double)1e-10;
struct Accelerate_Cin{
    Accelerate_Cin(){
        cin.tie(0); ios::sync_with_stdio(0);cout<<fixed<<setprecision(20);
    };
};



signed main(){
  int N;cin>>N;
  int s[110],sum=0;
  priority_queue<int>q;

  for(int t=0;t<N;t++){
    cin>>s[t];
    if(s[t]%10!=0)q.push(-s[t]);
    sum+=s[t];
  }

  int ans=0;
  if(sum%10!=0){
    ans=sum;
  }else{
    if(!q.empty())ans=sum+q.top();
  }
  if(ans%10==0)ans=0;

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


Measured memory_bytes: 256
n,m,x=map(int,input().split())
lis=[]
for i in range(n):
  lis.append(list(map(int,input().split())))

keep=10**100
for i in range(0,2**n):
  rikai=[0]*m
  moji=""
  calc=i
  res=0
  for j in range(0,n):
    j=n-1-j
    onezero=calc//(2**j)
    moji+=str(onezero)
    calc-=onezero*(2**j)
  for k in range(0,n):
    if moji[k]=="1":
      res+=lis[k][0]
      for l in range(1,m+1):
        rikai[l-1]+=lis[k][l]
  prep=1
  for z in range(0,m):
    if rikai[z]<x:
      prep=0
  if prep==1:
    if res<keep:
      keep=res

      
if keep==10**100:
  print(-1)
else:
  print(keep)
      
      

Measured memory_bytes: 9196
#include"bits/stdc++.h"
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
const long long mod = 1000000007;
const long long inf = 11451419198109130;
typedef pair<int, int> P;
typedef pair<int, P> PP;
struct edge { int to; int to2; int cost; };
int a[100005];
int b[100005];
int rwa[100005],rwa2[100005];
int bit[100005];
int n; 

int sum(int i) {
	int s = 0;
	while (i>0) {
		s += bit[i];
		i -= i&-i;
	}return s;
}

void add(int i, int x) {
	while (i <= n) {
		bit[i] += x;
		i += i&-i;
	}
}
void init(int n) {
	rep(i, n + 1) {
		rwa[i] = 0;
		bit[i] = 0;
	}
}

signed main() {
	cin >> n;
	rep(i, n)cin >> a[i];
	rep(i, n)b[i] = a[i];
	sort(b, b + n);
	int lb = -1, ub = n;
	int M = n * (n + 1) / 4 + 1;

	while (ub - lb > 1) {
		init(n);
		int mi = (ub + lb) / 2;
		int A = b[mi];
		rep(i, n) {
			if (a[i] <= A)rwa[i + 1] = -1;
			else rwa[i + 1] = 1;
		}
		rep(i, n)rwa[i + 1] += rwa[i];

		map<int, int>M1,M2;
		rep(i, n + 1) {
			M1[rwa[i]]++;
		}
		int cnt = 0;
		for (auto itr = M1.begin(); itr != M1.end(); itr++) {
			M2[itr->first]=cnt;
			cnt++;
		}
		rep(i, n + 1) {
			rwa[i] = M2[rwa[i]]+1;
		}

		int res = 0;
		rep(i, n+1) {
			res += i - sum(rwa[i]);
			add(rwa[i], 1);
		}

		//cout << res << endl;
		if (res < M) {
			lb = mi;
		}
		else ub = mi;
	}
	cout << b[ub] << endl;
}

Measured memory_bytes: 15872
#include <stdio.h>
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))

char s[110][110];
int a[110][110];
int main(){
	int n,m;
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++)scanf("%s",&s[i][1]);
	for(int i=1;i<=n;i++)for(int j=1;j<=m;j++){
		if(s[i][j]=='o')a[i][j-1]=a[i][j]=a[i][j+1]=1;
		if(s[i][j]=='x')for(int ii=-1;ii<=1;ii++)for(int jj=-1;jj<=1;jj++)a[i+ii][j+jj]=1;
	}
	int ans=0;
	for(int i=2;i<=n;i++)for(int j=1;j<=m;j++)if(!a[i][j]&&s[i][j]=='-')ans++;
	printf("%d\n",ans);
}


Measured memory_bytes: 2148
import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;

public class Main {
    public static void main(String[] args)throws Exception {
        StringBuilder sb = new StringBuilder();
        FastReader in = new FastReader(System.in);
        int i, j;
        boolean ok=false;
        int t=ok?in.nextInt():1;
        while(t-->0){
           int h1=in.nextInt();
           int m1=in.nextInt();
           int h2=in.nextInt();
           int m2=in.nextInt();
           int k=in.nextInt();
           int time=(60-m1) + (h2-h1-1)*60 +(m2);
           sb.append(time-k).append("\n");
        }
        System.out.print(sb);

    }
}

class FastReader {

    byte[] buf = new byte[2048];
    int index, total;
    InputStream in;

    FastReader(InputStream is) {
        in = is;
    }

    int scan() throws IOException {
        if (index >= total) {
            index = 0;
            total = in.read(buf);
            if (total <= 0) {
                return -1;
            }
        }
        return buf[index++];
    }

    String next() throws IOException {
        int c;
        for (c = scan(); c <= 32; c = scan()) ;
        StringBuilder sb = new StringBuilder();
        for (; c > 32; c = scan()) {
            sb.append((char) c);
        }
        return sb.toString();
    }

    int nextInt() throws IOException {
        int c, val = 0;
        for (c = scan(); c <= 32; c = scan()) ;
        boolean neg = c == '-';
        if (c == '-' || c == '+') {
            c = scan();
        }
        for (; c >= '0' && c <= '9'; c = scan()) {
            val = (val << 3) + (val << 1) + (c & 15);
        }
        return neg ? -val : val;
    }

    long nextLong() throws IOException {
        int c;
        long val = 0;
        for (c = scan(); c <= 32; c = scan()) ;
        boolean neg = c == '-';
        if (c == '-' || c == '+') {
            c = scan();
        }
        for (; c >= '0' && c <= '9'; c = scan()) {
            val = (val << 3) + (val << 1) + (c & 15);
        }
        return neg ? -val : val;
    }
}
 
 

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

#define rep(i,N) for(int i=0;i<N;i++)
#define rep2(i,N) for(int i=1;i<=N;i++)
using namespace std;
long long  INF=1e18;
long long mod=1e9+7;

//status unsolved

int main(){
    long long n,k;
    cin>>n>>k;
    long long sum[n+2];
    sum[0]=0;
    rep2(i,n){
        sum[i]=sum[i-1]+i;
    }
    long long ans=0;
    for(long long  i=k;i<=n+1;i++){
        long long  m=sum[i-1];
        long long  M;
        if(i<n+1)M=sum[n]-sum[n-i];
        else{
            M=sum[n];
        }
        ans+=M-m+1;
        ans%=mod;
        //cout<<ans<<endl;
        //if(ans>mod)ans%=mod;
    }
    cout<<ans<<endl;
    return 0;

}

/*
    long long ten_mod=10;
    rep(l,99){
        ten_mod*=100;
        if(ten_mod>mod)ten_mod%=mod;
    }
    cout<<ten_mod<<endl;
    */




Measured memory_bytes: 5136
a = int(input())
# w = list(map(int, input().split()))
#n, k = list(map(int, input().split()))
#a = list(map(int, input().split()))
# data = [list(map(int, input().split())) for i in range(n)]
#q = int(input())
#p = list(map(int, input().split()))
#a = list(map(int, input().split()))
# ab_sorted = sorted(ab, key=lambda x: x[0])
#bc = [list(map(int, input().split())) for i in range(q)]
# print(min(15*n, 100*(n//10+1), 100*(n//10)+15*(n % 10)))
print(a+a*a+a*a*a)

Measured memory_bytes: 9148
n = gets.to_i
v = gets.strip.split.map(&:to_i)
c = gets.strip.split.map(&:to_i)
sum = 0
k = 0
while k < n do
  if v[k]-c[k] > 0
     sum += v[k]-c[k]
  end
  k += 1
end
puts sum

Measured memory_bytes: 14308
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Scanner;

public class Main {

	Scanner sc = new Scanner(System.in);
	public void run() {
		int n = sc.nextInt();
		for(int i = 0; i < n; i++){
			int h = sc.nextInt();
			int w = sc.nextInt();
			calc(h,w);
			
		}
	}
	HashMap<String, int[]> hash;
	String[] stringlist;
	String[][] map;
	
	public void calc(int h, int w){
		hash = new HashMap<String, int[]>();
		stringlist = new String[7];
		map = new String[h][w];
		int count = 0;
		for(int i = 0; i < h; i++){
			String line = sc.next();
			for(int j = 0; j < w; j++){
				String now = line.substring(j, j+1);
				map[i][j] = now;
				if(!now.equals(".")){
					if(!hash.containsKey(now)) {
						hash.put(now, new int[]{i, j, i, j});
						stringlist[count] = now;
						count++;
					}
					else{
						int[] ele = hash.get(now);
						if(ele[0] > i) ele[0] = i;
						if(ele[1] < j) ele[1] = j;
						if(ele[2] < i) ele[2] = i;
						if(ele[3] > j) ele[3] = j;
					}
				}
			}
		}
		ArrayList<String> list = new ArrayList<String>();
		for(int i = 0; i < count; i++){
			list.add(stringlist[i]);
		}
		boolean ans = check(count, list);
		
		if(ans) System.out.println("SAFE");
		else System.out.println("SUSPICIOUS");
	}
	public boolean check(int count, ArrayList<String> list){
		if(list.size() == 0) return true;
		else{
			for(int k = 0; k < count; k++){
				String now = list.get(k);
				int[] ele = hash.get(now);
				boolean ans = true;
				for(int i = ele[0]; i <= ele[2]; i++){
					for(int j = ele[3]; j <= ele[1]; j++){
						if(map[i][j].equals(".")) return false;
						else if(!map[i][j].equals(now) && list.contains(map[i][j])){
							ans = false;
							break;
						}
					}
				}
				if(ans) {
					list.remove(k);
					break;
				}
			}
			if(list.size() == count) return false;
			else return check(count-1, list);
		}
	}

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

Measured memory_bytes: 57232
n = int(input())
num = list(map(int, (input().split(' '))))

flag = 1
if 0 in num:
  print(0)
  flag=0

if flag == 1:  
  ans = 1
  for i in range(n):
    if flag == 1:
      ans *= num[i]
      if ans > 10**18:
        flag = 0
        print('-1')
        break

if flag==1:
  print(ans)

Measured memory_bytes: 21572
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 c = sc.nextInt();
		int d;
		if(a>b){
			d = a;
			a = b;
			b = d;
		}
		if(b>c){
			d = b;
			b = c;
			c = d;
		}
		if(a>b){
			d = a;
			a = b;
			b = d;
		}
		System.out.println(a + " "+ b + " "+ c);
	}
}

Measured memory_bytes: 17160
import sys
sys.setrecursionlimit(10000000)
import copy

n, m = map(int, input().split())
graph = [list() for i in range(n+1)]
for i in range(m):
   a, b = map(int, (input().split()))
   graph[a] += [b]
   graph[b] += [a]

ans = 0

def dfs(visited, now):
    tv = copy.copy(visited)
    tv[now-1] = True
    
    if all(tv):
        return 1

    temp = 0
    for i in graph[now]:
        if tv[i-1] != 1:
            temp += dfs(tv, i)
    return temp

ans = dfs([False] * n, 1)
print(ans)

Measured memory_bytes: 3444
#!/usr/bin/python3

import array
from fractions import Fraction
import functools
import itertools
import math
import os
import sys


def main():
    while True:
        N = read_int()
        if N == 0:
            break
        A = read_ints()
        print(solve(N, A))


def solve(N, A):
    avg = Fraction(sum(A), N)
    return len([a for a in A if a <= avg])


###############################################################################
# AUXILIARY FUNCTIONS

DEBUG = 'DEBUG' in os.environ


def inp():
    return sys.stdin.readline().rstrip()


def read_int():
    return int(inp())


def read_ints():
    return [int(e) for e in inp().split()]


def dprint(*value, sep=' ', end='\n'):
    if DEBUG:
        print(*value, sep=sep, end=end)


if __name__ == '__main__':
    main()



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

long long int N, a[114514], i, r, b;

int main(){
    scanf("%lld", &N);
    r = 1;
    b = -1;
    for(int i = 0; i < N; ++i){
        scanf("%lld", a + i);
        if(i){
            if(b < 0){
                if(a[i - 1] < a[i]){
                    b = 1;
                }else if(a[i - 1] > a[i]){
                    b = 0;
                }
            }
            //cout << a[i] << " " << a[i - 1] << " " << ((b << 1) - 1) << " " << (a[i] - a[i - 1]) * ((b << 1) - 1);
            if((a[i] - a[i - 1]) * ((b << 1) - 1) < 0){
            //    cout << " a";
                ++r;
                b = -1;
            }
            //cout << endl;
        }
    }
    cout << r << endl;
    return 0;
}


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

typedef long long ll;
typedef unsigned long long int ull;
typedef pair<ll,ll> pii;
typedef tuple<ll,ll,ll> tii;
typedef vector<ll> vi;
typedef vector<pii> vii;
typedef map<ll,ll> mi;
typedef map<pii,ll> mii;


#define endl "\n"
#define pb push_back
#define sq(a) (a)*(a)
#define rep(i,a,b) for(int i = a; i < b; i++)
ll mod=1000000007;
#define PI 3.141592653589793238

#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);

ll gcd(ll a, ll b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}

ll exp(ll x,ll n)
{
    ll result=1;
    while(n>0)
    {
        if(n % 2 ==1)
            result=(result * x);
        x=(x*x);
        n=n/2;
    }
    return result;
}



int32_t main()
{
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    
    IOS

    ll n;
    cin>>n;

    for(ll i=0;i<=200;i++)
    {
        for(ll j=-200;j<=200;j++)
        {
            if(exp(i,5)-exp(j,5)==n)
            {
                cout<<i<<" "<<j<<endl;
                return 0;
            }
        }
    }

    cout<<-1<<endl;
    
    return 0;
}


Measured memory_bytes: 3652
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<map>
#include<numeric>
#include<set>
#include<string>
#include<utility>
#include<vector>

#define rep(i, a, n)  for(int i=a; i<n; i++)
#define per(i, a, n)  for(int i=n-1; i>=a; i--)
#define all(x)  (x).begin(), (x).end()
#define MAX 1000000007
using namespace std;
typedef long long ll;

int main(){
  int h, w; cin >> h >> w;
  vector<string> c(h);
  vector<string> lc(2*h);
  rep(i, 0, h)  cin >> c[i];
  rep(i, 0, h){
    lc[2*i]=c[i];
    lc[2*i+1]=c[i];
  }
  rep(i, 0, 2*h)  cout << lc[i] << endl;
  return 0;
}

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

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

    int sLen = s.length();

    if (sLen <= k)
    {
        cout << s << endl;
    }
    else
    {
        for (int i = 1; i <= sLen; ++i)
        {
            if (i <= k)
            {
                cout << s.at(i - 1);
            }
            else
            {
                cout << "..." << endl;

                break;
            }
        }
    }
}

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

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

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

#define MAX 500005
#define INF 1001001001

const int axis_num = 2;

struct Point {
  int id;
  array<int,axis_num> pos;
  Point() : id(-1), pos{0} {}
};

struct Node {
  Point point;
  Node* left;
  Node* right;
  Node(Point p, Node* l, Node* r) : point(p), left(l), right(r) {}
};

Node* makeTree(vector<Point>& ps, int l, int r, int depth) {
  if (l>=r) return NULL;
  int k = depth%axis_num;
  sort(ps.begin()+l, ps.begin()+r, [&](Point a, Point b) { return a.pos[k] < b.pos[k]; });
  int mid = (l+r)/2;
  return new Node(ps[mid], makeTree(ps,l,mid,depth+1), makeTree(ps,mid+1,r,depth+1));
}

void find(Node* nd, Point s, Point t, int depth, vector<int>& ans) {
  Point p = nd->point;
  bool inRange = true;
  rep(k,axis_num) {
    if (p.pos[k] < s.pos[k] || t.pos[k] < p.pos[k]) inRange = false;
  }
  if (inRange) ans.push_back(p.id);

  int k = depth%axis_num;
  if (nd->left != NULL && s.pos[k] <= p.pos[k]) find(nd->left, s, t, depth+1, ans);
  if (nd->right != NULL && t.pos[k] >= p.pos[k]) find(nd->right, s, t, depth+1, ans);
}

int main(int, char**)
{
  int n;
  cin >> n;
  vector<Point> ps;
  rep(i,n) {
    Point p;
    p.id = i;
    rep(k,axis_num) scanf("%d", &p.pos[k]);
    ps.push_back(p);
  }
  Node* root = makeTree(ps,0,n,0);

  int q;
  cin >> q;
  rep(i,q) {
    vector<int> ans;
    Point s, t;
    rep(k,axis_num) scanf("%d%d", &s.pos[k], &t.pos[k]);
    find(root, s, t, 0, ans);
    sort(ans.begin(), ans.end());
    for(auto a : ans) printf("%d\n", a);
    printf("\n");
  }

  return 0;
}



Measured memory_bytes: 31488
#include <iostream>
using namespace std;
int main(){
  int A[3][3];
  int B[3][3] = {};
  for(int i=0;i<3;++i) {
    for(int j=0;j<3;++j) {
      cin >> A[i][j];
    }
  }
  int N;
  cin >> N;
  int b[N];
  int aa, bb, cc;
  for(int k=0;k<N;++k) {
    aa = k;
    cin >> b[k];
    for(int ii=0;ii<3;++ii) {
      bb = ii;
      for(int jj=0;jj<3;++jj) {
        cc = jj;
        if(A[bb][cc]==b[aa]) B[bb][cc] = 1;
      }
    }
  }
  bool flag = false;
  int d;
  for(int kk=0;kk<3;++kk) {
    d = kk;
    if(B[0][d]==1&&B[1][d]==1&&B[2][d]==1) flag = true;
    if(B[d][0]==1&&B[d][1]==1&&B[d][2]==1) flag = true;
  }
  if(B[0][0]==1&&B[1][1]==1&&B[2][2]==1) flag = true;
  if(B[0][2]==1&&B[1][1]==1&&B[2][0]==1) flag = true;
  if(flag) cout << "Yes";
  if(!flag) cout << "No";
}


Measured memory_bytes: 256
#include<bits/stdc++.h>  
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long
#define all(v) v.begin(),v.end()
#define rep(i,a,b) for(int i = a; i <=b; i++)
#define rep2(i,a,b) for(int i = a; i>=b; i--)
#define PB push_back 
#define MP make_pair
#define db long double
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
#define cases int testcases;cin>>testcases; while(testcases--)
#define INF 2000000000
const double PI = acos(-1);
const int N = 100005;
#define eps 1e-6
#define MOD 1000000007
  int32_t main() 
  {
    IOS




        string a,b;

        int x,y;
        cin >> x >> y;


        for(int i = 0 ; i < y; i++)
        {
          a.PB(x + '0');
        }

        for(int i = 0 ; i < x; i++)
        {
          b.PB(y + '0');
        }


        if(a<b)
        {
          cout << a;
        }
        else
        {
          cout << b;
        }




    return 0;
      }
        

Measured memory_bytes: 256
#include <stdio.h>


int main(){

	int W,a,b;

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

	if(a+W<b){printf("%d\n",b-a-W);}
	else if(b+W<a){printf("%d\n",a-b-W);}
	else{printf("0\n");}

	return 0;
}

Measured memory_bytes: 128
package main

import (
	"errors"
	"fmt"
	"math"
)




func main() {

	var A,B int64
	fmt.Scan(&A,&B)


	var gcd int64
	gcd, _ = GCD(A,B)

	var ans map[int64]int64
	ans = MapPrimeFactors(gcd)


	fmt.Println(len(ans) + 1)

}

func GCD(a, b int64) (int64, error) {
	ret := int64(-1)

	var n int64
	for n = 1; n*n <= a; n++ {
		if a%n == 0 {
			if b%n == 0 {
				ret = int64(math.Max(float64(n), float64(ret)))
			}

			t := a / n
			if b%t == 0 {
				ret = int64(math.Max(float64(t), float64(ret)))
			}
		}
	}

	if ret == -1 {
		return ret, errors.New("empty!")
	} else {
		return ret, nil
	}
}

//MAPで返す mapの大きさが素因数の種類を表す
func MapPrimeFactors(n int64) map[int64]int64 {
	ret := make(map[int64]int64)

	for n % 2 == 0 {
		ret[2]++
		n /= 2
	}

	var i int64
	for i = 3; i * i <= n; {
		if n % i == 0 {
			ret[i]++
			n /= i
		} else {
			i += 2
		}
	}

	if n != 1 {
		ret[n]++
	}

	return ret
}

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

int main(){
  int N,M;
  cin>>N>>M;
  vector<int> a(M);
  vector<int> b(M);
  for(int i=0; i<M; i++){
    cin>>a.at(i)>>b.at(i);
  }
  for(int j=1; j<=N; j++){
    int c=0;
    for(int k=0; k<M; k++){
      if(a.at(k)==j)
        c++;
      else if(b.at(k)==j)
        c++;
    }
    cout<<c<<endl;
  }
}

Measured memory_bytes: 256
/**
 * @Author: harshkhajuria
 * @Date:   03-Jun-2019 09:13:25 am
 * @Email:  khajuriaharsh729@gmail.com
 * @Filename: B - AtCoder Beginner Contest 111.cpp
 * @Last modified by:   harshkhajuria
 * @Last modified time: 03-Jun-2019 09:17:10 am
 */


#include <bits/stdc++.h>
#define ll long long
#define mp(a, b) make_pair(a, b)
#define newline cout << endl;
#define ff first
#define ss second
#define pii pair<int, int>
#define pll pair<ll, ll>
#define all(v) v.begin(),v.end()
using namespace std;

template <typename S, typename T> ostream& operator<<(ostream& out, pair<S, T> const& p)
{
	out << '(' << p.ff << ", " << p.ss << ')';
	return out;
}

template <typename T> ostream& operator<<(ostream& out, vector<T> const& v)
{
	int l = v.size();
	for (int i = 0; i < l - 1; i++)
		out << v[i] << ' ';
	if (l > 0)
		out << v[l - 1];
	return out;
}

template <typename T> void trace(const char* name, T&& arg1) { cout << name << " : " << arg1 << endl; }

template <typename T, typename... Args> void trace(const char* names, T&& arg1, Args&&... args)
{
	const char* comma = strchr(names + 1, ',');
	cout.write(names, comma - names) << " : " << arg1 << " | ";
	trace(comma + 1, args...);
}

/*Input*/
/*Input*/

bool solve(int n){
  bool f = 1;
  int dig = n%10;
  while(n){
    int temp = n%10;
    if(dig!=temp) f=0;
    n/=10;
  }
  return f;
}

int main()
{
	//ios::sync_with_stdio(false);
	//cin.tie(0);
	//cout.tie(0);
	clock_t tStart = clock();
	int test;
	test = 1;
	// cin >> test;
	while (test--) {
    int n;
    cin >> n;
    while(true){
      if(solve(n)){
        cout << n << endl;
        break;
      }
      n++;
    }
	}
#ifdef LOCAL_DEFINE
	printf("Time taken: %.2fs\n", (double)(clock() - tStart) / CLOCKS_PER_SEC);
#endif
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int a[6],k; 
int main() {
	for(int i=1;i<=5;i++)
		scanf("%d",&a[i]);
	scanf("%d",&k);
	if(a[5]-a[1]<=k) cout<<"Yay!";
	else cout<<":(";
	return 0;
}

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

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

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

  vi a(n);
  rep(i, n) cin >> a.at(i);

  ll money = 1000;
  ll kabu = 0;
  int start = a.at(0);
  for (int i = 1; i < n; i++) {
    if (start < a.at(i)) {
      kabu = money / start;
      money = money % start;
      ll sell = a.at(i) * kabu;
      money += sell;
      kabu = 0;
      start = a.at(i);
    } else {
      start = a.at(i);
    }
  }
  cout << money << endl;

  return 0;
}

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

#define rep(i,n) for(int i=0 ; i<(n) ; i++)
#define repr(i,n) for(int i=(n) ; i>=0 ; i--)
#define ALL(x) (x).begin(),(x).end()

typedef long long ll;
typedef unsigned long long ull;
 
const ll INF = 1LL<<60;
const int MINF = 1e9;
const int MOD = 1e9+7;

using vi = vector<int>;
using vii = vector<vi>;

template<typename T> bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<typename T> bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

template<typename T>
T GCD(T a,T b){ return b ? GCD(b,a%b) : a ;}
template<typename T>
T LCM(T a,T b){ return a*b / GCD(a,b) ;}


int main(){
    int n;cin >> n;
    vi ord(n);
    iota(ALL(ord),1);
    vi P(n);rep(i,n)cin >> P[i];
    vi Q(n);rep(i,n)cin >> Q[i];

    int a,b;a = b = 0;
    int count = 1;
    do{
        if(ord == P)a = count;
        if(ord == Q)b = count;
        count++;
    }while(next_permutation(ALL(ord)));

    cout << abs(a-b) << endl;
    return 0;
}

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

using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define all(i) (i).begin(), (i).end()
#define rall(i) (i).begin(), (i).end(), greater<int>()
#define int long long
#define elif else if
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fst first
#define sec second
#define mod 1000000007
#define INF 10e10
template <typename T>

void print(T x)
{
	std::cout << x << " ";
}

template <typename T>

void println(T x)
{
	std::cout << x << "\n";
}


signed main(void) {
	int n, a;
	cin >> n >> a;
	if (n % 500 > a)print("No");
	else print("Yes");
}

Measured memory_bytes: 3600
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>
//#include <boost/lexical_cast.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace std;
using namespace __gnu_pbds;
#define int long long
#define pb push_back
#define mp make_pair
#define endl '\n'
#define PI acos(-1)
typedef tree<int,null_type,less_equal <int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;

long mod=1e9+7;
signed main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int n;
	cin>>n;
	int ans=0;
	for(int i=1;i*i<=n;i++)
	{
		if(n%i==0)
		{
			if(n/i==i)
			{
				int temp=n/i-1;
				if(temp>i)
					ans+=temp;
			}
			else
			{
				int a=n/i,b=i;
				int temp=n/a-1;
				if(temp>a)
					ans+=temp;
				temp=n/b-1;
				if(temp>b)
					ans+=temp;
			}
		}
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for (int i=0;i<(n);i++)
#define FOR(i,s,e) for (int i=s;i<(e);i++)
#define All(v) (v).begin(),(v).end()
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define int long long
using namespace std;
typedef long long llint;
typedef pair<int, int> P;
const int MOD = (int)1e9 + 7;
const int INF = (int)1e18 * 5;

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

    int a, b, c, x;
    cin >> a >> b >> c >> x;
    
    int ans = 0;
    REP(i, a+1)REP(j, b+1)REP(k, c+1){
        if(i*500+j*100+k*50 == x) ans++;
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <iomanip>
using namespace std;
typedef long long ll;

struct line{
    ll a,b,c;
};

bool comp(line& l1,line& l2){
    if(l2.b*l1.b>0) return -l1.a*l2.b < -l2.a*l1.b;
    else return -l1.a*l2.b > -l2.a*l1.b;
}

bool comp2(line& l1,line& l2){
    if(l2.a*l1.a>0) return -l1.b*l2.a < -l2.b*l1.a;
    else return -l1.b*l2.a > -l2.b*l1.a;
}


struct BIT{
private:
    vector<ll> bit;
    int N;
public:
    BIT(){init();}
    BIT(int N):N(N){init();}
    void init(){
        bit.clear();
        bit.resize(N+1,0);
    }
    ll sum(int i){
        ll s = 0;
        while(i>0){
            s += bit[i];
            i -= i&-i;
        }
        return s;
    }
    ll sum_range(int l,int r){
        return (sum(r)-sum(l-1));
    }
    void add(int i,ll x){
        while(i<=N){
        bit[i] += x;
        i += i&-i;
        }
    }
    ll sum0(int i){
        return sum(i+1);
    }
    void add0(int i,ll x){
        add(i+1,x);
    }
};


ll N;
double eps = 1e-9;
int main(){
    cin >> N;
    int a,b,c;
    vector<line> v;
    for(int i=0;i<N;i++){
        cin >> a >> b >> c;
        v.push_back({a,b,c});
    }
    sort(v.begin(),v.end(),comp);
    ll sum = N*(N-1)/2;
    double lx = -1e9,rx = 1e9;
    vector<double> compress;
    BIT bit(N+1);
    for(int t=0;t<70;t++){
        compress.clear();
        bit.init();
        double mx = (lx+rx)/2;
        ll cnt = 0;
        map<double,int> id;
        for(int i=0;i<N;i++){
            double y = 1.0*(v[i].c-v[i].a*mx)/v[i].b;
            compress.push_back(y);
        }
        sort(compress.begin(),compress.end());
        compress.erase(unique(compress.begin(),compress.end()),compress.end());
        int n = compress.size();
        int num = 1;
        for(auto x:compress){
            id[x] = num; num++;
        }
        for(int i=0;i<N;i++){
            double y = 1.0*(v[i].c-v[i].a*mx)/v[i].b;
            cnt += bit.sum_range(1,id[y]);
            bit.add(id[y],1);
        }
        if(cnt<(sum+1)/2) lx = mx;
        else rx = mx;
    }
    sort(v.begin(),v.end(),comp2);
    double ly = -1e9,ry = 1e9;
    for(int t=0;t<70;t++){
        compress.clear();
        bit.init();
        double my = (ly+ry)/2;
        ll cnt = 0;
        map<double,int> id;
        for(int i=0;i<N;i++){
            double x = 1.0*(v[i].c-v[i].b*my)/v[i].a;
            compress.push_back(x);
        }
        sort(compress.begin(),compress.end());
        compress.erase(unique(compress.begin(),compress.end()),compress.end());
        int n = compress.size();
        int num = 1;
        for(auto x:compress){
            id[x] = num; num++;
        }
        for(int i=0;i<N;i++){
            double x = 1.0*(v[i].c-v[i].b*my)/v[i].a;
            cnt += bit.sum_range(1,id[x]);
            bit.add(id[x],1);
        }
        if(cnt<(sum+1)/2) ly = my;
        else ry = my;
    }
    cout << fixed;
    cout << setprecision(10) << rx << " " << ry << endl;
}

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

#define ll long long int
#define pb push_back
#define mk make_pair
#define ff first
#define ss second
#define finput ifstream cin;cin.open("in.txt")
#define foutput ofstream cout;cout.open("out.txt")  
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define mod 1000000007

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

ll pwm(ll a, ll n){
	ll ans = 1;
	while(n>0){
		if(n%2==1){
			ans = (ans * a)%mod;
		}
		a = (a*a)%mod;
		n /= 2;
	}
	return ans%mod;
}

const int pwn = 100010;
ll pw[pwn];
void pwtwo(){
	pw[0] = 1;
	for(int i=1; i<pwn; i++){
		pw[i] = (pw[i-1]*2)%mod;
	}
}


ll gcdExtended(ll a, ll b, ll *x, ll *y); 
  
ll modInverse(ll a, ll m) 
{ 	
	if(a==1)
		return 1;
	//cout<<"mi "<<a<<" "<<m<<" ";
    ll x, y; 
    ll g = gcdExtended(a, m, &x, &y); 
    if (g != 1){
        //cout << "Inverse doesn't exist"<<endl; 
        return -1;
    }
    else
    { 
        // m is added to handle negative x 
        ll res = (x%m + m) % m; 
        //cout<<res<<endl;
        return res;
        // cout << "modular multiplicative inverse is " << res; 
    } 
} 
  
ll gcdExtended(ll a, ll b, ll *x, ll *y) 
{ 
    if (a == 0) 
    { 
        *x = 0, *y = 1; 
        return b; 
    } 
  
    ll x1, y1;
    ll gcd = gcdExtended(b%a, a, &x1, &y1); 
  
    *x = y1 - (b/a) * x1; 
    *y = x1; 
  
    return gcd; 
} 

ll fact[1010];
ll init(){
	fact[0] = 1;
	for(int i=1; i<1010; i++)
		fact[i] = (fact[i-1]*i)%mod;
}

ll ncr(ll n, ll r){
	ll ans = fact[n];

	//if(r!=0)
	ans = (ans*modInverse(fact[r], mod))%mod;
	// if(n-r!=0)
	ans = (ans*modInverse(fact[n-r], mod))%mod;

	return ans;
}

int main(){
	// finput;
	// foutput;
	fast;

	int n, k, i, j, x, m;
	ll ans;
	// string s;
	cin>>n;

	int a, b;
	a = 0;
	while(n>0){
		x = n%10;
		a += x;
		n /= 10;
	}

	if(a==1)
		cout<<10;
	else
		cout<<a;
	
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
  int n;
  cin>>n;
  vector<int> a;
  for(int i=0;i<n;i++){
    int num;cin>>num;
    a.push_back(num);
    }
  if(n%2==0){
    for(int i=a.size()-1;i>=0;i-=2){
      cout<<a[i]<<" ";
    }
    for(int i=0;i<a.size()-1;i+=2){
      cout<<a[i]<<" ";
    }
    cout<<endl;
  }else{
    for(int i=a.size()-1;i>=0;i-=2){
      cout<<a[i]<<" ";
    }
    for(int i=1;i<a.size()-1;i+=2){
      cout<<a[i]<<" ";
    }
    cout<<endl;
  }
  return 0;
}

Measured memory_bytes: 3060
#include <vector>
#include <iostream>
#include <set>
#include <algorithm>
#include <map>
#include <string>
#include <cmath>
#include <tuple>

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P; 
typedef tuple<ll,ll,ll> T;

int main(){
	set<T> st;
	ll A,B,C;
	cin >> A >> B >> C;
	st.insert(T(A,B,C));
	ll ans=0;
	while(A%2==0 && B%2==0 && C%2==0){
		ans++;
		ll nB=A/2+C/2;
		ll nA=B/2+C/2;
		ll nC=A/2+B/2;
		A=nA;
		B=nB;
		C=nC;
		if(st.find(T(A,B,C))!=st.end()){
			ans = -1;
			break;
		}
	}
	cout << ans << endl;
	return 0;
}


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

//int arr1[26]={0};
//int arr2[26]={0};

/*int abs(int a,int b){
	if(a<b) return (a-b)*-1;
	return (a-b);
}*/
int solve(string a,string b){
	/*for(int i=0;i<a.length();++i){
		arr1[a[i]-97]++;
	}*/
	/*for(int i=0;i<b.length();++i){
		arr2[b[i]-97]++;
	}*/
	/*for(int i=0;i<26;i++) cout<<arr1[i]<<" ";
	cout<<"\n";
	for(int i=0;i<26;i++) cout<<arr2[i]<<" ";
	cout<<"\n";
	int i=0,j=0,sum=0;
	while(i<26 && j<26){
		if(arr1[i]!=arr2[j]) sum++;
		i++,j++;
	}*/
	int i=0,j=0,sum=0;
	while(i<a.length() && j<b.length()){
		if((char)a[i]!=(char)b[j]){
			sum++;
		}
		i++,j++;
	}
	return sum;
}
int main(){
    string s,t;
	cin>>s>>t;
	cout<<solve(s,t)<<"\n";
	return 0;	
}

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

int main() {
  int n, red, blue;
  char s;

  std::cin >> n;
  
  red = 0, blue = 0;
  for(int i = 0; i < n; ++i) {
    std::cin >> s;
    if(s == 'R') ++red;
    else ++blue;
  }

  std::cout << ((red > blue) ? "Yes" : "No") << std::endl;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _for(i,b,e) for (common_type_t <decltype (b), decltype (e)> i = (b), i ## __end = (e); i < i ## __end; ++ i)
#define FOR(...)    _for (__VA_ARGS__)
#define rep(i,n)    FOR(i, size_t{}, n)
#define ALL(x)      begin (x), end (x)
using namespace std;
using ll = int64_t;
constexpr int64_t inf = 2e18;
constexpr size_t invalid = ~0ull;
constexpr int dy [] = {-1, 0, 1, 0};
constexpr int dx [] = {0, -1, 0, 1};

auto main () -> int
{
  cin.tie (nullptr);
  ios::sync_with_stdio (false);

  size_t H, W;
  cin >> H >> W;
  vector <vector <char>> s (H, vector <char> (W));
  rep (i, H) rep (j, W) cin >> s[i][j];

  using index_t = ll;
  using P = pair <index_t, index_t>;
  vector <P> valid_paths;

  rep (i, H) rep (j, W)
  {
    if (s [i][j] == '.') valid_paths.emplace_back (i, j);
  }

  auto is_path = [&] (ll y, ll x)
  {
    return 0 <= y && y < H && 0 <= x && x < W && s[y][x] == '.';
  };

  auto bfs = [&] (const P & start)
  {
    vector <vector <bool>> visited (H, vector <bool> (W, false));
    queue <pair <P, ll>> q;
    auto update = [&] (const P & p, ll cost)
    {
      size_t y, x;
      tie (y, x) = p;
      visited [y][x] = true;
      q.emplace (p, cost);
    };
    update (start, 0);
    ll maxcost = 0;
    while (not q.empty ())
    {
      auto now = q.front (); q.pop ();
      P pos;
      ll cost;
      index_t y, x;
      tie (pos, cost) = now;
      tie (y, x) = pos;

      maxcost = max (maxcost, cost);

      rep (direction, 4)
      {
        ll ny = y + dy [direction];
        ll nx = x + dx [direction];
        if (is_path (ny, nx) && not visited [ny][nx])
        {
          update (P {ny, nx}, cost + 1);
        }
      }
    }
    return maxcost;
  };

  ll ans = 0;
  for (auto && elem : valid_paths)
  {
    ans = max (ans, bfs (elem));
  }
  cout << ans << endl;
}


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

typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pair<int, int> > vii;
#define rrep(i, m, n) for(int (i)=(m); (i)<(n);  (i)++)
#define erep(i, m, n) for(int (i)=(m); (i)<=(n); (i)++)
#define  rep(i, n)    for(int (i)=0; (i)<(n);  (i)++)
#define rrev(i, m, n) for(int (i)=(n)-1; (i)>=(m); (i)--)
#define erev(i, m, n) for(int (i)=(n); (i)>=(m); (i)--)
#define  rev(i, n)    for(int (i)=(n)-1; (i)>=0; (i)--)
#define vrep(i, c)    for(__typeof((c).begin())i=(c).begin(); i!=(c).end(); i++)
#define  ALL(v)       (v).begin(), (v).end()
#define mp            make_pair
#define pb            push_back
template<class T, class S> inline bool minup(T& m, S x){ return m>(T)x ? (m=(T)x, true) : false; }
template<class T, class S> inline bool maxup(T& m, S x){ return m<(T)x ? (m=(T)x, true) : false; }

const int    INF = 1000000000;
const ll     MOD = 1000000007LL;
const double EPS = 1E-12;

const int MAX_H = 8;
const int MAX_W = 8;
int H = MAX_H;
int W = MAX_W;
int hx, hy;
int cnt;
string maze[MAX_H];

inline bool check(int x, int y){ return 0 <= x && x < H && 0 <= y && y < W; }

void dfs(int x, int y)
{
  if(maze[x][y] == '0') return;
  maze[x][y] = '0';
  erep(dx, -3, 3) erep(dy, -3, 3) if(dx || dy) if(!dx || !dy){
      int nx = x + dx;
      int ny = y + dy;
      if(!check(nx, ny)) continue;
      if(maze[nx][ny] == '1') dfs(nx, ny);
    }
}

int main()
{
  cin >> cnt;

  erep(k, 1, cnt){
    rep(i, H) cin >> maze[i];
    cin >> hy >> hx;
    dfs(hx - 1, hy - 1);
    cout << "Data " << k << ":" << endl;
    rep(i, H) cout << maze[i] << endl;
  }

  return 0;
}

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

using namespace std;

int main() {
	long long N;
	cin >> N;
	long long A, B, C, D, E;
	cin >> A >> B >> C >> D >> E;

	long long tmp;
	tmp = min({ A,B,C,D,E });
	long long ans;
	ans = (N + tmp - 1) / tmp + 4;

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#!/bin/bash

read n
read p

function f() {
  count=0
  for ((i=1; i < $n-1; i++)); do
    if [ $# -lt 3 ]; then break; fi
    if [ $1 -gt $2 -a $2 -gt $3 ] || [ $1 -lt $2 -a $2 -lt $3 ]; then
      (( count++ ))
    fi
    shift
  done
  echo $count
}

f $p

Measured memory_bytes: 376
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
    int k, p,a=0,b;
    cin >> k ;
    for(int i=0;i<k;i++){
        cin >> p >> b;
        if(p%b==0){
            a=b;
            cout << a << endl;
        }
        else{
            a=p%b;
            cout << a << endl;
        }
    }
}


Measured memory_bytes: 3104
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MOD 1000000007
#define INF 1LL<<30
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()

int main(){
    int n;
    cin>>n;
    ll a[n];
    vector<ll> ans(n,0);
    int sum=0;
    rep(i,n){
        cin>>a[i];
        if(i%2==0) ans[0]+=a[i];
        else ans[0]-=a[i];
    }
    rep(i,n-1){
        ans[i+1]=2*a[i]-ans[i];
    }

    rep(i,n) cout<<ans[i]<<" ";
    cout<<endl;
    
}


Measured memory_bytes: 2816
#include <bits/stdc++.h>
#define lli long long int
using namespace std;
#define MOD 1000000007
#define mod 1000000007
#define mod1 998244353
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); 


int main()
{
    int n1,n2,a,b,c;
    cin >> n1 >> n2 >> a >> b >> c;
    vector<int>vr(a),vg(b),vc(c);
    for(int i=0;i<a;i++)
    {
        int x;
        cin >> x;
        vr[i]=-x;
    }
    for(int i=0;i<b;i++)
    {
        int x;
        cin >> x;
        vg[i]=-x;
    }
    for(int i=0;i<c;i++)
    {
        int x;
        cin >> x;
        vc[i]=-x;
    }
    sort(vr.begin(),vr.end());
    sort(vg.begin(),vg.end());
    sort(vc.begin(),vc.end());
    vector<int>vt;
    vt.insert(vt.end(),vr.begin(),vr.begin()+n1);
    vt.insert(vt.end(),vg.begin(),vg.begin()+n2);
    vt.insert(vt.end(),vc.begin(),vc.end());
    sort(vt.begin(),vt.end());
    lli ans=0;
    for(int i=0;i<n1+n2;i++)
        ans-=vt[i];
    cout << ans << endl;
}

Measured memory_bytes: 3232
#define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define scanv(n,v) v.resize(n); rep(i,n){ cin>>v[i];}
#define MOD 1000000007ll
#define Yes(flag) cout<<((flag)? "Yes":"No");
#define YES(flag) cout<<((flag)? "YES":"NO");
#define be begin
#define pb push_back
#define fi first
#define se second
#include<bits/stdc++.h>
using ll = long long;
using namespace std;
template<class T>T 
chmin(T& a,T b){if(a>b){a=b;return true;}return false;}
template<class T>T 
chmax(T& a,T b){if(a<b){a=b;return true;}return false;}
//------------------------------------------------------
ll n,m,k;
multiset<ll> d,t,res;
void input(){
    cin>>n;
    rep(i,n){
        cin>>k;
        d.insert(k);
    }
    cin>>m;
    rep(i,m){
        cin>>k;
        t.insert(k);
    }
}
void src(){
    set_intersection(ALL(d),ALL(t),inserter(res,res.end()) );
    YES(res.size()==m);
}   
int main(int argc,char* argv[]){
    ios::sync_with_stdio(false);
 //   ifstream in( argv[1] ); cin.rdbuf(in.rdbuf());
    input();
    src();    
    return 0;
}

Measured memory_bytes: 28416
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> lpair;
const ll MOD = 1e9 + 7;
#define rep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define print2(x,y) cout << (x) << " " << (y) << endl;
#define printa(x,n) for(ll i = 0; i < n; i++){ cout << (x[i]) << " \n"[i == n-1];}
#define INF (1e18)

int main(){   
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N;
    double x[11];
    string u[11];
    cin >> N;
    rep(i,0,N) cin >> x[i] >> u[i];
    double ans = 0;
    rep(i,0,N){
        if(u[i] == "JPY"){
            ans += x[i];
        }else{
            ans += 380000.0 * x[i];
        }
    }
    cout << setprecision(10) << ans << endl;
}


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

#define max 100

//qsort(str, n, sizeof(int), up_comp);
int up_comp(const void *a, const void *b){return *(int*)a - *(int*)b;}
int down_comp(const void *a, const void *b){return *(int*)b - *(int*)a;}

int main()
{
    long long int n, k, a, b, c;
    
    scanf("%lld %lld", &n, &k);
    

    a=n%k;
    b=k-(n%k);
    
    if (a>b) {
        a=b;
    }
    
    printf("%lld", a);
    
    return 0;
}




Measured memory_bytes: 128
s = input()
if s[0:2] in "01 02 03 04 05 06 07 08 09 10 11 12":
  l = "m"
else:
  l = "y"
if s[2:4] in "01 02 03 04 05 06 07 08 09 10 11 12":
  r = "m"
else:
  r = "y"
if l+r == "mm":
  print("AMBIGUOUS")
elif l+r == "my":
  print("MMYY")
elif l+r == "ym":
  print("YYMM")
else:
  print("NA")

Measured memory_bytes: 9112
#include <iostream>
using std::cin;
using std::cout;

int a[110][110], b[110], c[110];

int main() {
	int n, m;
	cin >> n >> m;
	for(int i = 1; i <= n; i++) 
		for(int j = 1; j <= m; j++) cin >> a[i][j];
	for(int j = 1; j <= m; j++) cin >> b[j];
	for(int i = 1; i <= n; i++) {
		int p = 0;
		for(int j = 1; j <= m; j++) p += a[i][j] * b[j];
		c[i] = p;
	}
	for(int i = 1; i <= n; i++) cout << c[i] << '\n';
	return 0;
}


Measured memory_bytes: 3124
import numpy as np
n,d = list(map(int,input().split()))
x = [np.array(input().split(), dtype=np.int64) for _ in range(n)]
cnt = 0
for i in range(n):
    for j in range(n):
        if i !=j:
            #print('i : '+str(i)+'  j : '+str(j))
            #print((np.linalg.norm(x[i]-x[j])))
            if (np.linalg.norm(x[i]-x[j]))%1==0:
                cnt +=1
print(cnt//2)

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

using namespace std;

typedef long long          ll;
typedef unsigned long long ull;
typedef vector<int>	       vi;
typedef vector<bool>       vb;
typedef map<int, int>      mii;
typedef pair<int, int>     ii;

#define INF                0x3f3f3f3f
#define INFLL              0x3f3f3f3f3f3f3f3f
#define each(x, s)         for(auto& x : s)
#define loop(x)	           for(int i = 0;i < x;i++)
#define vloop(v, x)        for(int v = 0;v < x;v++)
#define avg(l, r)          l + (r - l) / 2
#define iter(a)            a.begin(), a.end()
#define riter(a)           a.rbegin(), a.rend()
#define endl               "\n"

const ll mod = 1000000007;

int main() {
	ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

	int n, k;
	cin >> n >> k;
	vi a(n);
	loop(n) cin >> a[i];
	sort(iter(a));
	int ans = 0;
	loop(k) ans += a[i];
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 3608
N = int(input())
a = list(map(int, input().split()))

a.sort()
min_color = [0] * 8
max_color = [0] * 8
extra = 0

for i in a:
    if i >= 3200:
        if sum(min_color) == 0:
            min_color[0] = 1
        extra += 1
    else:
        min_color[i // 400] = 1
        max_color[i // 400] = 1


print( sum(min_color), sum(max_color) + extra)

Measured memory_bytes: 3064
// #include <iostream>
// #include <cstdio>
// #include <map>
// #include <set>
// #include <vector>
// #include <algorithm>
// #include <queue>
// #include <stack>
// using namespace std;
// typedef long long ll;
// const int mo=1e9+7;
// #define rep(i, n) for (int i = 0; i < n; i++)
// int u[55];
// ll dp[55];
// char in[2][55];
// vector<int> v;
// void solve()
// {
//     int n,i,j;
//     scanf("%d%s%s",&n,in[0],in[1]);
//     for(i=0;i<n;)
//     {
//         if(i+1==n||in[0][i]==in[1][i])
//         {
//             v.emplace_back(1);
//             i++;
//         }
//         else
//         {
//             v.emplace_back(2);
//             i+=2;
//         }
//     }
//     dp[0]=6;
//     if(v[0]==1)dp[0]=3;
//     for(i=1;i<v.size();i++)
//     {
//         if(v[i]==1&&v[i-1]==1)dp[i]=dp[i-1]*2%mo;
//         if(v[i]==1&&v[i-1]==2)dp[i]=dp[i-1];
//         if(v[i]==2&&v[i-1]==1)dp[i]=dp[i-1]*2%mo;
//         if(v[i]==2&&v[i-1]==2)dp[i]=dp[i-1]*3%mo;
//     }
//     printf("%lld\n",dp[v.size()-1]);
// }
// main()
// {
//     cin.tie(0);
//     ios::sync_with_stdio(0);
//     solve();
//     return 0;
// }

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long ll;
const int mo = 1e9 + 7;
ll a;
ll b[60];
typedef pair<ll,ll> P ;
vector<P> v;
ll mxps=-mo,mnps=mo,mx=-mo,mn=mo;
void solve()
{
    if(mn>0)rep(i,a-1);
    else if(abs(mx)<abs(mn))
    {
        rep(i,a)if(b[i]>0)v.emplace_back(make_pair(mnps,i));
        for(int i=a-1;i>0;i--)v.emplace_back(make_pair(i,i-1));
        return;
    }
    else 
    {
        rep(i,a)if(b[i]<0)v.emplace_back(make_pair(mxps,i));
    }
    rep(i,a-1)v.emplace_back(make_pair(i,i+1));
}
signed main()
{
    cin.tie(0);
    ios::sync_with_stdio(0);
    cin>>a;
    rep(i,a){
        cin>>b[i];
        if(mx<b[i])
        {
            mxps=i;
            mx=b[i];
        }
        if(mn>b[i])
        {
            mnps=i;
            mn=b[i];
        }
    }
    solve();
    cout<<v.size()<<endl;
    rep(i,v.size())cout<<v[i].first+1<<' '<<v[i].second+1<<endl;
    return 0;
}

Measured memory_bytes: 256