akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#define INF 2147483647

int n,head,tail,Q[100],color[100],d[100],A[100][100];


 
void enqueue(int x){
  Q[tail] = x;
  if(tail+1 == 100)tail = 0;
  else tail ++;
}


void bfs(int s){

  int i,u;
 
  for(i = 0;i < n;i ++)
    {
    color[i] = 0;
    d[i] = INF;
  } 
 
  color[s] = 1;
  d[s] = 0;
  
  enqueue(s);
 
  while(head != tail)
    {
    u = dequeue();
 
    for(i = 0;i < n;i ++)
      {
      if(A[u][i] == 1 && color[i] == 0)
	{
    color[i] = 1;
    d[i] = d[u]+1;
    
    enqueue(i);
      }
    }
    color[u] = 2;
  }
}

 
int dequeue(){

  int x;
 
  x=Q[head];

  if(head+1==100){
    head=0;
  }else head ++;
 
  return x;
}
 
int main(){

  int i,j,u,k,v;
   
  scanf("%d",&n);
   
  for(i = 0;i < n;i ++)
    {
      for(j = 0;j < n;j ++)
	{
	A[i][j] = 0;
      }
  }
   
  for(i = 0;i < n;i ++)
    {
    scanf("%d%d",&u,&k);

    for(j = 0;j < k;j ++)
      {
      scanf("%d",&v);
      A[u-1][v-1]=1;
    }
  }
  bfs(0);
 
  for(i = 0;i < n;i ++)
    {
      if(d[i] == INF){
	d[i]=-1;
      }
      
    printf("%d %d\n",i+1,d[i]);
  }
 
  return 0;
}
 

Measured memory_bytes: 636
#include<iomanip>
#include<limits>
#include<thread>
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
#include<cassert>
#include<random>
#include<chrono>
#include<unordered_map>
#include<fstream>
#include<list>
#include<functional>
#include<bitset>
#include<complex>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pi;
typedef pair<double,double> pd;
typedef pair<double,ll> pdl;
#define F first
#define S second
const ll E=1e18+7;
const ll MOD=1000000007;




int main(){
    ll h,w;
    cin>>h>>w;
    vector<ll> a(h),b(w);
    for(auto &i:a){cin>>i;}
    for(auto &i:b){cin>>i;}
    ll ans=0;
    sort(b.begin(),b.end());
    vector<ll> dp(w+1,0);
    for(int i=0;i<w;i++){
        dp[i+1]=dp[i]+b[i];
    }
    sort(a.begin(),a.end());
    ll l=0;
    for(int i=0;i<h;i++){
        while(l<w && b[l]<=a[i]){l++;}
        ans+=dp[l];
        ans+=a[i]*(w-l);
    }
    cout<<ans<<endl;
    
    
    return 0;
}



Measured memory_bytes: 5244
def main():
    N = int(input())
    C = [0 for _ in range(N-1)]
    S = [0 for _ in range(N-1)]
    F = [0 for _ in range(N-1)]
    for i in range(N-1):
        C[i], S[i], F[i] = map(int, input().split())

    for i in range(N-1):
        t = 0
        now = i
        while now < N-1:
            if t < S[now]:
                t = S[now]
            for dt in range(101):
                if (t+dt)%F[now]==0:
                    t += dt + C[now]
                    now += 1
                    break
        print(t)
    print(0)


if __name__ == '__main__':
    main()



Measured memory_bytes: 3188
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.nextLine());
		String a = sc.nextLine();
		List<Integer> aList = new ArrayList<Integer>();
		Arrays.stream(a.split(" ")).forEach(e -> aList.add(Integer.valueOf(e)));
		Collections.sort(aList);

		System.out.println(aList.get(n - 1) - aList.get(0));

		sc.close();
	}
}

Measured memory_bytes: 29008
#include<bits/stdc++.h>
using namespace std;
const int MAXN = 1 + 4e3;
typedef long long LL;
typedef pair < int, int > II;
typedef pair < int, II > III;

int n, m;

int main()
{
    #define TASK "ABC"
 //   freopen(TASK".inp","r",stdin);
//    freopen(TASK".out","w",stdout);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    cin >> n >> m;
    vector < long long > dp(m+1);
    for (int i = 0; i < n; i++){
        long long weight, val;
        cin >> weight >> val;
        for (int j = m - weight; j >= 0; j--)
            dp[j + weight] = max (dp[j + weight] , dp[j] + val);
    }
    cout << dp[m];


    return 0;
}




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

using namespace std;
using ll = long long;

#define rep(i, a) for (int i = 0; (i) < (int) (a); (i)++)
#define reps(i, a, b) for (int i = (int) (a); (i) < (int) (b); (i)++)
#define rrep(i, a) for (int i = (int) a-1; (i) >= 0; (i)--)
#define rreps(i, a, b) for (int i = (int) (a)-1; (i) >= (int) (b); (i)--)
#define MP(a, b) make_pair((a), (b))
#define PB(a) push_back((a))
#define all(v) (v).begin(), (v).end()
#define PERM(v) next_permutation(all(v))
#define UNIQUE(v) sort(all(v));(v).erase(unique(all(v)), v.end())
#define CIN(type, x) type x;cin >> x
#define TRUE__  "YES"
#define FALSE__ "NO"
#define PRINT(f) if((f)){cout << (TRUE__) << endl;}else{cout << FALSE__ << endl;}
#define RS resize
#define CINV(v, N) do {\
	v.RS(N);\
	rep(i, N) cin >> v[i];\
} while (0);
#define RCINV(v, N) do {\
	v.RS(N);\
	rrep(i, N) cin >> v[i];\
} while (0);

#define MOD 1000000007

void init();
void solve();

signed main()
{
	init();
	solve();
}

int N;
vector<int> v;

void init()
{
	cin >> N;
	v.RS(1, 0);
	rep(i, N) {
		int t;
		cin >> t;
		v.PB(t);
	}
}


void solve()
{
	ll res = 0;
	reps(i, 1, N+1) {
		if (v[i-1] && v[i]) {
			res++;
			v[i]--;
		}
		res += v[i] / 2;
		v[i] %= 2;
	}
	cout << res << endl;
}





Measured memory_bytes: 892
import std.stdio, std.conv, std.string, std.algorithm, std.range, std.math;

void main() {
  auto po = readln.split.to!(int[]);
  auto H = po[0], W = po[1];
  string[] lines;
  foreach (i; 0..H) {
    lines ~= readln.chomp;
  }
  foreach (i; 0..W+2) {
    write("#");
  }
  writeln;
  foreach (line; lines) {
    write("#");
    write(line);
    writeln("#");
  }
  foreach (i; 0..W+2) {
    write("#");
  }
  writeln;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  vector<bool> check(8,false);
  int b=0;
  for(int i=0; i<N; i++){
    int a;
    cin >> a;
    if(a>=1&&a<=399) check.at(0)=true;
    if(a>=400&&a<=799) check.at(1)=true;
    if(a>=800&&a<=1199) check.at(2)=true;    
    if(a>=1200&&a<=1599) check.at(3)=true;
    if(a>=1600&&a<=1999) check.at(4)=true;
    if(a>=2000&&a<=2399) check.at(5)=true;
    if(a>=2400&&a<=2799) check.at(6)=true;    
    if(a>=2800&&a<=3199) check.at(7)=true; 
    if(a>=3200) b++;     
  }
  int ans1=0;
  for(int i=0; i<8; i++){
    if(check.at(i)) ans1++;
  }
  int ans2=ans1+b;
  ans1=max(1,ans1);  
  cout << ans1 << " " << ans2 << endl;
}

Measured memory_bytes: 256
n = int(input())
arr = list(map(int,input().split()))



min_cost = 1e18
for i in range(1,101):
    temp_cost = 0
    for j in range(n):
        temp_cost += (arr[j]-i)**2

    if temp_cost < min_cost:
        min_cost = temp_cost

print(min_cost)

Measured memory_bytes: 2940
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <iomanip>
#include <cmath>
#include <cstdio>
#include <map>
#define REP(i,n) for (int i=0;i<(n);++i)
using namespace std;
using ll = long long;
constexpr ll INF = 1LL << 60;

string s;
ll q, a, f;
char c;

int main() {
  ios::sync_with_stdio(false); cin.tie(0);
  cin >> s;
  if (s == "AAA" || s == "BBB") {
    cout << "No" << endl;
  } else {
    cout << "Yes" << endl;
  }
  return 0;
}



Measured memory_bytes: 256
s = input()
N = len(s)
s = 'L' + s + 'R'
 
cl = [1] * (N + 1)
for i in range(1, N + 1):
  if s[i] == 'R' and s[i + 1] == 'R':
    cl[i + 2] += cl[i]
    cl[i] = 0
 
for i in range(N, 0, -1):
  if s[i] == 'L' and s[i - 1] == 'L':
    cl[i - 2] += cl[i]
    cl[i] = 0
    
print(' '.join([str(n) for n in cl[1:(N + 1)]]))


Measured memory_bytes: 11160
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] s = new int[n+1];
		for(int i=0;i<n;i++) {
			s[i] = sc.nextInt();
		}
		int q = sc.nextInt();
		int[] t = new int[q];
		for(int i=0;i<q;i++) {
			t[i] = sc.nextInt();
		}
		
		int count = 0;
		for(int i=0;i<q;i++) {
			s[n] = t[i];
			int j=0;
			while(s[j] != s[n]) {
				j++;
			}
			if(j != n) {
				count++;
			}
		}
		
		System.out.println(count);
	 }
}




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

using namespace std;
using ll = long long;

template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;

#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_V(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl;
#define DEBUG_M(v) cerr<<#v<<endl;for(int i=0;i<v.size();i++){for(int j=0;j<v[i].size();j++) {cerr<<v[i][j]<<" ";}cerr<<endl;}

int main() {
    int p, q, r;
    cin>>p>>q>>r;
    cout<<p+q+r-max({p, q, r})<<endl;

    return 0;
}

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

x = list(map(int, input().split()))
y = list(map(int, input().split()))

max_x = (max(x) + 1) 

ok = 0
dame = 0

for i in y:
    if max_x <= i:
        ok = ok + 1
    else:
        dame = dame + 1

if dame != 0:
    print("War")
elif (X < max_x <= Y) and dame == 0:
    print("No War")
else:
    print("War")

Measured memory_bytes: 3064
N = int(input())
stocks = list(map(int,input().split()))
now_stock = stocks[0]
cash = 1000
max_min_stocks = []
if now_stock <= stocks[1]:
    up_flag = True
    max_min_stocks.append(stocks[0])
else:
    up_flag = False
f_up_flag = up_flag
i = 1

while i < N:
    next_stock = stocks[i]
    if up_flag:
        if now_stock <= next_stock:
            now_stock = next_stock
        else:
            max_min_stocks.append(now_stock)
            up_flag = False
    else:
        if now_stock >= next_stock:
            now_stock = next_stock
        else:
            max_min_stocks.append(now_stock)
            up_flag = True
    now_stock = next_stock
    i += 1
if up_flag:
    max_min_stocks.append(stocks[-1])
else:
    max_min_stocks.append(stocks[-1])
# print(max_min_stocks)

if len(max_min_stocks) >= 2:
    for i in range(len(max_min_stocks) // 2):
        hold_stocks = cash // max_min_stocks[2 * i]
        cash -= hold_stocks * max_min_stocks[2 * i]
        cash += hold_stocks * max_min_stocks[2 * i + 1]
print(cash)



Measured memory_bytes: 61936
/**
 *      purpose : 
 *      author  : kyomukyomupurin
 *      created : 
**/

// input/output
#include <fstream>
#include <iostream>
#include <sstream>
// container class
#include <array>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
// math, algorithm
#include <algorithm>
#include <cmath>
#include <complex>
#include <numeric>
// etc
#include <bitset>
#include <cassert>
#include <cctype>
#include <cstring>
#include <chrono>
#include <iomanip>
#include <random>
#include <utility>
// using-directive
using namespace std;
// alias template
using int64 = long long;
using vi = vector<int>;
using vl = vector<int64>;
using pii = pair<int, int>;
using pii = pair<int, int>;
using pll = pair<int64, int64>;
// text macro replacement
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define print(x) cout << (x) << '\n'
#define debug(x) cerr << #x << ": " << (x) << '\n'
#define dbg(v) for (size_t _ = 0; _ < v.size(); ++_){cerr << #v << "[" << _ << "] : " << v[_] << '\n';}
// variadic template
template<typename T> inline void chmin(T &a, T b) {if (a > b) a = b; return;}
template<typename T> inline void chmax(T &a, T b) {if (a < b) a = b; return;}
// constant
const int INF = (1<<30) - 1;
const int64 INF64 = (1LL<<62) - 1;
const int MOD = 1000000007;

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

  int n; cin >> n;
  set<string> st;
  for (int i = 0; i < n; ++i) {
    string op, k; cin >> op >> k;
    if (op == "insert") {
      st.insert(k);
    } else {
      if (st.find(k) != st.end()) {
        cout << "yes" << '\n';
      } else {
        cout << "no" << '\n';
      }
    }
  }

  return 0;
}


Measured memory_bytes: 29056
#include <cstdio>
#include <algorithm>
#include <cstring>
using namespace std;

int main()
{
	char data[100+5];
	scanf("%s",&data);
	bool flag=true;
	for(int i=0;i<strlen(data);i++)
	{
		if(i% 2==0)
		{
			if(data[i]=='R' || data[i]=='U' || data[i]=='D')
			{
				
			}
			else
			{
				flag=false;
				break;
			}
		}
		else
		{
			if(data[i]=='L' || data[i]=='U' || data[i]=='D')
			{
				
			}
			else
			{
				flag=false;
				break;
			}
		}
	}
	if(flag==true)
	{
		printf("Yes\n");
	}
	else
	{
		printf("No\n");
	}
	return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;

int main() {
	//HogeFuga
    int N;
    int Alice = 0;
    int Bob = 0;
    vector<int> numCards;
    
    cin >> N;
    
    for (int i = 0 ; i < N ; i++) {
        int a;
        cin >> a;
        numCards.push_back(a);
    }
    
    sort (numCards.begin() , numCards.end());
    
    for ( int i = 0 ; i < N ; i++) {
        if (i%2 == 0){
            Alice = Alice + numCards.back();
            numCards.pop_back();
        } else {
            Bob = Bob + numCards.back();
            numCards.pop_back();
        }
    }
    
    cout << Alice - Bob << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int (i) = 0; (i) < (int)(n); i++) 
#define FOR(i, a, b) for(int (i) = a; (i) < (int)b; i++)
#define RREP(i, n) for(int (i)=((int)(n)-1); (i)>=0; i--)
#define RFOR(i, a, b) for(int (i) =((int)(b)-1); (i)>=(int)a; i--)
#define ALL(v) (v).begin(),(v).end()
#define MOD 1000000007
#define NIL -1
#define FI first
#define SE second
#define MP make_pair
#define PB push_back
#define SZ(x)  (int)x.size()
#define SP(x)  setprecision((int)x)


using namespace std ;
typedef long long ll;
using Graph = vector<vector<int>>;
typedef vector<int> vint;
typedef vector<vint> vvint;
typedef vector<string> vstr;
typedef pair<int, int> pii;
const int INF = 1e9;
const ll LINF = 1e18;
const double EPS = 1e-9;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
ll gcd(ll a, ll b) {return b ? gcd(b, a % b) : a;} //最大公約数
ll lcm(ll a, ll b) {return a / gcd(a, b) * b;} //最小公倍数

//-------------------------------------------------
// 
void yes(){
  cout <<"Yes"<<endl ;
}
void no(){
  cout <<"No"<<endl ;
}


//-------------------------------------------------
// メモ
/*






*/
//-------------------------------------------------


int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, k, s ;
  cin >> n >> k >> s ;
  int large = INF ;
  if(s==INF){
    large = INF-1 ;
  }
  REP(i,n){
    if(i<k){
      cout << s <<endl ;
    }
    else{
      cout << large <<endl ;
    }
    cout <<" " ;
  }
  cout <<endl ;
  
  
  
  
  return 0 ;
}




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

using namespace std;

void solve() {
    int ans = 0;
    int n; cin >> n;
    vector<int> vt(n);
    for (int i = 0; i < n; i++) {
        cin >> vt[i];
    }
    sort(vt.begin(), vt.end());
    for (int i = 0; i < n; i++) {
        for (int j = i + 1; j < n; j++) {
            if (vt[j] == vt[i])
                continue;
            for (int k = j + 1; k < n; k++) {
                if (vt[k] == vt[j])
                    continue;
                ans += (vt[i] + vt[j] > vt[k]);
            }
        }
    }
    cout << ans;
}

int main() {
    ios::sync_with_stdio(NULL), cin.tie(0), cout.tie(0);
    cout.setf(ios::fixed), cout.precision(20);
    solve();
}


Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define PI acos(-1)
typedef  long long ll;
ll gcd(ll x,ll y){
   if(y==0) return x;
   else return gcd(y,x%y);
}
ll lcm(ll x,ll y){
   return x/gcd(x,y)*y;
}

int main(){
   int n;
   cin>>n;
   vector<int> a(5,0);
   set<string> s;

   rep(i,n){
      string c;
      cin>>c;
      if(s.find(c)!=s.end()) continue;
      s.insert(c);
      if(c[0]=='M') a[0]++;
      else if(c[0]=='A') a[1]++;
      else if(c[0]=='R') a[2]++;
      else if(c[0]=='C') a[3]++;
      else if(c[0]=='H') a[4]++;
   }
   ll ans=0;
   for(int i=0;i<5;i++){
      for(int j=i+1;j<5;j++){
         for(int k=j+1;k<5;k++){
            ans+=(ll)a[i]*(ll)a[j]*(ll)a[k];
         }
      }
   }
   cout<<ans;
   return 0;
}


Measured memory_bytes: 11368
#include<iostream>

using namespace std;
typedef long long ll;

ll cnt['z' -'a' + 1];

int main(void)
{
        ll res = 1;
        string str;     cin >> str;

        for (int i = 0; i < str.size(); i ++)
        {
                res += i - cnt[str[i]-'a'];
                cnt[str[i]-'a']++;
        }

        cout << res << endl;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define repA(a,i,n) for(int i=a;i<n;i++)
#define trav(x,a)for(auto &x: a)
#define fll(a) memset(a,0,sizeof(a));
#define mp make_pair
#define pb push_back
#define all(x) x.begin(),x.end()
#define F first
#define S second
#define itr(it,x) for(auto it=x.begin();it!=x.end();it++)
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll>pii;
typedef vector<ll>vi;
typedef map<ll,ll>ma;
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL);
void fopen()
{
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);	
}

int main()
{
	//fopen();
	ll n;
	cin>>n;
	if(n%2){
		cout<<0;
	}
	else{
		 ll s=0;
		 for(ll i=5;n/i>=1;i*=5)
		 {
		 	ll p=n/i;
		 	s+=p-p/2-(p%2);
		 }
		 cout<<s;	
	}

	
}
	


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

using namespace std;
using ll = long long;
using edge = struct {int to; ll cost;};

#define mod 1000000007
#define REP(i, n) for (int i = 0; i < n; i++)
#define INF (1 << 29)


//long C(long n, long r);
//long long gcd(long long a, long long b);
//long long lcm(long long a, long long b);

vector<vector<int>> tree(100001);
map<int, int> leefs;
int ans = 0;

vector<int> dis(100001);

void dfs(int v, int p, int d){
    bool isLeef = true;
    for(auto &x : tree[v]){
        if(x == p) continue;
        isLeef = false;
        dfs(x, v, d+1);
    }
    if(isLeef) leefs[v] = d;
}

void ddfs(int v, int p, int d){
    dis[v] = d;
    for(auto &x : tree[v]){
        if(x == p) continue;
        ddfs(x, v, d+1);
    }
}

void solve()
{
    int n, u, v;
    cin >> n >> u >> v;
    for(int i = 0; i < n - 1; i++){
        int a, b;
        cin >> a >> b;
        tree[a].push_back(b);
        tree[b].push_back(a);
    }
    dfs(v, -1, 0);
    ddfs(u, -1, 0);
    for(auto &x : leefs){
        if(dis[x.first] < x.second) ans = max(ans, x.second - 1);
    }
    cout << ans << "\n";
}

int main()
{
    solve();
    return 0;
}

Measured memory_bytes: 12928
#pragma GCC optimize ("O3")

#include <bits/stdc++.h>
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define dump(x)  cerr << #x << " = " << (x) << endl
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl

using namespace std;

typedef long long ll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> Pin;

ll INF = 10e16;
int inf = 10e8;

template<typename T>
ostream& operator << (ostream& os, const vector<T>& vec) {
    os << "[ ";
    REP(i, vec.size()) {
        os << vec[i] << " ";
    }
    os << "]";

    return os;
}

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

    int cnt[9][9];
    REP(i, 9) REP(j, 9) cnt[i][j] = 0;

    REP(i, N+1) {
        int s = i % 10;
        if (s == 0) continue;

        int t = i;
        while(t > 9) t /= 10;

        cnt[s-1][t-1]+= 1;
    }

    ll res = 0;
    REP(i, 9) REP(j, 9) res += cnt[i][j] * cnt[j][i];
    
    cout << fixed << setprecision(20);
    cout << res << endl;

}


Measured memory_bytes: 256
#include <iostream>
#include<string.h>
#include<algorithm>
using namespace std;

int main() {
	int A,B,ans1,ans2,ans3;
	
	cin >> A >> B;
	
	ans1 = A + B;
	ans2 = A - B;
	ans3 = A * B;
	
	cout << max({ ans1, ans2, ans3 }) << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define GET_MACRO(_1,_2,_3,_4,_5,_6,NAME,...) NAME
#define pr(...) cerr<< GET_MACRO(__VA_ARGS__,pr6,pr5,pr4,pr3,pr2,pr1)(__VA_ARGS__) <<endl
#define pr1(a) (#a)<<"="<<(a)<<" "
#define pr2(a,b) pr1(a)<<pr1(b)
#define pr3(a,b,c) pr1(a)<<pr2(b,c)
#define pr4(a,b,c,d) pr1(a)<<pr3(b,c,d)
#define pr5(a,b,c,d,e) pr1(a)<<pr4(b,c,d,e)
#define pr6(a,b,c,d,e,f) pr1(a)<<pr5(b,c,d,e,f)
#define pr7(a,b,c,d,e,f,g) pr1(a)<<pr6(b,c,d,e,f,g)
#define pr8(a,b,c,d,e,f,g,h) pr1(a)<<pr7(b,c,d,e,f,g,h)
using namespace std;
using Int = long long;
using ll = long long;
using Double = long double;
const Int INF = 1LL<<55;
const Int mod = (1e9)+7;
using P = pair<Int,Int>;
using T = tuple<Int,Int,Int>;
const Double EPS = 1e-8;
const Double PI = 6.0 * asin((Double)0.5);
template<class T> T Max(T &a,T b){return a=max(a,b);}
template<class T> T Min(T &a,T b){return a=min(a,b);}
ostream& operator<<(ostream& o,P p){return o<<"("<<p.first<<","<<p.second<<")";}
ostream& operator<<(ostream& o,T t){return o<<"("<<get<0>(t)<<","<<get<1>(t)<<","<<get<2>(t)<<")";}
istream& operator>>(istream& i,P &p){return i>>p.first>>p.second;}
ostream& operator<<(ostream& o,vector<auto> &a){Int i=0;for(auto t:a)o<<(i++?" ":"")<<t;return o;}
istream& operator>>(istream& i,vector<auto> &a){for(auto &t:a)i>>t;return i;}
void prArr(auto a,string s=" "){Int i=0;for(auto t:a)cout<<(i++?s:"")<<t;cout<<endl;}


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

  map<string,int> M;
  
  int q;
  cin>>q;

  while(q--){
    int cmd;
    cin>>cmd;
    if(cmd == 0){
      string key;
      int x;
      cin>>key>>x;
      M[key] = x;
    }
    
    if(cmd == 1){
      string key;
      cin>>key;
      cout<<M[key]<<endl;
    }
    

  }
  
  return 0;
}



Measured memory_bytes: 25856
#include<bits/stdc++.h>
using namespace std;
int main(){
	long long int a,b,c,k;
	cin>>a>>b>>c>>k;
	long long int sum=0;
	long long int count=0;
		while(count<a and count<k)
		{
		sum=sum+1;count++;}
		long long int c2=count;
		while(count-c2<b and count<k)
		{
		count++;}
		long long int c1=count;
		while(count<k)
		{
			
			if(count-c1<c)
		sum=sum-1;count++;}

	cout<<sum;
}

Measured memory_bytes: 3596
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<P, int> Pi;

int main(void){
	int k,i,s,ans=0,r;
	cin >> k >> s;
	for(i=0; i<=k; ++i){
		r = s-i;
		if(r > 2*k || r < 0){
			continue;
		}
		ans += max(min(k,r)-max(0,r-k)+1,0);
	}
	cout << ans << endl;
	return 0;
}


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

int main() {
  int n;cin>>n;
  vector<int> a(n), c(n-1);int ans=0;
  for(int i=0;i<n;i++)cin>>a[i];
  for(int i=0;i<n;i++){int t;cin>>t;ans+=t;}
  for(int i=0;i<n-1;i++)cin>>c[i];
  for(int i=0;i<n-1;i++){
  	if(a[i+1]-a[i]==1)ans += c[a[i]-1];
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < (int)n; i++)
#define REPvec(itr, mp) for(auto itr = mp.begin();itr != mp.end(); itr ++)
#define all(x) x.begin(), x.end()
#define MOD 1000000007//1e9+7
using namespace std;
typedef long long ll;
typedef vector<int >    vecint;
typedef vector<string > vecstr;
int main()
{
  int n;
  cin >> n;
  cout << "ABC"<<n << endl;
}


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

long long segTree[300000] = {};
long long lazy[300000] = {};
int segSize = 1;

int n, q;

void init(){
  while(segSize < n) segSize *= 2;
  return;
}

void eval(int k, int l, int r){

  if(lazy[k] != 0){
    segTree[k] += lazy[k];

    if(r-l > 1){
      lazy[2*k+1] += lazy[k] / 2;
      lazy[2*k+2] += lazy[k] / 2;
    }

    lazy[k] = 0;
  }

  return;
}

void add(int a, int b, long long x, int k = 0, int l = 0, int r = -1){

  if(r == -1) r = segSize;

  eval(k,l,r);

  if(r <= a || b <= l) return;

  if(a <= l && r <= b){
    lazy[k] += (r-l) * x;
    eval(k,l,r);
  }else{
    add(a, b, x, 2*k+1, l, (l+r)/2);
    add(a, b, x, 2*k+2, (l+r)/2, r);
    segTree[k] = segTree[2*k+1] + segTree[2*k+2];
  }
  return;
}


long long getSum(int a, int b, int k = 0, int l = 0, int r = -1){
  if(r == -1) r = segSize;

  eval(k, l, r);

  if(r <= a || b <= l) return 0;
  if(a <= l && r <= b) return segTree[k];
  return getSum(a, b, 2*k+1, l, (l+r)/2) + getSum(a, b, 2*k+2, (l+r)/2, r);
}

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

  init();

  int p, a, b, c;
  for(int i = 0;i < q;i++){
    cin >> p;
    if(p == 0){
      cin >> a >> b >> c;
      a--; b--;
      add(a, b+1, c);
    }else{
      cin >> a;
      a--;
      cout << getSum(a, a+1) << endl;
    }
  }

  return 0;
}



Measured memory_bytes: 6308
#include <iostream>
#include <iomanip>
#include <ios> 
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <bitset>
#include <map>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define sz(c) ((int)(c).size())

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
const int MAX=1e5+5;

int main(){
	int N,T;
	cin>>N>>T;
	int A[MAX];
	rep(i,N)cin>>A[i];
	
	int nm=A[0];
	int dm=0;
	int p=0;
	rep1(i,N){
		nm=min(nm,A[i]);
		if(dm==A[i]-nm){
			p++;
		}
		else if(dm<A[i]-nm){
			dm=A[i]-nm;
			p=1;
		}
	}
	cout<<p<<endl;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rep1(i,x,n) for(int (i)=(x);(i)<(int)(n);(i)++)
#define rrep(i,x) for(int i=((int)(x)-1);i>=0;i--)
using namespace std;
using ll = long long;
using Int = long long;

const int MOD = 1000000007;
const ll INF = numeric_limits<ll>::max();
const int inf = 1e8;
typedef pair<int,int> P;

//少数点表示
//cout << std::fixed << std::setprecision(14) <<double値

int main(){
    cin.tie( 0 ); ios::sync_with_stdio( false );
    int n;
    cin >> n;
    vector<P> a(n);
    rep(i,n){
        cin >> a[i].first;
        a[i].second = i+1;
    }
    sort(a.begin(),a.end());

    rep(i,n){
        cout << a[i].second << " ";
    }
    return 0;



}

Measured memory_bytes: 1664
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using System.Numerics;

class Program
{
    const int MOD = 1000000007;
    static void Main(string[] args)
    {
        new Program().Solve();
    }

    void Solve()
    {
        Scanner cin = new Scanner();
        string s = cin.Next();

        bool isDifficult = false;
        char prev = 'a';
        foreach(var c in s)
        {
            if (prev == c)
            {
                isDifficult = true;
            }
            prev = c;
        }

        var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
        Console.SetOut(sw);

        if (isDifficult)
        {
            Console.WriteLine("Bad");
        }
        else
        {
            Console.WriteLine("Good");

        }

        Console.Out.Flush();
        
    }
}


class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string Next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return Next();
        i = 0;
        return s[i++];
    }

    public int NextInt()
    {
        return int.Parse(Next());
    }

    public char[] ArrayChar()
    {
        return Next().ToCharArray();
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = NextInt() + add;
        }
        return Array;
    }

    public long NextLong()
    {
        return long.Parse(Next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = NextLong() + add;
        }
        return Array;
    }

    public double NextDouble()
    {
        return double.Parse(Next());
    }


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = NextDouble() + add;
        }
        return Array;
    }
}

Measured memory_bytes: 11092
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
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; }
const ll INF = 1LL << 60;
const int max_v = 100100;
const int max_n = 110;
ll dp[max_n][max_v];


int main() {
    ll N , W; cin >> N >> W;
    ll w[max_n],v[max_n];
    for(int i=0;i<N;i++){
        cin >> w[i] >> v[i];
    }
    
    for(int i=0;i<max_n;i++){
        for(int j=0;j<max_v;j++){
            dp[i][j] = INF;
        }
    }
    
    dp[0][0] = 0;


    for(int i=0;i<N;i++){
        for(int sum_v=0;sum_v<max_v;sum_v++){
            if(sum_v>=v[i]){
            chmin(dp[i+1][sum_v],dp[i][sum_v-v[i]]+w[i]);
            }
            chmin(dp[i+1][sum_v],dp[i][sum_v]);
        }
    }
    ll ans;
    for(int i=0;i<max_v;i++){
        if(W>=dp[N][i]){
            ans = i;
        }
    }
    cout << ans << endl;
}

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

#define FOR(a,b,c) for (int a=(b);a<(c);++a)
#define REP(i,n) FOR(i,0,n)
#define ll long long
#define pii pair<int,int>
#define x first
#define y second
#define pb push_back
#define lf double

using namespace std;

const int MAX = (int)1e6 + 5;

int f(int x){
	if (x%3==0) return 0;
	if (x%5==0) return 0;
	return x;
}

int main(){
	int n;
	scanf ("%d",&n);
	ll sol=0;
	REP(i,n+1) sol+=f(i);
	printf ("%lld\n",sol);
	
	return 0;
}


Measured memory_bytes: 3828
package main

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

const INFINITY = math.MaxInt64/2 - 1

func exec(stdin *Stdin, stdout *Stdout) {
	n := stdin.ReadInt()
	a := stdin.ReadIntSlice(n - 1)

	c := NewCounter()
	for _, k := range a {
		c.Increment(k)
	}

	for k := 1; k <= n; k++ {
		stdout.Println(c.Get(k))
	}

}

type Counter map[interface{}]int

func NewCounter() *Counter {
	return &Counter{}
}

func (c *Counter) put(key interface{}, v int) {
	d := map[interface{}]int(*c)
	d[key] = v
}

func (c *Counter) Increment(key interface{}) {
	c.put(key, c.Get(key)+1)
}

func (c *Counter) Decrement(key interface{}) {
	v := c.Get(key)
	if v > 0 {
		c.put(key, v-1)
	}
}

func (c *Counter) Get(key interface{}) int {
	d := map[interface{}]int(*c)
	if v, ok := d[key]; ok {
		return v
	} else {
		return 0
	}
}

func (c *Counter) Keys() []interface{} {
	d := map[interface{}]int(*c)
	keys := []interface{}{}
	for key := range d {
		if c.Get(key) > 0 {
			keys = append(keys, key)
		}
	}
	return keys
}

func (c *Counter) String() string {
	strs := []string{}
	for _, key := range c.Keys() {
		strs = append(strs, fmt.Sprintf("%v => %d", key, c.Get(key)))
	}
	return "[" + strings.Join(strs, ", ") + "]"
}

func main() {
	stdout := NewStdout()
	defer stdout.Flush()
	exec(NewStdin(bufio.ScanWords), stdout)
}

type Stdin struct {
	stdin *bufio.Scanner
}

func NewStdin(split bufio.SplitFunc) *Stdin {
	s := Stdin{bufio.NewScanner(os.Stdin)}
	s.stdin.Split(split)
	s.stdin.Buffer(make([]byte, bufio.MaxScanTokenSize), INFINITY)
	return &s
}

func (s *Stdin) Read() string {
	s.stdin.Scan()
	return s.stdin.Text()
}

func (s *Stdin) ReadInt() int {
	n, _ := strconv.Atoi(s.Read())
	return n
}

func (s *Stdin) ReadFloat64() float64 {
	n, _ := strconv.ParseFloat(s.Read(), 64)
	return n
}

func (s *Stdin) ReadIntSlice(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = s.ReadInt()
	}
	return a
}

func (s *Stdin) ReadStringSlice(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = s.Read()
	}
	return a
}

func (s *Stdin) ReadFloat64Slice(n int) []float64 {
	a := make([]float64, n)
	for i := 0; i < n; i++ {
		a[i] = s.ReadFloat64()
	}
	return a
}

type Stdout struct {
	stdout *bufio.Writer
}

func NewStdout() *Stdout {
	return &Stdout{bufio.NewWriter(os.Stdout)}
}

func (s *Stdout) Flush() {
	s.stdout.Flush()
}

func (s *Stdout) Println(a ...interface{}) {
	fmt.Fprintln(s.stdout, a...)
}

func Min(a int, b ...int) int {
	for _, v := range b {
		if v < a {
			a = v
		}
	}
	return a
}

func Max(a int, b ...int) int {
	for _, v := range b {
		if a < v {
			a = v
		}
	}
	return a
}

func Abs(x int) int {
	if x > 0 {
		return x
	} else {
		return x * -1
	}
}

func Pow(x, y int) int {
	z := 1
	for y > 0 {
		if y%2 == 0 {
			x *= x
			y /= 2
		} else {
			z *= x
			y -= 1
		}
	}
	return z
}

func CreateMatrix(x, y int) [][]int {
	matrix := make([][]int, x)
	for i := 0; i < x; i++ {
		matrix[i] = make([]int, y)
	}
	return matrix
}


Measured memory_bytes: 20112
/*
	watch me go
*/
#pragma GCC optimize("O3")
//#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define d long double
#define x first
#define y second
#define pii pair<int,int>
#define pb push_back
#define inf (int)1e18
#define init(x,a) memset(x,a,sizeof(x))
#define all(c) c.begin(),c.end()
int const mod=998244353;
int const mod1=1000000007;
int toint(const string &s) {stringstream ss; ss << s; int x; ss >> x; return x;}
string tostring ( int number ) {stringstream ss; ss << number; return ss.str();}
#define out(x) cout<<#x<<" = "<<" "<<x<<"\n";
#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 haha ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
// ******** Using PBDS ********
// typedef tree<long long, null_type, less<long long>, rb_tree_tag, 
//              tree_order_statistics_node_update> 
//                 os; 
// ******** Using PBDS ********
int modexp(int x, int n){
	if(n==0){
		return 1;
	}
	else if(n&1){
		return (modexp((x*x)%mod, n/2)%mod * x%mod)%mod;
	}
	else{
		return (modexp((x*x)%mod, n/2)%mod);
	}
}
 
int modinv(int n)
{
	return modexp(n,mod-2);
}


signed main()
{
    haha
   int k,n;
   cin>>k>>n;
   int arr[n];
   for(int i=0;i<n;i++)
   {
       cin>>arr[i];
       
   }
   int ma=0;
   for(int i=1;i<n;i++)
   ma=max(ma,arr[i]-arr[i-1]);
   ma=max(ma,k+arr[0]-arr[n-1]);
   
   cout<<k-ma;
    
    
    
    
    
    
   
  
}










 
 

Measured memory_bytes: 1792
#include <stdio.h>
    
using namespace std;
    
int main(){
    int a,b;
    double a_d,b_d;
    scanf("%d %d",&a,&b);
    a_d = static_cast<double>(a);
    b_d = static_cast<double>(b);
    printf("%d %d %.5f\n",a/b,a%b,a_d/b_d);
}


Measured memory_bytes: 2744
def unite(l1, l2):
  len1 = len(l1)
  len2 = len(l2)
  if len1 < len2:
    ret = l2[:]
    for i in range(len1):
      ret[i] += l1[i]
    return ret
  else:
    ret = l1[:]
    for i in range(len2):
      ret[i] += l2[i]
    return ret

while True:
  n, m, t, p = map(int, input().split())
  if n == 0:
    break
  mp = [[1] * n for _ in range(m)]
  for _ in range(t):
    d, c = map(int, input().split())
    if d == 1:
      new_mp = []
      for h in range(m):
        left = mp[h][:c][::-1]
        right = mp[h][c:]
        new_mp.append(unite(left, right))
      n = len(new_mp[0])
    else:
      lenu = max(c, m - c)
      new_mp = [[] for _ in range(lenu)]
      for x in range(n):
        under = [mp[y][x] for y in range(c)][::-1]
        top = [mp[y][x] for y in range(c, m)]
        u = unite(top, under)
        for i in range(lenu):
          new_mp[i].append(u[i])
      m = len(new_mp)
    mp = new_mp
  
  for _ in range(p):
    x, y = map(int, input().split())
    print(mp[y][x])


Measured memory_bytes: 5624
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> vvl;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvec;
typedef vector<vector<bool>> vveb;
typedef vector<vector<string>> vves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pb push_back
#define pp pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
typedef long long int64;
//const int64 INF = 1LL << 58;
#define dame { puts("-1"); return 0;}
#define YES { cout << "YES" << endl; return 0; }
#define NO { cout << "NO" << endl; return 0; }
#define Yes { cout << "Yes" << endl; return 0; }
#define No { cout << "No" << endl; return 0; }
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
int dx[] = {0, 0, -1, 1};
int dy[] = {1, -1, 0, 0};


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

    ll a,b;
    cin >> a >> b;
    cout << (b-a)*(b-a+1)/2 - b << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>

using namespace std;

char print(vector<int> &v) {
    cout << "?";
    for (auto x:v) cout << " " << x;
    cout << endl;

    string s;
    cin >> s;
    return s[0];
}

char reverse(char color) {
    return color == 'R' ? 'B' : 'R';
}

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

    vector<int> first(n);
    for (int i = 1; i <= n; i++)first[i - 1] = i;
    char firstColor = print(first);

    int same = 0;
    int dif = n;
    while (dif - same > 1) {
        int mid = (same + dif) / 2;

        vector<int> v(n);
        for (int i = 1; i <= n; i++)v[i - 1] = mid + i;
        char nowColor = print(v);

        if (nowColor == firstColor)same = mid;
        else dif = mid;
    }
    // same+1の色が確定

    string ret(2 * n, firstColor);
    vector<int> x(n);
    for (int i = 1; i <= n; i++)x[i - 1] = same + i;
    for (int i = 1; i <= 2 * n; i++) {
        if (i - same == 1)continue;
        if (0 < i - same && i - same <= n) {
            x[i - same - 1] = dif + n;
            ret[i - 1] = reverse(print(x));
            x[i - same - 1] = i;
        } else {
            x[0] = i;
            ret[i - 1] = print(x);
            x[0] = same + 1;
        }
    }

    cout << "! " << ret << endl;
    return 0;
}

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

#define MAX(x,y) (x>y?x:y)
#define MIN(x,y) (x<y?x:y)
#define ABS(x) (x>0?x:-(x))

#define INF 1000000000

int array_min_max(int* p, int n,bool f)  //f: true→min false→max
{
	int tmp;

	if (f)
		tmp = INF;
	else
		tmp = 0;

	for (int i = 0; i < n; i++)
	{
		if (f)
		{
			if (p[i] < tmp)
				tmp = p[i];
		}
		else
		{
			if (p[i] > tmp)
				tmp = p[i];
		}
	}
	return tmp;
}

void swap(long long int *a, long long int *b)
{
	long long int tmp;
	tmp = *a;
	*a = *b;
	*b = tmp;
}

//void bubble_sort(int *p, int n)
//{
//	for (int i = 0; i < n; i++)
//	{
//		for (int j = 0; j < n - i - 1; j++)
//		{
//			if (p[j] > p[j + 1])
//				swap(&p[j], &p[j + 1]);
//		}
//	}
//}

int main()
{
	long long int A, B;

	scanf("%lld%lld", &A, &B);

	if (A < B)
		swap(&A, &B);

	long long int x = A * B;
	int r = A % B;

	while (r != 0)
	{
		A = B;
		B = r;
		r = A % B;
	}
	printf("%lld\n", x / B);
}

Measured memory_bytes: 128
using System;
using System.Collections.Generic;
using System.Linq;
using System.Diagnostics;

class Program
{
    static void Main(string[] args)
    {
        const long MOD = 1000000007;
        var sc = new Scanner();
        int a = sc.nextInt(); ;
        string s = sc.next();

        if (a >= 3200) Console.WriteLine(s);
        else Console.WriteLine("red");
    }
}

// chokudai's Scanner
class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }

    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }

    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}

Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> T;

int N;
vector<int> a(10001, 0);
 
int main(void){
    
    cin >> N;
    for(int i = 0; i < N; ++i) scanf("%d", &a[i]);
    
    int ans = 0;
    for(int i = 0; i < N; ++i){
        while(a[i] % 2 == 0){
            a[i] /= 2;
            ++ans;
        }
    }
    printf("%d", ans);
    
    return 0;
}

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

using namespace std;

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

}

int main() {

	int n;cin >> n;
	string s;cin >> s;

	int r{0},g{0},b{0};
	int a[n];
	for(int i = 0;i < n; ++i) {
		if(s[i]=='R') {
			++r;
			a[i] = 1;
		}
		else if(s[i] == 'G') {
			++g;
			a[i] = 2;
		} else {
			++b;
			a[i] = 4;
		}
	}

	long long total = (long long)r * g * b;

	for(int i = 0;i < n-1; ++i) {

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

			if(j + j - i < n) {

				if(a[i] + a[j] + a[2*j - i] == 7) --total;
			}
		}
	}
	cout << total;
}


Measured memory_bytes: 3632
#include <stdio.h>
#include <iostream>
#include <iomanip>
#include <math.h>
#include <string>
using namespace std;

int main () { 
// Baca bilangan
    /*double x; cin >> x;
    int fl = floor(x); // Masih Double
    int cl = ceil(x); // Masih Double
   
    cout << fl << " " << cl << "\n";*/
   
    // Looping FOR
   
   
    /*int n; cin >> n;
   
    for(int j = 1; j <= n; j++){
        // -------------------------
        // Print 1 baris N buah bintang
        for(int i = 1; i <= n; i++){
            cout << "*";
        }
        cout << "\n";
        // -------------------------
    }*/
//  int n,sum = 0, j;
//  cin >> n;
//  for(int k = 1; k <= n; k++ ){
//      cin >> j;
//  sum = sum + j
 
    //int x;
    //cin >> x;
    //for(int n = x ; n >= 1; n--){
    //if (x % n == 0){
    //cout << n << "\n";
    //}
//  }
 
////    int x,y,a;
////    cin >> a;
////    for(int i=0; i < a; i++){
//  //  cin >> x >> y;
////    if(x > y)
//  //  cout << ">"<< "\n";
////    if(x < y)
//  //  cout << "<" << "\n";
//  //if(x == y)
//  //  cout << "=" << "\n";
//}
////
//string x,y,a;
//x = "Hajj";
//y = "Umrah";
//int NoKasus = 1;
//while(cin >> a){
//  if (a==x)
//      cout << "Case" << " " << NoKasus << ":" << " " << "Hajj-e-Akbar"<< "\n";
//  if (a==y)
//      cout << "Case" << " " << NoKasus << ":" << " " << "Hajj-e-Asghar"<< "\n";
//  if(a== "*")
//      break;
//      NoKasus++;
//}
//string s;
//int NoKasus = 1;
//while(cin>>s){
//  if(s=="HELLO")
//      cout << "Case "<< NoKasus << ": " << "ENGLISH" << "\n";
//  else if(s=="HOLA")
//      cout << "Case "<< NoKasus << ": " << "SPANISH" << "\n";
//  else if(s=="HALLO")
//      cout << "Case "<< NoKasus << ": " << "GERMAN" << "\n";
//  else if(s=="BONJOUR")
//      cout << "Case "<< NoKasus << ": " << "FRENCH" << "\n";
//  else if(s=="CIAO")
//      cout << "Case "<< NoKasus << ": " << "ITALIAN" << "\n";
//  else if(s== "ZDRAVSTVUJTE")
//      cout << "Case "<< NoKasus << ": " << "RUSSIAN" << "\n";
//  else if(s== "#")
//      break;
//  else
//      cout << "Case "<< NoKasus << ": " << "UNKNOWN" << "\n";
//  NoKasus++;
//}

//	int n,k; cin>> n >>k;
//	for(int i = 1; i <= n; i++){
//	if (i % k == 0){
//	}
//	cout << "i\n";
//	cout << "*";
//	cout << "\n";
//	}

//int x;
//cin >> x;
//if (x == 2)
//	cout << "NO" << "\n";
//else if (x % 2 == 0)
//	cout << "YES" << "\n";
//else if (x % 2 == 1)
//	cout << "NO" << "\n";
	
//int a,b,c; cin >> a >> b >> c;
//for (int i = 1; i<=a; i++)
//if ()x

//string s;
//getline(cin, s);
//cout << s << endl;
	
int x,y,z;
cin >> x >> y;
z = x + (y/2);
cout << z << endl;
}





Measured memory_bytes: 256
#include <bits/stdc++.h>
#define dum(x) cout<<#x<<'='<<x<<endl
using namespace std;

int main() {
  int n, m; cin >> n >> m;
  int tmp = m;
  int ans = m;
  for (int i = 0; i < n; i++) {
    int in, out; cin >> in >> out;
    tmp = tmp + in - out;
    ans = max(ans, tmp);
    if (tmp < 0) {
      ans = 0;
      break;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 3096
#include<iostream>
#include<algorithm>

using namespace std;
typedef long long ll;

int main() {
	while (1) {
		int n, m;
		cin >> n >> m;
		if (n == 0 && m == 0)break;
		int a[100], b[100];
		int asum = 0, bsum = 0;
		int absum = 99999999;
		for (int i = 0; i < n; i++)cin >> a[i], asum += a[i];
		for (int i = 0; i < m; i++)cin >> b[i], bsum += b[i];

		int ans1 = -1, ans2 = -1;

		for (int i = 0; i < n; i++) {
			for (int j = 0; j < m; j++) {
				if (asum - a[i] + b[j] == bsum - b[j] + a[i] && absum > a[i] + b[j]) {
					absum = a[i] + b[j];
					ans1 = a[i], ans2 = b[j];
				}
			}
		}

		if (ans1 == -1) {
			cout << -1 << endl;
		}
		else {
			cout << ans1 << " " << ans2 << endl;
		}
	}
	return 0;
}


Measured memory_bytes: 2988
#include<stdio.h>

int main(){
    int n,k,i,count=0;

    scanf("%d %d",&n,&k);

    for(i=1;i<=n;i++){
        if(i%2==1){
            count++;
        }
    }
    if(count>=k){
        printf("YES");
    }else{printf("NO");}
    return 0;
}

Measured memory_bytes: 128
n=int(input())
x=list(map(int,input().split()))
snuke=sum(x)-x[n-1]
arai=x[n-1]
ans=abs(snuke-arai)
for i in range(n-2,0,-1):
    snuke-=x[i]
    arai+=x[i]
    if ans>abs(snuke-arai):
        ans=abs(snuke-arai)
    #print(snuke,arai)
print(ans)

Measured memory_bytes: 24812
#include <iostream>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  int X;
  cin >> X;
  int ret = 0;
  ret += (X / 500) * 1000;
  X = X % 500;
  ret += (X / 5) * 5;
  cout << ret << endl;
}

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

int main()
{
	int a, b;

	scanf("%d%d", &a, &b);
	if (a < b) printf("a < b\n");
	else if (a > b) printf("a > b\n");
	else printf("a == b\n");
	return 0;
}



Measured memory_bytes: 2068
def main():
	a,b,k = map(int, input().split())
	if k <= a:
		a = a-k
	else:
		if k-a <= b:
			b = b - (k-a)
			a=0
		else:
			a = 0
			b = 0
	print(a,b)

if __name__ == '__main__':
	main()

Measured memory_bytes: 2940