akhauriyash/Code-Regression huggingface dataset:
import java.io.*;
import java.util.*;
import java.util.Map.Entry;

public class Main {
	
	final boolean isDebug = false;
	String fileName = "input.txt";
	FastScanner sc;
	//PrintWriter out;
	final int MOD = (int)1e9+7;
	final int INF = Integer.MAX_VALUE / 2;
	
	/* solve */
	void solve(){
		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();
		System.out.println(Math.min((B/A), C));
 	}
	
	/* end solve */
	
	/* main */
	public static void main(String[] args) throws IOException {
		new Main().m();
	}
	
	void m() throws IOException {
		long S = System.currentTimeMillis();
		sc = (isDebug) ? new FastScanner(new FileInputStream(fileName)) : new FastScanner(System.in);
		//out = new PrintWriter(System.out);
		solve();
		//out.flush();
		long G = System.currentTimeMillis();
		if(isDebug){
			System.out.println("---Debug---");
			System.out.printf("%8d ms", (G-S));
		}
	}
	/* end main */
}
/* end Main */

class FastScanner {
    private InputStream in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    public FastScanner(InputStream in) {
		this.in = in;
	}
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() {
    	if (hasNextByte()) return buffer[ptr++];
    	else return -1;
    }
    private static boolean isPrintableChar(int c){
    	return 33 <= c && c <= 126;
    }
    public boolean hasNext() {
    	while(hasNextByte() && !isPrintableChar(buffer[ptr]))
    		ptr++; return hasNextByte();
    }
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble() {
    	return Double.parseDouble(next());
    }
}


Measured memory_bytes: 22612
import java.util.Scanner;
import java.util.ArrayList;


public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int num1 = scan.nextInt();
        ArrayList<Integer> Array = new ArrayList<Integer>();
        int l,r,abs=10000,temp;

        for(int i = 0; i<num1;i++){
            int num2 = scan.nextInt();
            Array.add(num2);
        }
        for(int i = 0; i<num1;i++){
            l = r = 0;
            for(int j = 0; j<num1;j++){
                if(j <= i)  l += Array.get(j);
                else        r += Array.get(j);
            }
            if(r > l) temp = r-l;
            else      temp = l-r;
            if(abs > temp)  abs = temp;
        }

        System.out.println(abs);
    }
}

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

int main()
{
	int h, n;
	cin >> h >> n;
	for (int i = 0; i < n; ++i) {
		int a;
		cin >> a;
		h -= a;
	}

	if (h <= 0) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

	return 0;
}

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

#define fi first
#define se second
#define sz(a) (int)(a).size()
#define all(a) (a).begin(), (a).end()
#define reset(a, v) memset((a), v, sizeof(a))

using namespace std;

typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<ii> vii;

int n;

int main() {
	scanf("%d", &n);
	double p = (double)n/3.0;
	printf("%.9lf\n", p*p*p);
	return 0;
}

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

int main(){
  int N;
  cin >> N;
  for(int i=0;i<N;i++){
    int gx, gy;
    cin >> gx >> gy;
    int p;
    cin >> p;

    int move[16][16], count[16][16];
    for(int s=0;s<16;s++)
      for(int t=0;t<16;t++)
	move[s][t]=count[s][t]=0;

    for(int j=0;j<p;j++){
      int x1, y1, x2, y2;
      cin >> x1 >> y1 >> x2 >> y2;
      int x, y;
      x=min(x1, x2);
      y=min(y1, y2);
      if(x1==x2) move[x][y]=(move[x][y] | 2);
      else move[x][y]=(move[x][y] | 1);
    }

    count[0][0]=1;
    for(int k=1;k<=gx+gy;k++){
      for(int l=0;l<=k;l++){
	if(l>gx) continue;
	if((k-l)>gy) continue;

	if(l>0){
	  if((move[l-1][k-l]&1)==0)
	    count[l][k-l]+=count[l-1][k-l];
	}
	if(k-l>0){
	  if((move[l][k-l-1]&2)==0)
	    count[l][k-l]+=count[l][k-l-1];
	}
      }
    }
    
    if(count[gx][gy]==0)
      cout << "Miserable Hokusai!" << endl;
    else
      cout << count[gx][gy] << endl;
  }

  return 0;
}

Measured memory_bytes: 3040
#include<cstdio>
#include<cmath>
int main()
{
    long long n,ans;
    scanf("%lld",&n);
    long long max=sqrt(n);
    for (int i = max; i > 0; i--)
    {
        if (n%i==0)
        {
            ans=i+n/i-2;
            break;
        }
    }
    printf("%lld",ans);
}

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

using namespace std;

const int MAX_N = 1e5 + 10;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	
	int N, M, arr[MAX_N], b[MAX_N];
	
	cin >> N >> M;
	for (int i = 0; i < M; i++)
		cin >> arr[i];
		
	sort(arr, arr + M);
	
	for (int i = 0; i < M - 1; i++)
		b[i] = arr[i + 1] - arr[i];
		
	sort(b, b + M - 1, greater<int>());
	
	int ans = arr[M - 1] - arr[0];
	for (int i = 0; i < min(M - 1, N - 1); i++)
		ans -= b[i];
		
	cout << ans << '\n';
	
	return 0;
}//main


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

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

  sort(a.begin(),a.end());

  if(a[0]<0 && a[n-1]>=0){
    int border;
    for(int i=0; i<n; ++i)if(a[i]>=0){border=i; break;}
    int sum=0;
    for(int i=0; i<border; ++i)sum-=a[i];
    for(int i=border; i<n; ++i)sum+=a[i];
    cout<<sum<<endl;
    int x=a[0];
    for(int i=border; i<n-1; ++i){
      cout<<x<<" "<<a[i]<<endl;
      x-=a[i];
    }
    int y=a[n-1]; 
    for(int i=border-1; i>0; --i){
      cout<<y<<" "<<a[i]<<endl;
      y-=a[i];
    }
    cout<<y<<" "<<x<<endl;
  }else if(a[n-1]<0){
    int sum=accumulate(a.begin(),a.end(),0);
    cout<<2*a[n-1]-sum<<endl;
    int x=a[n-1];
    for(int i=0; i<n-1; ++i){
      cout<<x<<" "<<a[i]<<endl;
      x-=a[i];
    }
  }else if(a[0]>=0){
    int sum=accumulate(a.begin(),a.end(),0);
    cout<<-2*a[0]+sum<<endl;
    int x=a[0];
    for(int i=1; i<n-1; ++i){
      cout<<x<<" "<<a[i]<<endl;
      x-=a[i];
    }
    cout<<a[n-1]<<" "<<x<<endl;
  }
  
}


Measured memory_bytes: 2304
/* Bismillahir Rahmanir Rahim
There is no god without Allah*/
#include<bits/stdc++.h>
#include<iomanip>
typedef long long ll;
typedef unsigned long long ul;
#define pi acos(-1)
#define ll long long
#define ull unsigned long long
#define vec vector<ll>
#define f1(i,n) for(i=1;i<n;i++)
#define test   ll t;cin>>t;while(t--)

long long int i,j;
using namespace std;

int main()
{
   int n;cin>>n;
   int x=n%1000;
   if(x!=0)
   cout<<1000-x<<endl;
   else cout<<0<<endl;



}
// Alhamdulillah


Measured memory_bytes: 3592
import sys
from collections import defaultdict
readline = sys.stdin.buffer.readline
# sys.setrecursionlimit(10**8)


def geta(fn=lambda s: s.decode()):
    return map(fn, readline().split())


def gete(fn=lambda s: s.decode()):
    return fn(readline().rstrip())


def main():
    n = gete(int)

    ans = 0
    for i in range(1, n+1):
        m = n//i
        ans += i * m * (m+1) // 2

    print(ans)


if __name__ == "__main__":
    main()


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

typedef long long ll;

int main() {
    ll e,x,y,z,m;
    while(cin>>e, e) {
        m = 1ll<<62;
        for(z = 0; z*z*z<=e; ++z) {
            for(y = 0; z*z*z+y*y<=e; ++y) {
                x = e - z*z*z - y*y;
                m = min(x+y+z, m);
            }
        }

        cout<<m<<endl;
    }
}

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

int main( ) {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t;
    string s;
    t = 1;
    while(t--) {
     cin >> s;
     if(s == "Sunny")
	  cout << "Cloudy\n";
	 else if(s == "Cloudy")
	  cout << "Rainy\n";
	 else
	  cout << "Sunny\n";
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <math.h>
#include <numeric>
#include <complex>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <bitset>
#include <functional>
#include <assert.h>
using ll=long long;
#define int ll
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define eb emplace_back
#define all(x) x.begin(),x.end()
#define SZ(x) ((int)x.size())
#define fi first
#define se second
const int INF = 1e16;
using namespace std;

template<class T> using vc=vector<T>;
template<class T> using vvc=vc<vc<T>>;

using pi=pair<int,int>;
using vi=vc<int>;

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

signed main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout<<fixed<<setprecision(20);

    int N; cin >> N;
    int A[3*N];
    rep(i,3*N){
        cin >> A[i];
    }
    vi max(N+1,0),min(N+1,0);
    priority_queue<int,vi,greater<int>> r;
    priority_queue<int> l;
    rep(i,N) {
        r.emplace(A[i]);
        max[0]+=A[i];
    }
    rep(i,N) {
        l.emplace(A[3*N-i-1]);
        min[N]+=A[3*N-i-1];
    }
    rep(i,N) {
        int a=r.top(); r.pop();
        max[i+1]=max[i]-a;
        chmax(a,A[N+i]);
        max[i+1]+=a;
        r.emplace(a);
    }
    rep(i,N) {
        int a=l.top(); l.pop();
        min[N-i-1]=min[N-i]-a;
        chmin(a,A[2*N-i-1]);
        min[N-i-1]+=a;
        l.emplace(a);
    }
    int ans=-INF;
    rep(i,N+1) {
        chmax(ans,max[i]-min[i]);
        //cout << max[i] << " " << min[i] << endl;
    }
    cout << ans << endl;
}

Measured memory_bytes: 6516
#include<stdio.h>
int main(void){
   int a;
   while ( scanf("%d", &a) != EOF ) {
      if ( a % 39 >= 10) printf("3C%d\n", a % 39);
      else if ( a % 39 == 0 ) printf("3C39\n");
      else printf("3C0%d\n", a % 39);
   }
   return 0;
}

Measured memory_bytes: 1816
n = int(input())
for i in range(1, n+1):
  if i % 3 == 0:
    print(" " + str(i), end ="")
  else:
    x = i
    while(x):
      if x % 10 == 3:
        print(" " + str(i), end ="")
        break
      x //= 10
print()


Measured memory_bytes: 5872
/*
 89798369704668 guess what it means
 */

#include <iostream>
#include <cmath>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <map>
#include <iomanip>
#include<queue>
#include<memory.h>
#include<sstream>
using namespace std;

const int MOD = 1000000007;
typedef long long ll ; 
vector<int> v; 
int main() {
	//freopen("In.txt","r",stdin); 
	int n , m; 
	cin>>n>>m;
	v.resize(n+10);
	for(int i=1 ; i<n+10; i++){
		v[i]=0;
	}
	for(int i=0 ; i<m ; i++){
		int a , b; 
		cin>>a>>b;
		v[a]++;
		v[b]++;
	}
	bool FF = true;
	for(int i=1 ; i<=n ; i++)
		if(v[i]%2 != 0){
			FF = false;
		}
		if(FF)
			cout<<"YES"<<endl;
		else 
			cout<<"NO"<<endl;
}

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

int main() {
  int N, Y;
  cin >> N >> Y;
  
  for(int i=0 ; i<=N ; i++)
    for(int j=0 ; j<=N-i ; j++)
      for(int k=0 ; k<=N-i-j ; k++)
        if(i*10000 + j*5000 + k*1000 == Y && i+j+k==N){
          cout << i << " " << j << " " << k << endl;
          return 0;
        }
  
  cout << "-1 -1 -1" << endl;
  return 0;
}

Measured memory_bytes: 3632
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        int C = sc.nextInt();
        int D = sc.nextInt();
        
        System.out.println( Math.min(A, B) + Math.min(C, D) );
    }
}


Measured memory_bytes: 35828
public class Main {
	public static void main(String[] args) {
		new Main();
	}

	Main() {
		for (int i = 1; i <= 9; i++) {
			for (int j = 1; j <= 9; j++) {
				System.out.println(i + "x" + j + "=" + (i * j));
			}
		}
	}
}

Measured memory_bytes: 16852
#include <iostream>
#include <vector>

using namespace std;

int main(){
    ios::sync_with_stdio(false);
    int n, x = 0, y = 0;
    vector<int> v;
    cin >> n;
    while(n--){
        int vi;
        cin >> vi;
        v.push_back(vi);
    }
    for (int i = 0; i < v.size(); ++i){
        int ci;
        cin >> ci;
        x += ci < v[i] ? v[i] : 0;
        y += ci < v[i] ? ci : 0;
    }
    cout << x-y << endl;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;

namespace atcode {
    class MainClass {
        class Point {
            public int x;
            public int y;
            public Point() {
                x = 0;
                y = 0;
            }
            public double getDistTo(Point p) {
                return (Math.Abs(x - p.x) + Math.Abs(y - p.y));
            }
        };
		static void Main(string[] args) {
            string[] firstLine = Console.ReadLine().Split(' ');
            int studentNum = int.Parse(firstLine[0]);
            int checkPointNum = int.Parse(firstLine[1]);

            if (studentNum < 1 || checkPointNum < 1) return;
            if (studentNum > 50 || checkPointNum > 50) return;

            List<Point> studentPoints = new List<Point>();
            List<Point> checkPoints = new List<Point>();
            for (int i = 0; i < studentNum; i++) {
                string[] line = Console.ReadLine().Split(' ');
                Point p = new Point();
                p.x = int.Parse(line[0]);
                p.y = int.Parse(line[1]);
                studentPoints.Add(p);
            }
	   for (int i = 0; i < checkPointNum; i++) {
                string[] line = Console.ReadLine().Split(' ');
		Point p = new Point();
                p.x = int.Parse(line[0]);
                p.y = int.Parse(line[1]);
                checkPoints.Add(p);
            }

            foreach (Point p in studentPoints) {
                double minDist = double.MaxValue;
                int minDistIndex = 1;
                int index = 1;
                foreach (Point p2 in checkPoints) {
                    double dist = p.getDistTo(p2);
                    if (dist < minDist) {
                        minDist = dist;
                        minDistIndex = index;
                    }
                    index++;
                }
		Console.WriteLine(minDistIndex.ToString());
            }
	}
    }
}


Measured memory_bytes: 13268
#include <bits/stdc++.h>
using namespace std;
int A, B, C, D;
int main() {
    cin >> A >> B >> C >> D;
    int sum = 0;
    if(A > B) {
        sum += B;
    }else {
        sum += A;
    }

    if(C > D) {
        sum += D;
    }else {
        sum += C;
    }

    cout << sum << endl;
}

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

vector<int> vis, deg;
vector<vector<int>> g;
vector<pair<int, int>> p;

void dfs(int u) {
  vis[u] = 1;
  for (auto to : g[u]) {
    int v = (p[to].first == u) ? p[to].second : p[to].first;
    if (vis[v]) continue;
    p[to].first = u, p[to].second = v;
    dfs(v);
  }
}

void adjust(int u, int par) {
  vis[u] = 1;
  for (auto to : g[u]) {
    int v = p[to].second;
    if (vis[v]) continue;
    adjust(v, to);
  }
  if (deg[u]&1) {
    swap(p[par].first, p[par].second);
    deg[p[par].first] ^= 1;
    deg[p[par].second] ^= 1;
  }
}

int main() {

  ios::sync_with_stdio(false);
  cout.tie(nullptr);
  cin.tie(nullptr);

  int n, m;
  cin >> n >> m;

  g.resize(n);
  deg.assign(n, 0);

  for (int i = 0; i < m; ++i) {
    int u, v;
    cin >> u >> v;

    --u; --v;
    g[u].push_back((int)p.size());
    g[v].push_back((int)p.size());
    p.emplace_back(u, v);
  }

  if (m&1) {
    cout << -1 << '\n';
    return 0;
  }

  vis.assign(n, 0);
  dfs(0);
  for (int i = 0; i < m; ++i) {
    deg[p[i].first] ^= 1;
  }
  vis.assign(n, 0);
  adjust(0, -1);

  for (int i = 0; i < m; ++i) {
    cout << p[i].first + 1 << " " << p[i].second + 1 << '\n';
  }
}

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

using namespace std;

int main() {

	int n,k;
	cin >> n >> k;
	int r, s, p;
	cin >> r >> s >> p;
	string t;
	cin >> t;

	vector<string> tt(k);
	for (int i = 0; i < t.size(); i++) {
		tt[i%k].push_back(t[i]);
	}

	vector<int> dpr(n + 1);
	vector<int> dps(n + 1);
	vector<int> dpp(n + 1);

	int summ = 0;
	for (int i = 0; i < k; i++) {
		dpr[0] = (tt[i].front() == 's' ? r : 0);
		dps[0] = (tt[i].front() == 'p' ? s : 0);
		dpp[0] = (tt[i].front() == 'r' ? p : 0);

		for (int j = 1; j <= tt[i].size()-1; j++) {
			dpr[j] = max(dps[j - 1], dpp[j - 1]) + (tt[i][j] == 's' ? r : 0);
			dps[j] = max(dpr[j - 1], dpp[j - 1]) + (tt[i][j] == 'p' ? s : 0);
			dpp[j] = max(dpr[j - 1], dps[j - 1]) + (tt[i][j] == 'r' ? p : 0);
		}
		summ += max(dpr[tt[i].size() - 1], max(dps[tt[i].size() - 1], dpp[tt[i].size() - 1]));
	}

	cout << summ << endl;

}

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

#define rep(i, a) REP(i, 0, a)
#define REP(i, a, b) for(int i = a; i < b; ++i)
#define rrep(i, a) RREP(i, a, 0)
#define RREP(i, a, b) for(int i = a; i >= b; --i)
#define repll(i, a) REPLL(i, 0, a)
#define REPLL(i, a, b) for(ll i = a; i < b; ++i)
#define rrepll(i, a) RREPLL(i, a, 0)
#define RREPLL(i, a, b) for(ll i = a; i >= b; --i)

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

bool check(int n) {
	std::string s;
	s = std::to_string(n);
	return s == std::string(s.rbegin(), s.rend());
}

int main(){
	int n;
	std::cin >> n;
	for (int i = 0; i < 1000; ++i) {
		if (check(n - i)) {
			std::cout << n - i << std::endl;
			break;
		}
		else if (check(n + i)) {
			std::cout << n + i << std::endl;
			break;
		}
	}

	return 0;
}

Measured memory_bytes: 3264
#include<iostream>

using namespace std;

int cost[8][8] = {{},{0,0,300,500,600,700,1350,1650},
		  {0,0,0,350,450,600,1150,1500},
		  {0,0,0,0,250,400,1000,1350},
		  {0,0,0,0,0,250,850,1300},
		  {0,0,0,0,0,0,600,1150},
		  {0,0,0,0,0,0,0,500}};

int dis[8][8] = {{},{0,0,6,13,18,23,43,58},
		 {0,0,0,7,12,17,37,52},
		 {0,0,0,0,5,10,30,45},
		 {0,0,0,0,0,5,25,40},
		 {0,0,0,0,0,0,20,35},
		 {0,0,0,0,0,0,0,15}};

struct T{int ic,h,m;};
T t[2];

bool check(T in){
  if(17 < in.h && in.h < 19) return true;
  if(in.h == 17 && in.m >= 30) return true;
  if(in.h == 19 && in.m <= 30) return true;
 
  return false;
}

int solve(T from, T to){
  int ans = 0;
  bool half = (check(from)||check(to));

  int fi = from.ic,ti = to.ic;

  if(from.ic > to.ic) swap(fi,ti);

  ans = cost[fi][ti];
  
  if(half && dis[fi][ti] <= 40) ans /= 2;

  while((ans%100)%50) ans++;

  return ans;
}

int main(){

  while(cin >> t[0].ic && t[0].ic){
    cin >> t[0].h >> t[0].m;
    cin >> t[1].ic >> t[1].h >> t[1].m;
    cout << solve(t[0],t[1]) << endl;
  }
  
  return 0;
}

Measured memory_bytes: 1160
#include<stdio.h>

int main(void){
  int t; //1-100
  int n; //2-100
  int h[100];
  int i,k;
  int tmp;
  
  scanf("%d",&t);
  for(k=0;k<t;k++){
    int up=0,down=0;
    
    scanf("%d",&n);
    for(i=0;i<n;i++)
      scanf("%d",&h[i]);

    for(i=0;i<n-1;i++){
      if(h[i]<h[i+1]){ //up
	tmp=h[i+1]-h[i];
	if(tmp>up)
	  up=tmp;
      }
      else{ //down
	tmp=h[i]-h[i+1];
	if(tmp>down)
	  down=tmp;
      }
    }
    printf("%d %d\n",up,down);
  }
  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define repz(i, z, n) for (decltype(n) i = (z); i < (n); i++)
#define rep(i, n) for (decltype(n) i = 0; i < (n); i++)

#define REPZ(i, z, n) for (decltype(n) i = (z); i <= (n); i++)
#define REP(i, n) for (decltype(n) i = 0; i <= (n); i++)
#define ALL(v) v.begin(), v.end()
#define SIZE(v) ((ll)(v).size())
#define MAX(v) (*max_element(ALL(v)))
#define MIN(v) (*min_element(ALL(v)))
#define INF 1000000000000  // 1E+12

// 略
#define PB push_back
#define F first
#define S second
#define MP make_pair
#define READ cin >>
#define PRINT cout <<
#define PYES cout << "Yes" << endl;
#define POK cout << "OK" << endl;
#define PNO cout << "No" << endl;
#define PNG cout << "NG" << endl;

using namespace std;

// デバッグ用
void debug_out() { cout << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cout << H << " ";
  debug_out(T...);
}

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

#ifdef _DEBUG
#define debug(...) debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

// typedef
typedef long long ll;
typedef unsigned long long ul;
typedef long double ld;
typedef pair<ll, ll> pl;

// const
// 円周率
const ld pi = acos(-1);
// mod用
// 1E+9 +7
const ll mod = (int)1e+9 + 7;
// 1s間で可能なループ回数2E+8回
// int        最大値2147483647         〜2E+9
// long long  最大値9223372036854775807〜9E+18
// 総和accumulate
// 単純リストvector<type> push_back
// 連想配列map<key,value> insert,
// 集合set<type>
// pair キーとバリューを格納 firstとsecondでアクセス
// 小数点指定 cout << fixed << setprecision(15) << endl;
// to_string<->stoi
// stoll(longlong)
// stod(double)
// deep copy v1->v2 copy(v1.begin(), v1.end(), back_inserter(v2) );
// 大文字65-90(-32)
// 小文字97-122(+32)
//  priority_queue<pair<ll, ll>, vector<pair<ll, ll>>, greater<pair<ll, ll>>>
//  ba;
signed main() {
  // faster
  // C言語流の入出力は使用できない
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  int l = a + b;
  int r = c + d;
  if (l == r) cout << "Balanced" << endl;
  else if (l < r)
    cout << "Right" << endl;
  else
    cout << "Left" << endl;

  return 0;
}


Measured memory_bytes: 256
import Control.Monad

toInt :: String -> Int
toInt = read :: String -> Int

solve :: [Int] -> Int
solve l = div (a - b) 2
  where
    a = sum . map (\l -> product l) . sequence $ [l, l]
    b = sum . map (\x -> x * x) $ l

main = do
  n <- toInt <$> getLine
  d <- map toInt . words <$> getLine
  print $ solve d


Measured memory_bytes: 4136
#define __GLIBCXX_DEBUG

#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <random>
#include <queue>
#include <bitset>

#define pb push_back
#define int long long
#define dbl long double
#define str string
using namespace std;
const int M = 998244353;

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    string s;
    cin >> s;
    for (auto c : s) {
        if (c == '7') {
            cout << "Yes";
            return 0;
        }
    }
    cout << "No";
}

Measured memory_bytes: 3652
def main():
    N, K, S = map(int, input().split())
    if S >= int(2e5):
        ans = [S] * K + [1] * (N-K)
    else:
        ans = [S] * K + [S+1] * (N-K)
    print(*ans)


if __name__ == "__main__":
    main()


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

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long int

using namespace __gnu_pbds;

typedef tree<pair<ll,pair<ll,ll> >, null_type, less<pair<ll,pair<ll,ll> > >, rb_tree_tag, tree_order_statistics_node_update>ordered_set;


#define me BOSS
#define bug() cout<<"AIkahne aise"<<endl
#define PI acos(-1)
#define mod 1000000007
/* Precode Start Here *\


power of 2 less than or equal to N

ll largest_power(ll N)
{
    //changing all right side bits to 1.
    N = N (N>>1);
    N = N| (N>>2);
    N = N| (N>>4);
    N = N| (N>>8);


//as now the number is 2 * x-1, where x is required answer, so adding 1 and dividing it by
 2.
            return (N+1)>>1;

}


     Sieve
void sieve()
{
    for(ll i=3; i<=2000; i+=2)
    {
        for(ll j=i*i; j<=4000000; j+=i)
            A[j]=1;
    }
    v.push_back(2);
    for(ll i=3; i<=4000000; i+=2)
        if(A[i]==0)
            v.push_back(i);
}

     Power Function Modulo P

ll modPow(ll a, ll x, ll p) {
    //calculates a^x mod p in logarithmic time.
    long res = 1;
    while(x > 0) {
        if( x % 2 != 0) {
            res = (res * a) % p;
        }
        a = (a * a) % p;
        x /= 2;
    }
    return res;
}


   factorial

ll fact(ll n)
{
    ll ans=1;
    for(ll i=1;i<=n;i++)
    {
        ans=(ans*i)%mod;
    }
    return ans;
}
     Calculating nCr using Fermats law Theorem

ll modInverse(ll a, ll p) {
    //calculates the modular multiplicative of a mod m.
    //(assuming p is prime).
    return modPow(a, p-2, p);
}


ll modBinomial(ll n, ll k, ll p) {
// calculates C(n,k) mod p (assuming p is prime).

    ll numerator = 1; // n * (n-1) * ... * (n-k+1)
    for (ll i=0; i<k; i++) {
        numerator = (numerator * (n-i) ) % p;
    }

    ll denominator = 1; // k!
    for (ll i=1; i<=k; i++) {
        denominator = (denominator * i) % p;
    }

    // numerator / denominator mod p.
    return ( numerator* modInverse(denominator,p) ) % p;
}
     num of divisor and euler totient

ll phi[1000001],mark[1000001],divi[1000001];;
void divisorPhi(ll n)
{
    for(int i=1;i<=n;i++)
        phi[i]=i;
    for(int i=2;i<=n;i++)
    {
        if(!mark[i])
        {
            for(int j=i;j<=n;j+=i)
            {
                mark[j]=1;
                phi[j]*=(1-1/(double)i);
            }
        }
    }
    for(ll i=1;i<=n;i++)
    {
        for(ll j=i;j<=n;j+=i)
            divi[j]++;
    }
}




/* Precode Ends */
ll A[5000001],B[5000001];
vector<ll>v;
map<ll,ll>myMap;
set<ll>mySet;
vector<pair<ll,ll> >vp;
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);

 ll n,m,k;
 cin>>n>>m>>k;
 if(n>=k)
 {
     n-=k;
     cout<<n<<" "<<m<<endl;
 }
 else
 {
     k-=n;
     n=0;
     if(m>=k)
     {
         m-=k;
     }
     else
     {
         m=0;
     }
     cout<<n<<" "<<m<<endl;
 }

return 0;
}



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

int main()
{
    char a[3];
     int  flag=0;

    scanf("%s",a);
    for(int i=0; i<2; i++)
    {
        if(a[0]!=a[1] && a[1]!=a[2] && a[2]!=a[0])
            flag=1;
    }
    if(flag==1)
    {
        printf("Yes\n");
    }
    else
    {
        printf("No\n");
    }
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <map>
#include <string>
using namespace std;
int main()
{
	string s,max("");
	map<string,int> word;
	map<int,string> tmp;
	while(cin >> s)
	{
		if(s.size() > max.size())max=s;
		word[s]++;
	}
	map<string,int>::iterator it;
	for(it=word.begin();it!=word.end();it++)
	{
		tmp[(*it).second] = (*it).first;
	}
	cout << (*tmp.rbegin()).second << " "<< max << endl;
	return 0;
}

Measured memory_bytes: 1196
#include <iostream>
#include <cstdlib>
#include <bitset>
#include <iomanip>
#include <string>
#include <vector>
#include <cmath>
#include <queue>
#include <algorithm>
#include <sstream>
#include <math.h>

using namespace std;

#define ll long long int
#define vecll vector<long long>
#define vec2ll vector<vector<long long>>
#define vecchar vector<char>
#define vecstr vector<string>
#define vecbool vector<bool>
#define vec2bool vector<vector<bool>>
#define vecpairll vector<pair<long long,long long>>
#define forll(s,a,b) for(long long s = a;s < b;s++)
#define forllde(s,a) for(long long s = a;s > 0;s--)

#define Pi 3.1415926535897932384626

int main() {
	ll n, ans = 0,count = 0;
	string s="No";
	bool flag = false;

	cin >> n;

	if (n >= 30)
		flag = true;

	if (flag)
		cout << "Yes";
	else
		cout << "No";
}


Measured memory_bytes: 3620
#include<stdio.h>
int main()
{
	int a,b=0,c=0,cn=1;
	scanf("%d",&a);
	if(a%2==0){
		printf("-1\n");
	}
	else {
		b=7%a;
		while(1){
			if(cn>100000000){
				printf("-1\n");
				break;
			}
			if(b!=0){
			cn++;
			c=(b*10)+7;
			b=c%a;
			}
			else {
				printf("%d\n",cn);
				break;
			}
		}
	}
	return 0;
}

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

int main() {
	
	string s;
	ll k;
	cin >> s >> k;
	
	rep(i, s.size()){
		if(s[i] != '1'){
			if(i < k){
				cout << s[i] << endl;
			}else{
				cout << 1 << endl;
			}
			return 0;
		}
	}
	
	cout << 1 << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

struct edge{int to; ll cost;};
const ll INF = LLONG_MAX/3;

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

    vector<vector<edge>> g(n);
    rep(i,n-1)
    {
        int a,b,c;
        scanf(" %d %d %d", &a, &b, &c);
        --a;
        --b;
        g[a].pb({b,c});
        g[b].pb({a,c});
    }

    int Q,K;
    scanf(" %d %d", &Q, &K);
    --K;

    vector<ll> d(n,INF);
    d[K] = 0;
    queue<int> que;
    que.push(K);
    while(!que.empty())
    {
        int v = que.front();
        que.pop();
        for(const auto &e:g[v])
        {
            if(d[e.to] > d[v]+e.cost)
            {
                d[e.to] = d[v]+e.cost;
                que.push(e.to);
            }
        }
    }

    while(Q--)
    {
        int x,y;
        scanf(" %d %d", &x, &y);
        --x;
        --y;
        printf("%lld\n", d[x]+d[y]);
    }
    return 0;
}


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

Measured memory_bytes: 128
#include<iostream>
#include<vector>
#include<algorithm>
#define REP(i,n) for(int i=0;i<n;i++)

using namespace std;

int main(void) {
	int W, H;
	string C;
	cin >> W >> H;
	cin >> C;
	REP(i, H) {
		REP(j, W) {
			if(i + j == 0 || i == 0 && j == W - 1 || j == 0 && i == H - 1 || i == H - 1 && j == W - 1) {
				cout << '+';
			}
			else if (i == 0 || i == H - 1) {
				cout << '-';
			}
			else if (j == 0 || j == W - 1) {
				cout << "|";
			}
			else if (i == int(H / 2) && j == int(W / 2)) {
				cout << C;
			}
			else {
				cout << ".";
			}
		}
		cout << endl;
	}
}


Measured memory_bytes: 3148
#include <cstdlib>
#include <iostream>
#include <unordered_map>
#include <vector>
using namespace std;

unordered_map<string, int> converter;
int convert(const string &s) {
	if(!converter.count(s)) converter.insert({s, converter.size()});
	return converter[s];
}

class union_find {
private:
	static constexpr int INF = (1 << 29);
	vector<int> uf, pd;
public:
	union_find(int n):uf(n, -1), pd(n, 0){}

	int find(int x) {
		if(uf[x] < 0) return x;
		const int new_parent = find(uf[x]);
		pd[x] += pd[uf[x]];
		return uf[x] = new_parent;
	}

	void unite(int x, int y, int d) {
		int rx = find(x), ry = find(y);
		if(rx == ry) return;

		d += pd[x] - pd[y];

		if(uf[rx] > uf[ry]) swap(rx, ry), d = -d;
		else if(uf[rx] == uf[ry]) --uf[rx];

		pd[ry] = d;
		uf[ry] = rx;
	}

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

	int dist(int x, int y) {
		if(find(x) != find(y)) return INF;
		return pd[y] - pd[x];
	}
};

bool judge(int n, const vector<int> &u, const vector<int> &v, const vector<int> &c) {
	union_find uf(n);
	for(unsigned i = 0; i < u.size(); ++i) {
		if(uf.same(u[i], v[i])) {
			if(uf.dist(u[i], v[i]) != c[i]) return false;
		}
		else {
			uf.unite(u[i], v[i], c[i]);
		}
	}
	return true;
}

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

	for(int n; cin >> n && n;) {
		converter.clear();
		vector<int> u(n), v(n), c(n);

		for(int i = 0; i < n; ++i) {
			int one;
			string left_unit, equeal, a, right_unit;
			cin >> one >> left_unit >> equeal >> a >> right_unit;
			u[i] = convert(left_unit);
			v[i] = convert(right_unit);
			c[i] = stoi(a.substr(3));
		}

		cout << (judge(converter.size(), u, v, c) ? "Yes" : "No") << endl;
	}

	return EXIT_SUCCESS;
}

Measured memory_bytes: 1256
#include<iostream>
#include<vector>

using namespace std;
using ll=long long;
int solve(){
    int s;
    cin>>s;
    vector<int> v;v.push_back(s);
    int ret = 0;
    for(int i=0;i<=1000000;++i){
        if(s%2==0){
            s = s/2;
        }else{
            s = 3*s + 1;
        }
        
        for(auto &a : v){
                if(s == a){
                    ret =  i;
                    return v.size()+1;
                }
        }
        v.push_back(s);
    }
    return ret;
}
int main(){
    cout << solve() << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <functional>
using namespace std;

#define All(v) (v).begin(),(v).end()
int dy[8] = {-1,0,1,0,-1,1,1,-1};
int dx[8] = {0,1,0,-1,1,1,-1,-1};
const long long mod = 1000000007;
template <int mod>
struct ModInt
{
    int x;
 
    ModInt() : x(0) {}
    ModInt(long long y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}
 
    ModInt &operator+=(const ModInt &p)
    {
        if ((x += p.x) >= mod)
            x -= mod;
        return *this;
    }
    ModInt &operator-=(const ModInt &p)
    {
        if ((x += mod - p.x) >= mod)
            x -= mod;
        return *this;
    }
    ModInt &operator*=(const ModInt &p)
    {
        x = (int)(1LL * x * p.x % mod);
        return *this;
    }
    ModInt &operator/=(const ModInt &p)
    {
        *this *= p.inverse();
        return *this;
    }
 
    ModInt operator-() const { return ModInt(-x); }
    ModInt operator+(const ModInt &p) const { return ModInt(*this) += p; }
    ModInt operator-(const ModInt &p) const { return ModInt(*this) -= p; }
    ModInt operator*(const ModInt &p) const { return ModInt(*this) *= p; }
    ModInt operator/(const ModInt &p) const { return ModInt(*this) /= p; }
 
    bool operator==(const ModInt &p) const { return x == p.x; }
    bool operator!=(const ModInt &p) const { return x != p.x; }
 
    ModInt inverse() const
    {
        int a = x, b = mod, u = 1, v = 0, t;
        while (b > 0)
        {
            t = a / b;
            a -= t * b;
            swap(a, b);
            u -= t * v;
            swap(u, v);
        }
        return ModInt(u);
    }
 
    ModInt pow(int e)
    {
        long long a = 1, p = x;
        while (e > 0)
        {
            if (e % 2 == 0)
            {
                p = (p * p) % mod;
                e /= 2;
            }
            else
            {
                a = (a * p) % mod;
                e--;
            }
        }
        return ModInt(a);
    }
 
    friend ostream &operator<<(ostream &os, const ModInt<mod> &p)
    {
        return os << p.x;
    }
    friend istream &operator>>(istream &is, ModInt<mod> &a)
    {
        long long x;
        is >> x;
        a = ModInt<mod>(x);
        return (is);
    }
};
 
using modint = ModInt<mod>;
signed main(){
    long long n;
    cin>>n;
    vector<long long> a(n);
    for(int i=0;i<n;i++)cin>>a[i];
    modint res=0;
    for(int i=0;i<60;i++){
        long long cnt=0;
        for(int j=0;j<n;j++){
            if(a[j]&(1ll<<i)){
                cnt++;
            }
        }
        res+=(1ll<<i)%mod*cnt%mod*(n-cnt)%mod;
    }
    cout<<res<<endl;
}


Measured memory_bytes: 2560
#include<stdio.h>

int main(void){
   int a,b,i;
   scanf("%d",&a);
   int c[a+1];
   for(i=0;i<a+1;i++){
       c[i]=0;
   }
   for(i=1;i<a;i++){
       scanf("%d",&b);
       c[b]+=1;
   }
   for(i=1;i<=a;i++){
       printf("%d\n",c[i]);
   }
}

Measured memory_bytes: 2456
#include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>

using namespace std;

#define FOR(i,k,n) for(int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

template<class T> void debug(T begin, T end){ for(T i = begin; i != end; ++i) cerr<<*i<<" "; cerr<<endl; }
inline bool valid(int x, int y, int W, int H){ return (x >= 0 && y >= 0 && x < W && y < H); }

typedef long long ll;
const int INF = 100000000;
const double EPS = 1e-8;
const int MOD = 1000000007;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
void update(int& x, int y){
  if(x < y) x = y;
}
int main(){
  int C, D, W, X;
  while(cin >> C >> D >> W >> X && C){
    int E[30][15]; // day place
    int F[30][15]; // day place
    REP(i, C) REP(j, D) cin >> E[j][i];
    REP(i, C) REP(j, D) cin >> F[j][i];
    int dp[31][51][6] = {}; // day weight x
    REP(i, D + 1) REP(j, W + 1) REP(k, X + 1) dp[i][j][k] = -INF;
    dp[0][0][0] = 0;
    for(int day = 0; day < D; day++){
      for(int weight = 0; weight <= W; weight++){
        for(int cont = 0; cont <= X; cont++){
          update(dp[day + 1][weight][cont], dp[day][weight][cont]);
          for(int i = 0; i < C; i++){
            int next_w = weight;
            int profit = 0;
            for(int j = i; j < C; j++){
              if(E[day][j] == 0) break;
              next_w += F[day][j];
              profit += E[day][j];
              if(next_w > W) break;
              if(i != j && cont + 1 > X) break;
              if(i == j) update(dp[day + 1][next_w][cont], dp[day][weight][cont] + profit);
              if(i != j) update(dp[day + 1][next_w][cont + 1], dp[day][weight][cont] + profit);
            }
          }
        }
      }
    }
    int ans = 0;
    REP(w, W + 1) REP(c, X + 1) update(ans, dp[D][w][c]);
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 1208
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (int)(k); i < (int)(n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) a.begin(), a.end()
#define MS(m,v) memset(m,v,sizeof(m))
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
const int MOD = 1e9 + 7;
template<class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<class T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template<class T>
istream& operator >> (istream& is, vector<T>& v)
{
	for (auto &i : v) is >> i;
	return is;
}
template<class T>
ostream& operator<<(ostream& os, vector<T>& v)
{
	const string delimiter = "\n";
	REP(i, v.size())
	{
		os << v[i];
		if (i != v.size() - 1) os << delimiter;
	}
	return os;
}
/*--------------------template--------------------*/

int add();

string s;
int p;

int num()
{
	int res;
	if (s[p] == '(')
	{
		p++;
		res = add();
		assert(s[p] == ')');
		p++;
	}
	else if (isdigit(s[p]))
	{
		res = 0;
		while (p < s.size() && isdigit(s[p]))
		{
			res *= 10;
			res += s[p] - '0';
			p++;
		}
	}
	else assert(false);
	return res;
}

int mul()
{
	int res = num();
	while (p < s.size() && (s[p] == '*' || s[p] == '/'))
	{
		char c = s[p];
		p++;
		int r = num();
		if (c == '*')
		{
			res *= r;
		}
		else if (c == '/')
		{
			res /= r;
		}
	}
	return res;
}

int add()
{
	int res = mul();
	while (p < s.size() && (s[p] == '+' || s[p] == '-'))
	{
		char c = s[p];
		p++;
		int r = mul();
		if (c == '+')
		{
			res += r;
		}
		else if (c == '-')
		{
			res -= r;
		}
	}
	return res;
}

int solve()
{
	p = 0;
	return add();
}

int main()
{
	cin.sync_with_stdio(false); cout << fixed << setprecision(10);
	int n; cin >> n;
	REP(cs, n)
	{
		cin >> s;
		s = s.substr(0, s.size() - 1);
		cout << solve() << endl;
	}
	return 0;
}


Measured memory_bytes: 3204
#include <bits/stdc++.h>
using namespace std;
#define vsort(vec) sort(vec.begin(), vec.end())
#define vreverse(vec) reverse(vec.begin(), vec.end())
using ll =long long;
const ll INF =1001001001;

//最大公約数
ll gcd(ll a, ll b){
   if (a%b==0){
       return(b);
   }else{
       return(gcd(b,a%b));
   }
}
//最小公倍数
ll lcm(ll a, ll b){
   return a*b/gcd(a,b);
}

//素数判定
ll isprime(ll n){
  bool prime=true;
  for(int i=2;i<n;i++){
    if(n%i==0){
      prime=false; break;
    }
  }
if(prime){cout<<n<<" is prime"<<endl;
         }else{cout<<n<<" is not prime"<<endl;}

}
//階乗　20くらいが限界
ll factorial(ll n){
  ll a=1;ll b=n;
  for(int i=0;i<n;i++){
    a*=b;
    b--;
  }
  return a;
}

//組み合わせ　nCr
ll comb(ll a,ll b){
  ll c;
  c=factorial(a)/(factorial(a-b)*factorial(b));
  return c; 
}




/*10億7。　　　100000007
2*2行列 H*W
vector<vector<int>> vec(H,vector<int>(W));
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
cin>>vec[i][j];
  }
}

文字列→数列
string S;int A=atoi(S.c_str());
数列→文字列
int A;string S=to_string(A);
数字判定　isdigit(a)
pair宣言　pair<int,int> p(5,7);
ソート　sort(vec.begin(),vec.end());
*/

int main(){
cout<<fixed<<setprecision(10);


  int N;cin>>N;
  if(N%2==0){
cout<<N/2<<endl;}
  else{
    cout<<N/2+1<<endl;}
  
  
}


Measured memory_bytes: 256
from math import factorial

nm = input().split()
n = int(nm[0])
m = int(nm[1])

f = []

i = 2
j = 0
while (m > 1) and i<=m:
    while m%i == 0:
        m /= i
        j += 1
    if j >= 1:
        f.append(j)
    i += 1
    j = 0

        
ans = 1

for k in f:
    if k > 0:
        ans *= factorial(n+k-1) // (factorial(k) * factorial(n-1))
    
print(int(ans) % (10**9+7))

Measured memory_bytes: 114428
#pragma region

#include <bits/stdc++.h>
using namespace std;
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end) for (register int i = (begin); i < (end); i++)
#define IFOR(i, begin, end) for (register int i = (end)-1; i >= (begin); i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define MOD 1000000007
#define debug(x) cerr << #x << " = " << (x) << " (line: " << __LINE__ << ") " << endl;
typedef long long ll;
template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
  for (auto &v : vec) is >> v;
  return is;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
  os << "vec[ ";
  REP(i, vec.size())
  i == 0
      ? os << vec[i]
      : os << ", " << vec[i];
  os << " ]";
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, const deque<T> &deq) {
  os << "deq[ ";
  REP(i, deq.size())
  i == 0
      ? os << deq[i]
      : os << ", " << deq[i];
  os << " ]";
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, const set<T> &set) {
  os << "{ ";
  for (auto &&s : set) &s == &(*set.begin()) ? os << s : os << ", " << s;
  os << " }";
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, const unordered_set<T> &set) {
  os << "{ ";
  for (auto &&s : set) &s == &(*set.begin()) ? os << s : os << ", " << s;
  os << " }";
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, const multiset<T> &set) {
  os << "{ ";
  for (auto &&s : set) &s == &(*set.begin()) ? os << s : os << ", " << s;
  os << " }";
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, const unordered_multiset<T> &set) {
  os << "{ ";
  for (auto &&s : set) &s == &(*set.begin()) ? os << s : os << ", " << s;
  os << " }";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) {
  os << "(" << p.first << ", " << p.second << ")";
  return os;
}
template <typename TK, typename TV>
ostream &operator<<(ostream &os, const map<TK, TV> &m) {
  os << "{ ";
  for (auto &&k : m) &k == &(*m.begin()) ? os << k.first << " => " << k.second : os << ", " << k.first << " => " << k.second;
  os << " }";
  return os;
}
template <typename TK, typename TV>
ostream &operator<<(ostream &os, const unordered_map<TK, TV> &m) {
  os << "{ ";
  for (auto &&k : m) &k == &(*m.begin()) ? os << k.first << " => " << k.second : os << ", " << k.first << " => " << k.second;
  os << " }";
  return os;
}

#pragma endregion
#define MAX 2147483647

ll gcd(ll a, ll b) {
  ll M = max(a, b);
  ll m = min(a, b);
  if (m == 0) return M;
  return gcd(M - m, m);
}

int p(ll n, ll b = 2) {
  if (n == 1) return 0;
  ll s = sqrt(n);
  FOR(i, b, s + 1) {
    if (n % i == 0) {
      while (n % i == 0) n /= i;
      return p(n, i + 1) + 1;
    }
  }
  return 1;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(16);

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

  ll m = gcd(A, B);
  cout << p(m) + 1 << "\n";
}


Measured memory_bytes: 256
#include<stdio.h>

int main(void){
  int a,b;

  scanf("%d", &a);
  scanf("%d", &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 <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define int long long
#define endl '\n'
#define pb push_back
#define fi first
#define se second
#define all(c) (c).begin(),(c).end()
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;

template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define TRACE
#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

const ll inf = 2e18;
const int mod = 1e9 + 7;
const int N = 2e5 + 10;

signed main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);

	int x, n;
	cin >> x >> n;
	set<int> s;
	for(int i = 0; i < n; i++) {
		int t;
		cin >> t;
		s.insert(t);
	}
	int mn = inf, ans;
	for(int i = 0; i <= 101; i++) {
		if(s.find(i) == s.end()) {
			if(mn > abs(x - i)) {
				ans = i;
				mn = abs(x - i);
			}
		}
	}
	cout << ans;

	return 0;
}

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

#define all(C) C.begin(),C.end()
#define size(C) int(C.size())
typedef long long int Long;
typedef long double Double;
const int MAXN = 1e5 + 5;


int main() {
  int a, b;
  scanf("%d%d", &a, &b);

  puts(a > 8 || b > 8 ? ":(" : "Yay!");
  return 0;
}

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

int main() {
  int A, B, C;
  cin >> A >> B >> C;
  for(int i=1; i<=B; i++){
    if((i*A)%B == C){
      cout << "YES" << endl; 
      return 0;
    }
  }
  cout << "NO" << endl; 
}


Measured memory_bytes: 256