akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
    using namespace std;
    #define mod 1000000007
    #define all(n)      (n).begin(), (n).end()
    #define ll long long
    #define ull unsigned long long int
    void solve() {
        int n,x,t; cin >> n >> x >> t;
        int a = 0;
        if(n%x == 0){
            int k = n/x;
            a += (k*t);
        }else{
            int k = n/x;
            a += (k*t);
            a+=t;
        }
        cout << a << endl;
    }
    int main(){
        ios::sync_with_stdio(0);
        cin.tie(0);
        //Starts here , 
                    
        // int T; cin >> T;
        // while(T--){
            solve();
        // }
        return 0;
                
    }

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define inf 10e17
#define rep(i,n) for(long long i=0; i<n; i++)
#define repr(i,n,m) for(long long i=m; i<n; i++)
#define mod 1000000007
#define sorti(x) sort(x.begin(), x.end())
#define sortd(x) sort(x.begin(), x.end(), std::greater<long long>())
#define debug(x) std::cerr << (x) << std::endl;
#define roll(x) for (auto&& itr : x) { cerr << (itr) << " "; }

template <class T> inline void chmax(T &ans, T t) { if (t > ans) ans = t;}
template <class T> inline void chmin(T &ans, T t) { if (t < ans) ans = t;}

/* lcmを素因数分解したmapで持ちたい */

// 素因数分解
/*
 * [2]-> 5, [3] -> 5のとき N = 2^5 * 3^5
 */
template<typename T>
map<T, long long> factorize(T x) {
  map<T, long long> res;
  for (long long i = 2; i * i <= x; ++i) {
    while (x % i == 0) {
      x /= i;
      res[i] += 1;
    }
  }
  if (x != 1) res[x]++;
  return res;
}

long myPow(long x, long n, long m){
  if(n == 0)
    return 1;
  if(n % 2 == 0)
    return myPow(x * x % m, n / 2, m);
  else
    return x * myPow(x, n - 1, m) % m;
}

long long modinv(long long a, long long m) {
  long long b = m, u = 1, v = 0;
  while (b) {
    long long t = a / b;
    a -= t * b; swap(a, b);
    u -= t * v; swap(u, v);
  }
  u %= m;
  if (u < 0) u += m;
  return u;
}

// 二分累乗法
long long modpow(long long a, long long n, long long m) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }

  return res;
}

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

  map<ll, ll> mp;
  for (int i = 0; i < n; ++i) {
    auto p = factorize(a[i]);
    for (auto itr : p) {
      chmax(mp[itr.first], itr.second);
    }
  }

  ll lc = 1;
  for (auto itr : mp) {
    lc *= myPow(itr.first, itr.second, mod);
    lc %= mod;
  }

  ll ans = 0;
  for (int i = 0; i < n; ++i) {
    auto m = modinv(a[i], mod); // mod 10^9 + 7 における逆元
    // a[i]でlcを割る。
    auto t = lc * m; // mod 10^9 + 7におけるlcm(a)/a[i] mod pの結果
    ans += t;
    ans %= mod;
  }

  cout << ans << endl;
}

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

using namespace std ;

#define ll long long 
#define N 200010

int n ;
ll a[ N ] ;

// xor 性质： a xor b <= a + b 
// a xor b == a + b 时当且仅当 a & b = 0 
//所以a_l xor ... xor a_r == a_l xor ... xor a_r 当且仅当a_l到a_r每一位上只有一个1 
//于是这个区间是有单调性的（对于合法的a_l 和 a_r ， a_{l+1} 和 a_{r} 显然也合法） 
//所以用two-pointers搞搞 

int main() {
	scanf( "%d" , &n ) ;
	for( int i = 1 ; i <= n ; i ++ ) {
		scanf( "%lld" , &a[ i ] ) ;
	}
	int l = 1 , r = 1 , now = 0 ;
	ll ans = 0 ;
	while( r <= n ) {
		while( ( now ^ a[ r ] ) == now + a[ r ] && r <= n ) now |= a[ r ++ ] , ans += r - l ;
		now ^= a[ l ++ ] ;
	}
	printf( "%lld\n" , ans ) ;
} 

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

using namespace std;

int main() {
  int k; cin >> k;
  long long sum = 0;
  for (int i = 1; i <= k; i++) for (int j = 1; j <= k; j++) for (int m = 1; m <= k; m++) sum += __gcd(__gcd(i, j), m);
  cout << sum << endl;
  return 0;
}

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

#define ll long long
const int _ = 2e5 + 7; int tor[_][20] , tol[_][20]; ll sumr[_][20] , suml[_][20]; int N , K , Q , X[_];

int main(){
	ios::sync_with_stdio(0); cin >> N >> K; for(int i = 1 ; i <= N ; ++i) cin >> X[i];
	X[0] = -1e9; X[N + 1] = 2e9; for(int j = 0 ; j < 20 ; ++j) tor[N + 1][j] = N + 1;
	for(int pos = N + 1 , i = N ; i ; --i){
		while(X[pos - 1] - X[i] >= K){--pos;} tor[i][0] = pos; sumr[i][0] = pos - 1;
		for(int j = 1 ; j < 20 ; ++j){tor[i][j] = tor[tor[i][j - 1]][j - 1]; sumr[i][j] = sumr[i][j - 1] + sumr[tor[i][j - 1]][j - 1];}
	}
	for(int pos = 0 , i = 1 ; i <= N ; ++i){
		while(X[i] - X[pos + 1] >= K){++pos;} tol[i][0] = pos; suml[i][0] = pos;
		for(int j = 1 ; j < 20 ; ++j){tol[i][j] = tol[tol[i][j - 1]][j - 1]; suml[i][j] = suml[i][j - 1] + suml[tol[i][j - 1]][j - 1];}
	}

	for(cin >> Q ; Q ; --Q){
		int L , R; cin >> L >> R; ll ans = R - L + 1;
		for(int t = R , fl = 19 ; ~fl ; --fl) if(tol[t][fl] >= L){ans += suml[t][fl]; t = tol[t][fl];}
		for(int t = L , fl = 19 ; ~fl ; --fl) if(tor[t][fl] <= R){ans -= sumr[t][fl]; t = tor[t][fl];}
		cout << ans << endl;
	}
	return 0;
}


Measured memory_bytes: 98164
import math
from collections import defaultdict
 
def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()
def factorization(n):
	res = []
	if n%2==0:
		res.append(2)
	for i in range(3,math.floor(n//2)+1,2):
		if n%i==0:
			c = 0
			for j in res:
				if i%j==0:
					c=1
			if c==0:
				res.append(i)
	return res
def fact2(n):
	p = factorization(n)
	res = []
	for i in p:
		c=0
		z=n
		while 1:
			if z%i==0:
				c+=1
				z/=i
			else:
				break
		res.append([i,c])
	return res
def fact(n):#階乗
	ans = 1
	m=n
	for _i in range(n-1):
		ans*=m
		m-=1
	return ans
def comb(n,r):#コンビネーション
	l = min(r,n-r)
	m=n
	u=1
	for _i in range(l):
		u*=m
		m-=1
	return u//fact(l)


S = readChar()

re = [0]*len(S)
res = [0]*len(S)
res[-1]=int(S[-1])

for i in range(2,len(S)+1):
	re = int(S[i*-1])*pow(10,i-1,2019)
	res[i*-1] = (res[i*-1+1]+re)%2019

d = defaultdict(int)
for i in res:
	d[i]+=1

ans = d[0]
for key in d:
	if d[key]>1:
		ans+=comb(d[key],2)

print(ans)

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

int main(){
  string input;
  cin >> input;
  if(input=="A") cout << "T" << endl;
  if(input=="T") cout << "A" << endl;
  if(input=="C") cout << "G" << endl;
  if(input=="G") cout << "C" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvi vector<vector<int> >
#define vvl vector<vector<ll> >
#define vll vector<ll>
#define rep(c, a, b) for(ll c=a;c<b;c++)
#define re(c, b) for(ll c=0;c<b;c++)
typedef long long int ll;
typedef long double ld;
using namespace std;

int main(int argc, char const *argv[]) {
  ll n, m;std::cin >> n >> m;
  vll a(n);
  re(i, n) std::cin >> a[i];
  sort(a.begin(), a.end());
  ll l = 0, r = 10000000000;

  while(r-l>1){
    ll mid = (l+r)/2;
    ll num = 0;
    for(int i=n-1;i>=0;i--){
      ll s = lower_bound(a.begin(), a.end(), mid - a[i]) - a.begin();
      s = n - s;
      num += s;
    }
    if(num>=m) l = mid;
    else r = mid;
  }
  // l ok
  ll num = 0;
  for(int i=n-1;i>=0;i--){
    ll s = lower_bound(a.begin(), a.end(), l - a[i]) - a.begin();
    s = n - s;
    num += s;
  }
  ll amari = num - m;
  vll S(n);
  re(i, n) S[i] = (i==0?0:S[i-1]) + a[i];
  ll ans = 0;
  for(int i=n-1;i>=0;i--){
    ll s = lower_bound(a.begin(), a.end(), l - a[i]) - a.begin();
    ans += (S[n-1]-(s==0?0:S[s-1]))+a[i]*(n-s);
  }
  std::cout << ans - amari*l << '\n';
  return 0;
}


Measured memory_bytes: 1792
#include <cstdio>           // printf(), scanf()
#include <cstring>          // memset()
#include <vector>
#include <algorithm>        // min()

using namespace std;
static const int MAX_X = 100;
static const int MAX_Y = 100;
static const int MAX_V = MAX_X + MAX_Y + 2;
static const int INF = 100000000;

typedef struct edge_tbl
{
	int to, cap;
	unsigned long rev;
} edge;

vector<edge> G[MAX_V];
bool used[MAX_V];

int
dfs(int v, int t, int f)
{
	if (v == t)
		return f;

	used[v] = true;
	for (unsigned int i = 0; i < G[v].size(); ++i)
	{
		edge &e = G[v][i];
		if (!used[e.to] && e.cap > 0)
		{
			int d = dfs(e.to, t, min(f, e.cap));
			if (d > 0)
			{
				e.cap -= d;
				G[e.to][e.rev].cap += d;
				return d;
			}
		}
	}

	return 0;
}

int
max_flow(int s, int t)
{
	int flow = 0;
	while (true)
	{
		memset(used, 0, sizeof(used));
		int f = dfs(s, t, INF);
		if (f == 0)
			return flow;

		flow += f;
	}
}

int
main(int argc, char** argv)
{
	int X, Y, E;
	int x, y;

	scanf("%d %d %d", &X, &Y, &E);
	int s = X + Y, t = s + 1;
	for (int i = 0; i < X; ++i)
	{
		G[s].push_back((edge){i, 1, G[i].size()});
		G[i].push_back((edge){s, 0, G[s].size() - 1});
	}

	for (int i = 0; i < Y; ++i)
	{
		G[X + i].push_back((edge){t, 1, G[t].size()});
		G[t].push_back((edge){X + i, 0, G[X + i].size() - 1});
	}

	for (int i = 0; i < E; ++i)
	{
		scanf("%d %d", &x, &y);
		G[x].push_back((edge){X + y, 1, G[X + y].size()});
		G[X + y].push_back((edge){x, 0, G[x].size() - 1});
	}

	printf("%d\n", max_flow(s, t));
	return 0;
}

Measured memory_bytes: 2940
#include <stdio.h>


 int main(){int m,n,f;
 	while(1){
 	scanf("%d %d %d",&m,&n,&f);
 	if(m==-1&&n==-1&&f==-1)break;
 	else{
 		if(m==-1||n==-1){printf("F\n");}
 		else{
 		if((m+n)>=80){printf("A\n");}
 		if(m+n>=65&&m+n<80){printf("B\n");}
 		if(m+n>=50&&m+n<65){printf("C\n");}
 		if(m+n>=30&&m+n<50){
 			if(f>=50)printf("C\n");
 			else printf("D\n");
 		}if(m+n<30) {printf("F\n");}
 		
 		};
 	
 	
 	};};
 	
 	
 return 0;}
 


Measured memory_bytes: 2116
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
using ll=long long;
using vec=vector<ll>;
using Graph = vector<vector<ll>>;
#define loop(i,n) for(ll i=0;i<n;i++)
#define Loop(i, m, n) for(ll i = m;i < n;i++)
#define pool(i,n) for(ll i=n;i>=0;i--)
#define Pool(i, m, n) for(ll i=n;i>=m;i--)
#define MAX 99999999999ll
#define MIN -99999999999ll
#define setbit bitset<8>
#define flagcount __builtin_popcount
#define flag(x) (1<<x)
#define flagadd(bit,x) bit|=flag(x)
#define flagpop(bit,x) bit&=~flag(x) 
#define flagon(bit,i) bit&flag(i)
#define flagoff(bit,i) !(bit & (1<<i))
#define all(v) v.begin(),v.end()
#define low2way(v,x) lower_bound(all(v),x)
#define high2way(v,x) upper_bound(all(v),x)
#define count2way(v,x) high2way(v,x)-low2way(v,x)
#define lower(v,x) low2way(v,x)-v.begin() //1番左が0、もし見つから無いならｎを出力
#define higher(v,x) high2way(v,x)-v.begin()-1 //1番左が0、もし見つからないならn-1を出力（注意）
#define putout(a) cout<<a<<endl
#define putout2(a,b) putout(a);putout(b)
#define putout3(a,b,c) putout(a);putout(b);putout(c)
#define putout4(a,b,c,d) putout(a);putout(b);putout(c);putout(d)
#define putout5(a,b,c,d,e) putout(a);putout(b);putout(c);putout(d);putout(e)
#define Gput(a,b) G[a].push_back(b)
#define cin1(a) cin>>a
#define cin2(a,b) cin>>a>>b
#define cin3(a,b,c) cin>>a>>b>>c
#define cin4(a,b,c,d) cin>>a>>b>>c>>d
#define cin5(a,b,c,d,e) cin>>a>>b>>c>>d>>e
#define sum(v) accumulate(all(v), 0ll)
#define gcd(x,y) __gcd(x,y)
ll ctoi(char c){
	if(c>='0'&&c<='9'){
		return c-'0';
	}
	return 0;
}
ll lcm(ll x,ll y){
  ll z=gcd(x,y);
  return x*y/z;
}
int main() {
  cout << fixed << setprecision(30);
  string s;
  cin>>s;
  ll n=s.size();
  map<char,ll> count;
  loop(i,n){
    count[s[i]]++;
  }
  if(n<26){
    char d;
  loop(i,'z'-'a'+1){
    if(count[(char)('a'+i)]==0){
      d=(char)('a'+i);
      break;
    }
   }
    putout(s+d);
  }
  else{
    ll reverse=-1;
    Pool(i,1,n-1){
      if(s[i]>s[i-1]){
        reverse=i-1;
        break;
      }
    }
    if(reverse==-1)putout(-1);
    else{
      char rev=s[reverse];
      char mini;
      Loop(i,reverse,n){
        if(s[i]>rev)mini=s[i];
      }
    string ans;
    loop(i,reverse){
      ans+=s[i];
    }
    ans+=mini;
    putout(ans);
    }
  }
  
}

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

string s;
int f=0;

int main(){
	cin>>s;
	for(int i=0;i<s.length()-1;i++){
		for(int j=1;j<s.length();j++){
			if(i!=j&&s[i]==s[j]) f++;
		}
	}
	if(f!=0) cout<<"no"<<endl;
	else cout<<"yes"<<endl;

	return 0;
}

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

int main(){
    int n; cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];

    for (int i =  0; i < n; i++) {
        if (a[i]%2==0) {
            if (a[i]%3!=0&&a[i]%5!=0) {
                cout << "DENIED" << endl;
                return 0;
            }
        }
    }

    cout << "APPROVED" << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,k,a[200001];
int main()
{
	scanf("%d%d",&n,&k);
	for(int i=1;i<=n;i++)scanf("%d",&a[i]);
	for(int i=k+1;i<=n;i++)puts(a[i]>a[i-k]?"Yes":"No");
	return 0;
}

Measured memory_bytes: 4436
import static java.lang.Math.*;
import static java.util.Arrays.*;

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        new Main().run();
    }
    void tr(Object... os) {
        System.err.println(deepToString(os));
    }

    Scanner sc = new Scanner(System.in);
    public void run() {
        while (sc.hasNext()) {
            String[] ss = sc.nextLine().split(",");
            P a = new P(Double.parseDouble(ss[0]), Double.parseDouble(ss[1]));
            P b = new P(Double.parseDouble(ss[2]), Double.parseDouble(ss[3]));
            P p = new P(Double.parseDouble(ss[4]), Double.parseDouble(ss[5]));
            P p2 = symLP(a,b,p);
            System.out.printf("%.8f %.8f\n", p2.x, p2.y);
        }
    }

    static class P implements Comparable<P> {
        double x, y;
        public P(double x, double y) {
            this.x = x;
            this.y = y;
        }
        public int compareTo(P o) {
            return x != o.x ? Double.compare(x, o.x) : Double.compare(y, o.y);
        }
        public String toString() {
            return "(" + x + "," + y + ")";
        }
        public double abs() {return sqrt(x * x + y * y); }
        public double abs2() {return (x * x + y * y); }
        public double arg() { return atan2(y, x); } // (-pi 〜 pi)
        public double dist(P o) {return this.sub(o).abs(); }
        public P mul(double k) {return new P(x * k, y * k);}
        public P div(double k) {return new P(x / k, y / k);}
        public P add(P o) {return new P(x + o.x, y + o.y);}
        public P sub(P o) {return new P(x - o.x, y - o.y);}
        public P mul(P o) {return new P(x * o.x - y * o.y,  x * o.y + y * o.x); }
        public P div(P o) {return new P(x * o.x + y * o.y, -x * o.y + y * o.x).div(o.abs2()); }
        public double dot(P o) {return x * o.x + y * o.y;} // a b sin(t)
        public double det(P o) {return x * o.y - y * o.x;} // a b cos(t)
        public P normal() { return this.div(this.abs()); }
        public P rot90() { return new P(-y, x); }
        public static P polar(double d, double rad) {return new P(d * Math.cos(rad), d * Math.sin(rad));}
    }
	P proj(P p, P b) {
		return b.mul(p.dot(b)).div(b.abs2());
	}
	P symLP(P a, P b, P p) {
		P of =proj(p.sub(a), b.sub(a));
		return new P(2 * a.x + 2 * of.x - p.x, 2 * a.y + 2 * of.y - p.y);
	}

}

Measured memory_bytes: 17180
#include <bits/stdc++.h>
using namespace std;
#define show(x) cout << #x << " : " << x << endl

int main ()
{
    int n, k, q, i, in;
    cin >> n >> k >> q;
    int mn[n+1];
    for(i = 1; i <= n; i++) mn[i] = q;
    for(i = 1; i <= q; i++)
    {
        cin >> in;
        mn[in]--;
    }
    for(i = 1; i <= n; i++)
    {
        if((k - mn[i]) > 0) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
}


Measured memory_bytes: 1024
//我是菜鸡
#include<bits/stdc++.h>
#define _for(i,a,b) for(int i = (a);i<(b);++i)
#define _defor(i,a,b) for((i) = (a);(i)<(b);++i)
#define _rfor(i,a,b) for(int i = (a);i>(b);--i)
#define _sfor(p,st) for(auto p:st)
#define debug(q,x) cout<<q<<x<<endl
using namespace std;
typedef long long ll;
const int INF = 0x3f3f3f3f;
const int maxn = 1e3+5;
const int MOD = 1e9 + 7;
const double ext = 1e-6;
void deprint() {
	//ofstream cout("E:\\acm dream\\debug.txt");
	return;
}
int main() {
	//ifstream cin("E:\\acm dream\\in.txt");
	//ofstream cout("E:\\acm dream\\out.txt");
	//srand((unsigned)time(nullptr));
	ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	string s, t, u;
	int a, b;
	while (cin >> s >> t >> a >> b >> u) {
		map<string, int>p;
		p[s] = a, p[t] = b;
		p[u]--;
		cout << p[s] << " " << p[t] << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

int main() {
  char c;
  std::cin >> c;

  switch (c) {
    case 'S':
      std::cout << "Cloudy";
      break;
    case 'C':
      std::cout << "Rainy";
      break;
    case 'R':
      std::cout << "Sunny";
      break;
  }

  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(){
	int n;
	int a = 0;
	int b = 0;
	int c = 0;
	int d = 0;
	scanf("%d", &n);
	char ch[100];
	for(int i = 0; i < n; i++){
		scanf("%s", ch);
		if(ch[0] == 'A' && ch[1] == 'C'){
			a++;
		}
		if(ch[0] == 'W' && ch[1] == 'A'){
			b++;
		}
		if(ch[0] == 'T' && ch[1] == 'L' && ch[2] == 'E'){
			c++;
		}
		if(ch[0] == 'R' && ch[1] == 'E'){
			d++;
		}
	}
	printf("AC x %d\n", a);
	printf("WA x %d\n", b);
	printf("TLE x %d\n", c);
	printf("RE x %d\n", d);
	return 0;
}

Measured memory_bytes: 1736
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <string.h>
#include <vector>
using namespace std;

#define ll long long
#define INF (1 << 30)
#define INFLL (1LL << 60)

#define FOR(i,a,b) for(ll i = (a);i<(b);i++)
#define REP(i,a) FOR(i,0,(a))
#define MP make_pair

int n, maxW, w[101], v[101];

int sortW[4][101];
int sum3[101] = {};
int how[4] = {};

int memo[101][101][101][4];

int saiki(int use0, int use1, int use2, int nowIndex){
	if(use0 > how[0] || use1 > how[1] || use2 > how[2]) return -INF;
	if(use0 * w[0] + use1 * (w[0] + 1) + use2 * (w[0] + 2) > maxW) return -INF;

	if(memo[use0][use1][use2][nowIndex] != -1) return memo[use0][use1][use2][nowIndex];

	if(nowIndex == 3){
		int lastUse = (maxW -(use0 * w[0] + use1 * (w[0] + 1) + use2 * (w[0] + 2))) / (w[0] + 3);
		if(lastUse == 0) return 0;
		return -sum3[lastUse - 1];
	}

	ll a = 0, b = 0, c = 0, d = 0, e = 0;

	if(use0 < how[0] && nowIndex == 0) a = saiki(use0 + 1, use1, use2, nowIndex) + -sortW[0][use0];
	if(use1 < how[1] && nowIndex == 1) b = saiki(use0, use1 + 1, use2, nowIndex) + -sortW[1][use1];
	if(use2 < how[2] && nowIndex == 2) c = saiki(use0, use1, use2 + 1, nowIndex) + -sortW[2][use2];
	e = saiki(use0, use1, use2, nowIndex + 1);

	return memo[use0][use1][use2][nowIndex] = max(a, max(b, max(c, max(d, e))));
}

int main() {
	for(int i = 0;i < 101;i++){
		for(int j = 0;j < 101;j++){
			for(int k = 0;k < 101;k++){
				for(int l = 0;l < 4;l++){
					memo[i][j][k][l] = -1;
				}
			}
		}
	}

	cin >> n >> maxW;
	for(int i = 0;i < n;i++){
		cin >> w[i] >> v[i];
	}
	for(int i = 0;i < n;i++){
		int now = w[i] - w[0];
		sortW[now][how[now]] = -v[i];
		how[now]++;
	}
	for(int i = 0;i < 4;i++){
		sort(sortW[i], sortW[i] + how[i]);
	}
	sum3[0] = sortW[3][0];
	for(int i = 1;i < 101;i++){
		sum3[i] = sum3[i-1] + sortW[3][i];
	}

	// cout << sortW[0][0] << "," << sortW[0][1];

	cout << saiki(0, 0, 0, 0) << endl;

	return 0;
}

Measured memory_bytes: 16384
import math
N=int(input())
c=0
min=float("inf")
for i in range(1,(N//2)+1):
    s1=list(str(i))
    s2=list(str(N-i))
    #print(s1,s2)
    for j in range(len(s1)):
        c=c+int(s1[j])

    for j in range(len(s2)):
        c=c+int(s2[j])
    if c<min:
        min=c
    c=0
print(min)

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

int main(){
  int a, b, c, x, sum = 0;
  cin >> a >> b >> c >> x;
  for(int i = 0; i <= a; i++){
    for(int j = 0; j <= b; j++){
      for(int k = 0; k <= c; k++){
        int tmp = 500 * i + 100 * j + 50 * k;
        if(tmp == x) sum++;
      }
    }
  }
  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {

	void run() {
		Scanner sc = new Scanner(System.in);

		char[] c = sc.next().toCharArray();
		int n = c.length;
		int size = 0;
		int length = 0;
		int s = 0;
		int t = 0;

		Map<Character, Integer> map = new HashMap<>();
		boolean f = false;
		boolean flag = true;

		// 尺取り法
		while (s <= t) {
			while (t < n) {
				char key = c[t];
				length = t - s + 1;
				size = length / 2;
				if (map.containsKey(key)) {
					int v = map.get(key);
					map.put(key, v + 1);
				} else {
					map.put(key, 1);
				}
				int v = map.get(key);
				if (v > size && size >= 1) {
					f = true;
					break;
				}
				if (length == 3) {
					break;
				}
				t++;
			}
			if (f) {
				break;
			}
			char key = c[s];
			int v = map.get(key);
			map.put(key, v - 1);
			s++;
			length = t - s + 1;
			size = length / 2;
			if (s == n) {
				flag = false;
				break;
			}
			key = c[s];
			v = map.get(key);
			if (v > size) {
				break;
			}
			t++;
		}

		if (flag) {
			if (t == n) {
				System.out.println((s + 1) + " " + t);
			} else {
				System.out.println((s + 1) + " " + (t + 1));
			}
		} else {
			System.out.println(-1 + " " + -1);
		}

	}

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

}


Measured memory_bytes: 13820
def gcd(a,b):
    while b:
        a,b=b,a%b
    return a

def lcm(a,b):
    return a*b//gcd(a,b)
      
N=int(input())
T=[]
total=1
for i in range(N):
    a=int(input())
    T.append(a)
T_set=sorted(list(set(T)))
M=len(T_set)

ans=T_set[0]
if M==1:
    ans=T_set[0]
else:
    for i in range(1,M):
        ans=lcm(ans,T_set[i])

print(ans)

Measured memory_bytes: 9092
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.util.NoSuchElementException;

public class Main {

	static PrintWriter out;
	static InputReader ir;

	static void solve() {
		int n=ir.nextInt();
		char[] s=ir.next().toCharArray();
		int cur=0;
		int ma=0;
		for(int i=0;i<s.length;i++){
			if(s[i]=='I')
				cur++;
			else 
				cur--;
			ma=Math.max(ma, cur);
		}
		out.println(ma);
	}

	public static void main(String[] args) throws Exception {
		ir = new InputReader(System.in);
		out = new PrintWriter(System.out);
		solve();
		out.flush();
	}

	static class InputReader {

		private InputStream in;
		private byte[] buffer = new byte[1024];
		private int curbuf;
		private int lenbuf;

		public InputReader(InputStream in) {
			this.in = in;
			this.curbuf = this.lenbuf = 0;
		}

		public boolean hasNextByte() {
			if (curbuf >= lenbuf) {
				curbuf = 0;
				try {
					lenbuf = in.read(buffer);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (lenbuf <= 0)
					return false;
			}
			return true;
		}

		private int readByte() {
			if (hasNextByte())
				return buffer[curbuf++];
			else
				return -1;
		}

		private boolean isSpaceChar(int c) {
			return !(c >= 33 && c <= 126);
		}

		private void skip() {
			while (hasNextByte() && isSpaceChar(buffer[curbuf]))
				curbuf++;
		}

		public boolean hasNext() {
			skip();
			return hasNextByte();
		}

		public String next() {
			if (!hasNext())
				throw new NoSuchElementException();
			StringBuilder sb = new StringBuilder();
			int b = readByte();
			while (!isSpaceChar(b)) {
				sb.appendCodePoint(b);
				b = readByte();
			}
			return sb.toString();
		}

		public int nextInt() {
			if (!hasNext())
				throw new NoSuchElementException();
			int c = readByte();
			while (isSpaceChar(c))
				c = readByte();
			boolean minus = false;
			if (c == '-') {
				minus = true;
				c = readByte();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res = res * 10 + c - '0';
				c = readByte();
			} while (!isSpaceChar(c));
			return (minus) ? -res : res;
		}

		public long nextLong() {
			if (!hasNext())
				throw new NoSuchElementException();
			int c = readByte();
			while (isSpaceChar(c))
				c = readByte();
			boolean minus = false;
			if (c == '-') {
				minus = true;
				c = readByte();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res = res * 10 + c - '0';
				c = readByte();
			} while (!isSpaceChar(c));
			return (minus) ? -res : res;
		}

		public double nextDouble() {
			return Double.parseDouble(next());
		}

		public int[] nextIntArray(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}

		public long[] nextLongArray(int n) {
			long[] a = new long[n];
			for (int i = 0; i < n; i++)
				a[i] = nextLong();
			return a;
		}

		public char[][] nextCharMap(int n, int m) {
			char[][] map = new char[n][m];
			for (int i = 0; i < n; i++)
				map[i] = next().toCharArray();
			return map;
		}
	}
}

Measured memory_bytes: 21076
#include<bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define pb push_back
#define ll long long
#define pi pair<int,ll>
#define go ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
string s;
int main()
{
    go;
    cin>>s;
    int x=(s[0]-'0')*10+s[1]-'0';
    int y=(s[2]-'0')*10+s[3]-'0';
    if(x>12||x<1)
    {
        if(y>12||y<1)
        {
            cout<<"NA";
            return 0;
        }
        cout<<"YYMM";
        return 0;
    }
    if(y>12||y<1)
    {
        if(x>12||x<1)
        {
            cout<<"NA";
            return 0;
        }
        cout<<"MMYY";
        return 0;
    }
    cout<<"AMBIGUOUS";
    return 0;
}


Measured memory_bytes: 256
# AtCoder Regular Contest 080
# C - 4-adjacent

N=int(input())
alist=list(map(int,input().split()))

oddcount=0
mod40=0
other=0

for a in alist:
    if a%2==1:
        oddcount+=1
    elif a%4==0:
        mod40+=1
    else:
        other+=1

if N==1:
    if mod40==N:
        print("Yes")
        exit()
    else:
        print("No")
        exit()
if N==2 or N==3:
    if mod40>0 or other==N:
        print("Yes")
        exit()
    else:
        print("No")
        exit()
# ↑ここまではあってそう。
else:
    if (N-((other//2)*2))//2 <= mod40:
        print("Yes")
        exit()
    else:
        print("No")
        exit()

Measured memory_bytes: 19968
#include<bits/stdc++.h>
using namespace std;
 
#define int             long long
#define ld              long double
#define fi              first
#define se              second
#define pb              push_back
#define mp              make_pair
#define mt              make_tuple
#define fo(i,n)         for(i=0; i<n; i++)
#define fo1(i,n)        for(i=1; i<=n; i++)
#define Fo(i,k,n)       for(i=k; k<=n?i<=n:i>=n; k<=n?i++:i--)
#define all(x)          x.begin(), x.end()
#define rall(x)         x.rbegin(), x.rend()
#define sortall(x)      sort(all(x))
#define sortrall(x)     sort(rall(x))
#define clr(x)          memset(x, 0, sizeof(x))
#define tr(it, a)       for(auto it = a.begin(); it != a.end(); it++)
#define pii             pair<int, int>
#define mk(arr,n,type)  type *arr = new type[n];
#define vi              vector<int>
#define si              set<int>
#define usi             unordered_set<int>
#define mii             map<int, int>
#define umii            unordered_map<int, int>
#define pqmx            priority_queue<int>
#define pqmn            priority_queue<int, vi, greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define trailzrobits(x) __builtin_ctzll(x)
#define leadzrobits(x)  __builtin_clzll(x)
#define paritybits(x)   __builtin_parityll(x)
#define gcd             __gcd
#define lcm(x, y)       (x * y) / gcd(x, y)
#define mod             1000000007
#define endl            '\n'
#define PI              3.1415926535897932384626
#define inf             1e18
#define sp(x,y)         fixed<<setprecision(y)<<x
void __print(int32_t x) {cout<<x;}
void __print(int x) {cout<<x;}
void __print(ld x) {cout<<x;}
void __print(double x){cout<<x;}
void __print(float x){cout<<x;}
void __print(bool x) {cout<<(x?"true":"false");}
void __print(char x){cout <<'\''<<x<<'\'';}
void __print(const char *x){cout <<'\"' <<x<<'\"';}
void __print(const string &x) {cout<<'\"'<<x<<'\"';}
template<typename T,typename V>     void __print(const pair<T,V> &x) {cout<<'{';__print(x.first);cout<<',';__print(x.second);cout<<'}';}
template<typename T>                void __print(const T &x) {int f = 0; cout << '{'; for (auto &i: x) cout << (f++ ? "," : ""), __print(i); cout << "}";}void _print() {cout << "]\n";}
template <typename T,typename... V> void _print(T t, V... v) {__print(t);if(sizeof...(v))cout<<", ";_print(v...);}
#ifndef ONLINE_JUDGE
#define dbg(x...) cout<<"["<<#x<<"]=[";_print(x)
#else 
#define dbg(x...)
#endif
int power(int base, int exp){ int res = 1; base %= mod; while(exp > 0){ if(exp & 1) res = (res * base) % mod; base = (base * base) % mod; exp = exp >> 1; } return res; }
int inv(int x){ return power(x, mod - 2) % mod; }
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++




const int N = 1e6 + 6, M = N;
int i, j;

void solve(){
    
    int a; cin>>a;
    cout<<(a+a*a+a*a*a);
    
    
    
    
}




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

Measured memory_bytes: 3636
from sys import stdin
from sys import setrecursionlimit
from queue import deque

setrecursionlimit(10 ** 7)

n,m = map(int,stdin.readline().rstrip().split())
h = list(map(int,stdin.readline().rstrip().split()))
li = [[]for _ in range(n)]
lim = [1]*n
for _ in range(m):
    a,b = map(int,stdin.readline().rstrip().split())
    a -= 1
    b -= 1
    li[a].append(b)
    li[b].append(a)
    if h[a] <= h[b]:
        lim[a] = 0
    if h[b] <= h[a]:
        lim[b] = 0
print(sum(lim))

Measured memory_bytes: 90696
import numpy as np

H,W = map(int,input().split())
A = list()
for i in range(H):
    A.append(list(input()))
dp = [[0]*(W) for i in range(H)]
dp[0][0] = 1

for i in range(H):   
    for j in range(W):
        if A[i][j] == '.':
            # 横が行けるかどうか
            try:
                if A[i][j+1] == '.':
                    dp[i][j+1] += dp[i][j]
            except IndexError as e:
                # print('IndexError')
                pass
            # 縦が行けるかどうか
            try:
                if A[i+1][j] == '.':
                    dp[i+1][j] += dp[i][j]
        
            except IndexError as e:
                # print('IndexError')
                pass

print(dp[-1][-1] % (10**9 +7))


Measured memory_bytes: 174288
N = int(input())
result = [0,0,0,0]
for i in range(N):
    S = input()
    if S == "AC":
        result[0] += 1
    elif S == "WA":
        result[1] += 1
    elif S == "TLE":
        result[2] += 1
    else:
        result[3] += 1
print("AC x " + str(result[0]))
print("WA x " + str(result[1]))
print("TLE x " + str(result[2]))
print("RE x " + str(result[3]))

Measured memory_bytes: 9216
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;
using namespace std;
struct Fast { Fast(){ std::cin.tie(0); ios::sync_with_stdio(false); } } fast;

template<typename ...Ts>
void show(Ts... ts){
  cout<<"#:";
  auto print=[](auto v){cout<<v<<" ";};
  initializer_list<int>{(void(print(ts)),0)...};
  cout<<endl;
}


int main(void){
    int x,n,ans=0;
    cin>>n;
    vector<int> a;
    rep(i,n){
        cin>>x;
        a.push_back(x);
    }
    sort(all(a),greater<int>());
    rep(i,n){
        REP(j,i+1,n){
            REP(k,j+1,n){
                if(a[k]+a[j]>a[i])ans++;
            }
        }
    }
    cout<<ans<<endl;

}



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

int main(){
	int n;	cin>>n;
	string s[n];
	for(int i=0;i<n;i++){
		cin>>s[i];
		sort(s[i].begin(), s[i].end());
	}
	sort(s, s+n);

	long long ans=0;
	long long p=1;
	string now=s[0];
	for(int i=1;i<n;i++){
		if(now==s[i]){
			p++;
		}
		else {
			ans += p*(p-1)/2;
			p=1;
			now=s[i];
		}
	}
	ans += p*(p-1)/2;
	cout<<ans<<endl;





	return 0;
}


Measured memory_bytes: 7296
MOD = 10 ** 9 + 7
n = gets.to_i
ans1 = 1
ans2 = 1
ans3 = 1
n.times do
  ans1 = ans1 * 10 % MOD
  ans2 = ans2 * 9 % MOD
  ans3 = ans3 * 8 % MOD
end
puts (ans1 - ans2 * 2 + ans3 + MOD) % MOD


Measured memory_bytes: 14308
#include <iostream>
using namespace std;
int main(void){
    int a,b,c,d,p,s1=0,s2=0,min=0;
    cin >> a;
    cin >> b;
    cin >> c;
    cin >> d;
    cin >> p;
    
    s1=p*a;
    
    if(p<=c){
        s2=b;
    }
    else{
        s2=b+(p-c)*d;
    }
    if(s1<s2)
        min=s1;
    else
        min=s2;
    
    cout << min << endl;
}



Measured memory_bytes: 3084
N, M, C = map(int, input().rstrip().split(' '))
bt = list(map(int, input().rstrip().split(' ')))
r = 0
for i in range(N):
    at = list(map(int, input().rstrip().split(' ')))
    sum = 0
    for j in range(M):
        sum += at[j] * bt[j]

    sum += C
    if sum > 0:
        r += 1


print(r)



Measured memory_bytes: 3064
S = input()

def DP(x , i):
    #print("x:i:",x,i)
    ans = 0
    # iがSの長さになっていれば、評価する
    if i == len(S):
        # +が入っていればevalで評価する必要がある
        #print("評価")
        if '+' in x:
            return eval(x)
        else:
            return int(x)
    else:
        # i番目の数字の前に+を挟まない場合
        ans += DP(x + S[i] , i+1)
        if i > 0:
            # i番目の数字の前に+を挟む場合
            ans += DP(x + '+' + S[i], i+1)
        return ans

print(DP('',0))

Measured memory_bytes: 3060
// C - Dice and Coin
#include <bits/stdc++.h>
using namespace std;

int main(){
	int N,K; cin>>N>>K;
	double ans = 0;
	for(int n=1; n<=N; ++n){
		double part_ans = 1./N;
		int k = n;
		while(k<K){
			k *= 2;
			part_ans /= 2;
		}
		ans += part_ans;
	}
	printf("%.12f\n",ans);
}

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

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())

// {{{
template<typename T>
void printmatrix(vector<vector<T> > ar){
    for (int i = 0; i < (int)ar.size(); i++) {
        for (int j = 0; j < (int)ar[0].size(); j++) {
            cout << ar[i][j];
        }
        cout << endl;
    }
}

template<typename T>
void printvector(vector<T> vec){
    for (int i = 0; i < (int)vec.size(); i++) {
        cout << vec[i] << endl;
    }
}

template<typename T>
void unique(vector<T>& vec){
    sort(vec.begin(), vec.end());
    vec.erase(unique(vec.begin(), vec.end()), vec.end());
}

template<typename T>
vector<T> cumsum(vector<T> vec){
    vector<T> newvec((T)vec.size());
    int tmp = 0;
    for (int i = 0; i < (int)vec.size(); i++) {
        tmp += vec[i];
        newvec[i] = tmp;
    }

    return newvec;
}

template<typename T>
T digitsum(T x){
    T y=0;
    while(x){
        y += x % 10;
        x /= 10;
    }

    return y;
}
// }}}
/* vim:set foldmethod=marker: */

int main(int argc, char const* argv[])
{
    int n;
    cin >> n;

    for (int i = 6; i >= 0; i--) {
        if ((1 << i) <= n) {
            cout << (1<<i) << endl;
            break;
        }

        if (n == 2) {
            cout << 1 << endl;
        }
    }

    return 0;
}

// sortの仕方
// int a[N];
// array<int,N> ar;
// vector<int> v;
//
// sort(a, a+N); // 配列
// sort(ar.begin(), ar.end()); // array
// sort(v.begin(), v.end()); // vector 昇順
// sort(v.begin(), v.end(), greater<int>()); // 降順

// Template
// template <class T>
// T foomax(T x, T y){
//   if (x > y){
//     return x;
//   }else{
//     return y;
//   }
// }

// string を int に変換 stoi("1010")
// int を string に変換 to_string(1010)


Measured memory_bytes: 256
using System;

namespace B {
    class Program {
        static void Main(string[] args) {
            var input = Console.ReadLine().Split(' ');
            int D = int.Parse(input[0]);
            int N = int.Parse(input[1]);
            
            if(D == 0) {
                int tmp = 0;
                for(int i = 0; i < N; ++i) {
                    tmp += 1;
                    while (tmp % 100 == 0 && tmp / 100 > 0) {
                        tmp += 1;
                    }
                }
                Console.WriteLine(tmp);
            }
            else if(D == 1) {
                int tmp = 0;
                for (int i = 0; i < N; ++i) {
                    tmp += 100;
                    while ((tmp / 100) % 100 == 0 && (tmp / 100) / 100 > 0) {
                        tmp += 100;
                    }
                }
                Console.WriteLine(tmp);
            }
            else {
                int tmp = 0;
                for (int i = 0; i < N; ++i) {
                    tmp += 10000;
                    while ((tmp / 10000) % 100 == 0 && (tmp / 10000) / 100 > 0) {
                        tmp += 10000;
                    }
                }
                Console.WriteLine(tmp);
            }
        }

    }
}


Measured memory_bytes: 13140
// C - Prison
#include <bits/stdc++.h>
using namespace std;

int in(){int x;scanf("%d",&x);return x;}

int main(){
	int N,M; cin>>N>>M;
	int L = 1, R = N;
	while(M--){
		L = max(L, in());
		R = min(R, in());
	}
	cout<< (R<L? 0: R-L+1) <<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll p = 1000000007;
ll tree[400005];
ll n;
void update(ll x,ll ind){
    ind += n;
    tree[ind] = x;
    while(ind > 1){
        ind >>= 1;
        tree[ind] = max(tree[ind<<1],tree[ind<<1 | 1]);
    }
}
ll query(ll l,ll r){
    l += n;
    r += n;
    ll ans = tree[l];
    while(l < r){
        if(l&1){
            ans = max(ans,tree[l]);
            l++;
        }
        if(r&1){
            r--;
            ans = max(ans,tree[r]);
        }
        l >>= 1;
        r >>= 1;
    }
    return ans;
}
int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> n;
    ll h[n], a[n];
    for(ll i = 0;i < n;i++){
        cin >> h[i];
    }
    for(ll i = 0;i < n;i++){
        cin >> a[i];
    }
    ll dp[n];
    for(ll i = 1;i < 2*n;i++){
        tree[i] = -1;
    }
    dp[0] = a[0];
    update(a[0],h[0]-1);
    for(ll i = 1;i < n;i++){
        ll x = query(0,h[i]);
        if(x != -1){
            dp[i] = x+a[i];
        }
        else{
            dp[i] = a[i];
        }
        update(dp[i],h[i]-1);
    }
    ll ans = query(0,n);
    cout << ans << endl;
}

Measured memory_bytes: 8064
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Atcoder1_A
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            Console.WriteLine(n / 3);
        }
    }
}

Measured memory_bytes: 11092
#include <stdio.h>

int main(){
    double a, b;
    
    scanf("%lf %lf", &a, &b);
    int int_a,int_b;
    int_a = a; int_b = b;
    printf("%d %d %f\n", int_a/int_b, int_a%int_b, a/b);
}
 


Measured memory_bytes: 2708
import java.util.*;
import java.io.*;
import java.math.*;

public class Main
{

    public static void process()throws IOException
    {
        String x=sc.next(),y=sc.next();
        BigDecimal a = new BigDecimal(x);
        BigDecimal b = new BigDecimal(y);
        a=a.multiply(b);
        a=a.setScale(0, RoundingMode.FLOOR);
        pn(a.toString());
    }


    static FastReader sc;
    static PrintWriter out;
    public static void main(String[]args)throws IOException
    {
        out = new PrintWriter(System.out);
        sc=new FastReader();

        long s = System.currentTimeMillis();
        int t=1;
        //t=ni();
        while(t-->0)
            process();

        out.flush();
        System.err.println(System.currentTimeMillis()-s+"ms");
    }
    
    
    static void pn(Object o){out.println(o);}
    static void p(Object o){out.print(o);}
    static int ni()throws IOException{return Integer.parseInt(sc.next());}
    static long nl()throws IOException{return Long.parseLong(sc.next());}
    static double nd()throws IOException{return Double.parseDouble(sc.next());}
    static String nln()throws IOException{return sc.nextLine();}
    static long gcd(long a, long b)throws IOException{return (b==0)?a:gcd(b,a%b);}
    static int gcd(int a, int b)throws IOException{return (b==0)?a:gcd(b,a%b);}
    static int bit(long n)throws IOException{return (n==0)?0:(1+bit(n&(n-1)));}
    
    static long mod=(long)1e9+7l;

    static<T> void r_sort(T arr[],int n){
        Random r = new Random(); 
        for (int i = n-1; i > 0; i--){ 
            int j = r.nextInt(i+1); 
                  
            T temp = arr[i]; 
            arr[i] = arr[j]; 
            arr[j] = temp; 
        } 
        Arrays.sort(arr); 
    }
    
/////////////////////////////////////////////////////////////////////////////////////////////////////////
    static class FastReader{ 
        BufferedReader br; 
        StringTokenizer st; 
  
        public FastReader(){ 
            br = new BufferedReader(new InputStreamReader(System.in)); 
        } 
  
        String next(){ 
            while (st == null || !st.hasMoreElements()){ 
                try{ st = new StringTokenizer(br.readLine()); } catch (IOException  e){ e.printStackTrace(); } 
            } 
            return st.nextToken(); 
        } 
  
        String nextLine(){ 
            String str = ""; 
            try{ str = br.readLine(); } catch (IOException e) { e.printStackTrace(); } 
            return str; 
        } 
    } 
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
}


Measured memory_bytes: 37060
#include <iostream>
#include <numeric>
#include <iomanip>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)




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

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define LL long long
#define INF 0x3f3f3f3f
#define Inf 1000000000000000000LL
#define F first
#define S second
using namespace std;
typedef pair<int,int>pii;
int H[100010][3];
int DP[100010][3];
int main(){
	int N;
	cin>>N;
	for(int i=0;i<N;i++)
		for(int j=0;j<3;j++)
			cin>>H[i][j];
	for(int i=0;i<3;i++)DP[0][i]=H[0][i];
	for(int i=1;i<N;i++)for(int j=0;j<3;j++)
			for(int k=0;k<3;k++)if(j!=k)
					DP[i][j]=max(DP[i][j],DP[i-1][k]+H[i][j]);
	cout<<max(DP[N-1][0],max(DP[N-1][1],DP[N-1][2]));
	return 0;
}


Measured memory_bytes: 2560
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<unordered_map>
#include<random>
#include<array>
#include<cassert>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())





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

	int n;
	int p[50], q[50];


	cin >> n;
	rep(i, n)cin >> p[i];
	rep(i, n)q[i] = p[i];
	sort(q, q + n);

	int d = 0;
	rep(i, n)if (p[i] != q[i])d++;

	if (d <= 2) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}



	return 0;
}

Measured memory_bytes: 256
n = int(input())
s = input()

cnt = s.count("R") * s.count("G") * s.count("B")

for i in range(n - 1):
    tmp = s[i]
    for j in range(i + 1, (n + i + 1) // 2):
        if s[2 * j - i] != s[j] and s[j] != tmp and s[2 * j - i] != tmp:
            cnt -= 1
print(cnt)

Measured memory_bytes: 9196
#A = red B = green C = blue

import sys

a, b, c = map(int, input().split())
K = int(input())

A, B, C = a ,b, c
listS =[]
for N_a in range(K):
    for N_b in range(K-N_a):
        N_c = K-N_a-N_b
        listS.append((N_a,N_b,N_c))
for i in range(len(listS)):
    A *= 2 ** listS[i][0]
    B *= 2 ** listS[i][1]
    C *= 2 ** listS[i][2]
    if B > A and C > B:
        print('Yes')
        sys.exit()
    else:
        pass
#     print(A,B,C)
    A, B, C = a ,b, c
print("No")

Measured memory_bytes: 8912
#include <iostream>
#include <vector>
#include <map>
#include <deque>
using namespace std;

map<int, vector<int>> mp;
deque<int> d;
bool pass[100010];
int main() {
	int N, M, a, b; cin >> N >> M;
	for(int i=0; i<M; ++i){
	    cin >> a >> b;
	    mp[a].push_back(b);
	    mp[b].push_back(a);
	}
	pass[1]=true;
	d.push_back(1);
	for(int p=0; p<2; ++p){
	    int now=1;
	    bool flag=true;
	    while(flag){
	        flag=false;
	        for(int i=0; i<mp[now].size(); ++i){
	            if(!pass[mp[now][i]]){
	                now=mp[now][i];
	                if(p==0) d.push_front(now);
	                else d.push_back(now);
	                pass[now]=true;
	                flag=true;
	                break;
	            }
	        }
	    }
	}
	cout << d.size() << endl;
	for(int i=0; i<d.size(); ++i){
	    cout << d[i];
	    if(i+1<d.size()) cout << ' ';
	}
	return 0;
}


Measured memory_bytes: 12288
#include<bits/stdc++.h>
using namespace std;
#define ll int64_t
#define f first
#define sec second
#define pb push_back
#define pf push_front
#define pbb pop_back
#define vi vector<ll>
#define vii vector< pair<ll,ll> >
#define pi pair<ll,ll>
#define map map<ll,ll>
#define set set<ll>
const int m=1e9+7;
int main(){
    
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll a,b;
    cin>>a>>b;
    cout<<6-(a+b)<<endl;
}

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

using namespace std;

int main(){
  int N, Atemp;
  vector<int> A;
  cin >> N;
  int i=0;

  while(cin >> Atemp){
    A.push_back(Atemp);
    i++;
    if(i>=N) break;
  }
  int max = *max_element(A.begin(), A.end());
  int min = *min_element(A.begin(), A.end());
  cout << max-min << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int a,b,c,d,e,i,j;
string s;
void rec(int q, int w){
    if(q>a){
        cout<<s<<endl;
        return;
    }
    for(int i=0; i<w; i++){
        s.push_back('a'+i);
        rec(q+1,w);;
        s.pop_back();
    }
    s.push_back('a'+w);
    rec(q+1,w+1);
    s.pop_back();
}
int main(){
    ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
    cin>>a;
    rec(1,0);
    return 0;
}

Measured memory_bytes: 1536
#include<stdio.h>
#define INF 100000

int matrix(int);

int M[100],m[100][100];

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

  for(i=0;i<n;i++){
    scanf("%d%d",&M[i],&M[i+1]);
  }

  min = matrix(n);

  printf("%d\n",min);
  return 0;
}


int matrix(int n){
  int i,j,k,l,q;

  for(i=1;i<=n;i++){
    m[i][i]=0;
  }
  for(l=2;l<=n;l++){
    for(i=1;i<=n-l+1;i++){
      j=i+l-1;
      m[i][j]=INF;
      for(k=i;k<=j-1;k++){
	q=m[i][k] + m[k+1][j] + M[i-1]*M[k]*M[j];
	if(m[i][j]>q){
	  m[i][j]=q;
	}
      }
    }
  }
  return m[1][n];
}



Measured memory_bytes: 2052
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;
#define rep(i,n) for(int i=0 ; i < (int) (n) ; ++i )

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

    ll a,b,c;
    cin >> a >> b >> c;
    if (a%2==0 || b%2==0 || c%2==0)
    {
        cout << 0 << endl;
    }
    else
    {
        cout << min(a * b, min(a * c, b * c)) << endl;
    }
    
}




Measured memory_bytes: 256