akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;
#define FAST ios_base::sync_with_stdio(false); cin.tie(0);
#define LLINF (long long) 1e18//1234567890987654321
#define INF 1234567890l
#define pb push_back
#define ins insert
#define f first
#define s second	
#define db 0
#define EPS (1e-7)    //0.0000001 the value
#define PI (acos(-1))
#define MAXN 300006
#define MAXK 26
#define MAXX 15000006
#define ll long long int
#define ld long double
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());    //can be used by calling rng() or shuffle(A, A+n, rng)
#define FOR(ii, ss, ee) for(ll ii = ss; ii < ee; ii++)
#define space " "
#define cbr cout << "hi\n"
#define mmst(x, v) memset((x), v, sizeof ((x)))
#define bg(ms) (*ms.begin())
#define ed(ms) (*prev(ms.end(), 1))
#define addedge(a, b, c, v) v[(a)].pb(pi((b), (c))); v[(b)].pb(pi((a), (c)))
#define ph push
#define btinpct(x) __builtin_popcountll(x)
#define p2(x) (1LL<<(x))
#define all(x) (x).begin(), (x).end()
#define lbd(x, y) lower_bound(all(x), y)
#define ubd(x, y) upper_bound(all(x), y)
typedef pair <ll, ll> pi;
typedef pair <ll, pi> spi;
typedef pair <pi, pi> dpi;
inline ll rand(ll x, ll y) { ++y; return (rng() % (y-x)) + x; } //inclusivesss
ll a,b,k;
int main()
{
	cin>>a>>b>>k;
	for(ll i = min(a,b); i >= 1; i--)
	{
		if(a%i == 0 && b % i == 0) 
		{
			--k;
			if(k==0) { cout << i << "\n"; return 0; }
		}
	}
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <queue>
#include <numeric>
#include <random>
#include <algorithm>
#include <functional>
#include <cassert>

using namespace std;
typedef long long ll;

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

const int INF = (1 << 30) - 1;
const ll INFLL= (1LL << 61) - 1;
const int MOD = 1000000007;
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)

int main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int N;
  cin>>N;
  vector<int> P(N);
  REP(i,N)cin>>P[i];
  int min=INF,ans=0;
  REP(i,N){
    chmin(min,P[i]);
    if(min>=P[i]){
      ans++;
    }
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 1024
#include <stdio.h>

int main(void)
{
	int a, b;
	int i;

	while (scanf("%d %d", &a, &b) != EOF){
		i = 0;
		a += b;

		while (a){
			i++;
			a /= 10;
		}

		printf("%d\n", i);
	}

	return (0);
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
using namespace std;
using pii=pair<int,int>;

#define fi first
#define se second
#define pb push_back
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define H_MAX 50
#define W_MAX 50

int dx[4]={0,1,0,-1};
int dy[4]={1,0,-1,0};
int H,W;

namespace patch {
  template < typename T > std::string to_string( const T& n )
  {
    std::ostringstream stm ;
    stm << n ;
    return stm.str() ;
  }
}

int main() {
	long long n, a[5], b[6], p_b[6];
	cin >> n;
	rep(i,5) {
		cin >> a[i];
	}
	rep(i,6) {
		b[i] = 0;
		if(i==0) 
			p_b[i] = n;
		else
			p_b[i] = 0;
	}
	long long ans=0;
	long long tmp;
	long long bt;
	long long min;
	rep(i,5) {
		if(i==0) 
			min = a[0];
		else 
			min = min < a[i] ? min : a[i];
	}
	if(n % min == 0) {
		tmp = n / min;
	}
	else {
		tmp = n/min+1;
	}
	ans = 4 + tmp;
/*
	rep(i,5) {
		if(i == 0) {
			if(n%a[i] == 0) {
				tmp = n / a[i];
				ans += tmp;
			} else {
				tmp = n / a[i]+1;
				ans += tmp;
			}
			bt = a[i];
		}
		else if(bt <= a[i]) {
			ans += 1;
		}
		else {
			if(n % a[i] == 0) {
				tmp = n / a[i];
				ans += tmp;
			} else {
				tmp = bt/a[i] +1;
				ans += tmp;
			}
			bt = a[i];
		}
	}
	*/
/*
	while(1) {
		ans++;
		b[1] = min(pb[0], a[0]);
		b[2] = min(pb[1], a[1]);
		b[3] = min(pb[2], a[2]);
		b[4] = min(pb[3], a[3]);
		b[5] = min(pb[4], a[4]);
		pb[0] = pb[0] - b[1];
		pb[1] = pb[1] - b[2] + b[1];
		pb[2] = pb[2] - b[3] + b[2];
		pb[3] = pb[3] - b[4] + b[3];
		pb[4] = pb[4] - b[5] + b[4];
		pb[5] = pb[5] + b[5];
		if(pb[5] == n)
			break;
	}
	*/

	cout << ans << endl;
  return 0;
}
 


Measured memory_bytes: 256
//--------------------------------------//
#include <bits/stdc++.h>
#include <vector>
//-------------------------------------//
#define faster               ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define ROF(x, y)            for(int i=int(x)-1; i>=int(y); i--)
#define FOR(x, y)            for(int i=int(x); i<int(y); i++)
#define test                 int t; cin >>t; while(t--)
#define strsort(s)           sort(s.begin(), s.end());
#define eofstr               string s; while(cin >>s)
#define cs(i)                printf("Case %d: ", i);
#define eof                  long long int n; while(cin>>n)
#define Y                    cout <<"YES" <<endl;
#define N                    cout <<"NO" <<endl;
#define noo                  cout <<"-1" <<endl;
#define pi a                 cos(-1)
#define cube(x)              (x*x*x)
#define sqr(x)               (x*x)
#include <algorithm>
//-------------------------------------//
typedef unsigned long long   ull;
typedef long long int        lld;
typedef long double          ld;
using namespace std;

//----<<some short ninja function>>----//
//sort(arr, arr+n, greater<int>());
//get line(c i n, s t r);
//*max_element(x, x+n);
//string_stream any_name(s); (string->int)
//-------------------------------------//

lld i, j, f;

int main()
{
    string s;
    cin >>s;
    int n = s.size();
    cout <<s;
    if(s[n-1]=='s')
    {
        cout <<"es" <<endl;
    }
    else
    {
        cout <<"s" <<endl;
    }
    return 0;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
 
int main(){
  ll S;
  cin>>S;
  ll digit=0;
  ll d=S;
  while(d!=0){
    digit++;
    d/=10;
  }
  vector<int> s(digit);
  rep(i,digit){
    s[i]=S%10;
    S/=10;
  }
  reverse(s.begin(),s.end());
  ll ans;
  ll cnt;
  ll cnt2;
  rep(i,digit-2){
    cnt=0;
    cnt2=0;
    cnt=s[i]*100+s[i+1]*10+s[i+2];
    cnt2=abs(753-cnt);
    if(i==0){
      ans=cnt2;
    }
    if(i>0){
      if(cnt2<ans){
        ans=cnt2;
      }
    }
  }
  cout<<ans<<endl;
}

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

using namespace std;

int main(){
	int n, m, c;
	cin >> n >> m >> c;

	vector<int> vec(m, 0);
	for (int i = 0; i < m; i++) cin >> vec[i];

	int ans = 0;
	for (int i = 0; i < n; i++){
		int a;
		long long total = c;
		for (int j = 0; j < m; j++){
			cin >> a;
			total += vec[j] * a;
		}
		if (total > 0) ans++;
	}

	cout << ans << endl;
	return 0;
}


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

using namespace std;

int main()
{
    //freopen("04.txt","r",stdin);
    int mod,n,i,a[100001]={0},b[100001]={0};
    long long tim[100001]={0};
    long long mul,done=0;
    cin>>n;
    for(i=0;i<n;i++)
        cin>>a[i]>>b[i];
    for(i=0;i<n;i++)
    {
        mod=a[i]%b[i];
        if(mod)
            tim[i]=b[i]-mod;
    }
    for(i=n-2;i>=0;i--)
    {
        if(tim[i]>=tim[i+1])
            continue;
        mul=(tim[i+1]-tim[i])/b[i];
        tim[i]+=mul*b[i];
        if(tim[i]<tim[i+1])
            tim[i]+=b[i];
    }
    done=tim[n-1];
    for(i=n-2;i>=0;i--)
    {
        done+=(long long)(tim[i]-tim[i+1]);
    }
    cout<<done;
    return 0;
}


Measured memory_bytes: 1792
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public final class Main {

    public static void main(String[] args) {
        final Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        final int h1 = in.nextInt();
        final int m1 = in.nextInt();
        final int h2 = in.nextInt();
        final int m2 = in.nextInt();
        final int k = in.nextInt();
        in.nextLine();
        int diff = (h2 * 60 + m2) - (h1 * 60 + m1);
        System.out.println(Math.max(0, diff - k));
    }
}


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

using namespace std;
#define int long long
const int N = 1e5 + 10, MOD = 1e9 + 7;
int dp[N], dp2[N], x[N], y[N];

int32_t main()
{
    int n, m; cin >> n >> m;
    for (int i = 0; i < n; i ++) cin >> x[i];
    for (int i = 0; i < m; i ++) cin >> y[i];
    sort(x, x + n);
    sort(y, y + m);
    for (int i = 1; i < n; i ++)
        dp[i] = (dp[i - 1] + (x[i] - x[i - 1]) * i) % MOD;
    for (int i = 1; i < n; i ++)
        dp[i] = (dp[i] + dp[i - 1]) % MOD;
    for (int i = 1; i < m; i ++)
        dp2[i] = (dp2[i - 1] + (y[i] - y[i - 1]) * i) % MOD;
    for (int i = 1; i < m; i ++)
        dp2[i] = (dp2[i] + dp2[i - 1]) % MOD;
    cout << ( dp[n - 1] * dp2[m - 1] ) % MOD << "\n";
}


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

#define pb push_back
#define F first
#define S second
#define y1 dasdasfasfas
#define x1 wqdadfasfasfas
#define All(c) c.begin(), c.end()
#define SZ(A) (int((A).size()))
#define umap unordered_map
#define __ fflush(stdout)
#define FILENAME ""

typedef long long ll;
typedef long double ld;    

using namespace std;

void FREOPEN() {
	#ifdef LOCAL
		freopen(".in", "r", stdin);
		freopen("1.out", "w", stdout);
	#else
		//freopen(FILENAME".in", "r", stdin);
		//freopen(FILENAME".out", "w", stdout);
	#endif
}

inline double Time() {return (clock() * 1.0) / CLOCKS_PER_SEC; }             

const int N = 200500, inf = 1e9 * 2;

const ll MOD = 1e9 + 7ll, INF = 1e18;

const int dx[] = {1, -1, 0, 0, -1, 1, -1, 1};
const int dy[] = {0, 0, 1, -1, -1, 1, 1, -1};

int h[N];

ll dp[N];

ll calc(int p, int x) {
	return h[p] * 1ll * h[p] + dp[p] - 2 * h[p] * 1ll * x;
}

double inter(int i, int j) {
	double ai = -2 * h[i], aj = -2 * h[j];
	double bi = h[i] * 1ll * h[i] + dp[i],
			bj = h[j] * 1ll * h[j] + dp[j];
	return (bj - bi) / (ai - aj);
}

int main() {
	FREOPEN();
	int n;
	ll C;
	cin >> n >> C;
	for (int i = 1; i <= n; i++) scanf("%d ", &h[i]);
	vector<int> ord;
	ord.pb(1);
	for (int i = 2; i <= n; i++) {
		int l = 0, r = SZ(ord) - 1;
		while (r - l > 1) {
			int mid = (l + r) / 2;
			if (calc(ord[mid], h[i]) >= calc(ord[mid + 1], h[i])) l = mid + 1;
			else r = mid;
		}
		dp[i] = min(calc(ord[l], h[i]), calc(ord[r], h[i])) + (h[i] * 1ll * h[i]) + C;
		while (SZ(ord) > 1) {
			if (inter(ord[SZ(ord) - 2], ord[SZ(ord) - 1]) < inter(ord[SZ(ord) - 2], i)) break;
			ord.pop_back();
		}
		ord.pb(i);
	}
	printf("%lld", dp[n]);
	return 0;
}


Measured memory_bytes: 3704
#include <bits/stdc++.h>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define pb push_back
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;

int main(){
    ll n;
    cin >> n;
    queue<ll> q;
    q.push(3);
    q.push(5);
    q.push(7);
    auto check = [](ll m) {
        set<int> st;
        while(m > 0) {
            st.insert(m% 10);
            m /= 10;
        }
        return st.size() >= 3;
    };
    int ans = 0;
    while(!q.empty()) {
        auto m = q.front();
        q.pop();
        if(check(m)) ++ans;
        if(m*10 + 3 <= n) q.push(m*10+3); 
        if(m*10 + 5 <= n) q.push(m*10+5); 
        if(m*10 + 7 <= n) q.push(m*10+7); 
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 384
local flo = math.floor

local function div_flo(divided, dividing)
	return flo(divided / dividing)
end

local N = io.read("*n")

local sum = 0
local num = N
while true do
	if num <= 0 then
		break
	end
	local drow = div_flo(num, 10) * 10
	sum = sum + num - drow

	num = div_flo(num, 10)
end

print((N % sum == 0) and "Yes" or "No")

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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define all(a) (a).begin(), (a).end()
#define bit32(x) (1 << (x))
#define bit64(x) (1ll << (x))
#define sz(v) ((int) v.size())

using namespace std;

using i64 = long long;
using f80 = long double;
using vi32 = vector<int>;
using vi64 = vector<i64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

void yes() { cout << "Yes" << endl; exit(0); }
void no() { cout << "No" << endl; exit(0); }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> void amax(T &x, T y) { x = max(x, y); }
template <typename T> void amin(T &x, T y) { x = min(x, y); }
template <typename T> T exp(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { for (auto &x : v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }

const int INF = 1001001001;
const int dx[] = {1, 0, -1, 0};
const int dy[] = {0, 1, 0, -1};

void solve() {
  int n, k;
  cin >> n >> k;
  vi32 a(n);
  cin >> a;
  sort(all(a));
  int ans = 0;
  rep(i, k) ans += a[i];
  cout << ans << endl;
}


Measured memory_bytes: 3660
//template code, C343, 2019
import java.util.LinkedList;
import java.util.Scanner;
import java.util.Iterator;

class Graph1 {
	private int totalVertex;
	private LinkedList<LinkedList<Integer>> adjList;
	//adjacency list of edges
	public Graph1() { totalVertex = 0; }
	public void loadAdjList() {
		Scanner in = new Scanner(System.in);
		totalVertex = in.nextInt();
		adjList = new LinkedList<LinkedList<Integer>>();
		for(int i = 0; i < totalVertex; i ++) {
			LinkedList<Integer> tmp = new LinkedList<Integer>();
			int idx1 = in.nextInt() - 1;
			int degree = in.nextInt();
			//System.out.println("mark idx1 = " + idx1 + " degree = " + degree);
			for(int j = 0; j < degree; j ++) {
				int idx2 = in.nextInt() - 1;
				tmp.add(idx2);
			}	
			adjList.add(tmp);
		}
		in.close();
	}
	public void printAdjMatrix() {
		Integer[][] adjMatrix = new Integer[totalVertex][totalVertex];
		//complete the following
		int size = totalVertex;
		
		for(int i=0; i<size; i++) {
			for(int l =0; l<size; l++) {
				if(adjList.get(i).contains(l)) {
					adjMatrix[i][l]=1;
					System.out.print("1");
				}
                                else {
					adjMatrix[i][l]=0;
					System.out.print("0");
				}
				if (l!=size-1) {
					System.out.print(" ");
				}
				
			}
			
                 System.out.println();
		
               }
		
	}
}

//change class name GraphRepresentation to Main() for submission to AIZU
public class Main {
	public static void main(String argv[]) {
		Graph1 g = new Graph1();
		g.loadAdjList();
		g.printAdjMatrix();
	}
}


Measured memory_bytes: 34532
#include<stdio.h>
#include<stdlib.h>
#define N 1000000
int count=0,l,*S;
 
void insertionSort(int A[], int n, int m){
int i,v,j;
  for(i=m;i<n;i++){
    v=A[i];
    j=i-m;
    while(j>=0&&A[j]>v){
      A[j+m]=A[j];
      j-=m;
      count++;
    }
    A[j+m]=v;
  }
}
 
void Sort(int A[],int n){
  int i=0,a;
 
  S=(int *)malloc(n * sizeof(int));
 
  for(a=1; ; ){
    if(a>n) break;
    S[i]=a;
    i++;
    a=3*a+1;
  }
  l=i;
  for(i=l-1;i>=0;i--){
    insertionSort(A,n,S[i]);
  }
}
 
 
 
int main(){
  int i,A[N],n;
  scanf("%d",&n);
  for(i=0;i<n;i++) scanf("%d",&A[i]);
 
  Sort(A,n);
 
  printf("%d\n",l);
 
  for(i=l-1;i>=0;i--){
    printf("%d",S[i]);
    if(i) printf(" ");
  }
  printf("\n");
  printf("%d\n",count);
  for(i=0;i<n;i++)printf("%d\n",A[i]);
 
  free(S);
  return 0;
}



Measured memory_bytes: 5760
N = int(input())
S = input()
ans = S.count('R') * S.count('G') * S.count('B')
for i in range(N):
    for j in range(i+1, N):
        k = j + j - i
        if k < N and S[i] != S[j] and S[j] != S[k] and S[k] != S[i]:
            ans -= 1
print(ans)

Measured memory_bytes: 9140
t1, t2 = map(int, raw_input().split(' '))
a1, a2 = map(int, raw_input().split(' '))
b1, b2 = map(int, raw_input().split(' '))
v1 = a1 * t1 + a2 * t2
v2 = b1 * t1 + b2 * t2
if v1 == v2:
	print('infinity')
else:
	if(v1 < v2):
		v1, v2 = v2, v1
		a1, a2, b1, b2 = b1, b2, a1, a2
	lo = 0
	hi = 10**100
	ans = 0
	while lo <= hi:
		mid = (lo + hi) / 2
		at_a = mid * v1
		at_b = mid * v2
		if at_b + b1 * t1 >= at_a + a1 * t1:
			ans = mid
			lo = mid + 1
		else:
			hi = mid - 1
	mv = 0
	if ans * v1 + a1 * t1 < ans * v2 + b1 * t1:
		mv = 1
	print(2*ans + mv)


Measured memory_bytes: 2696
#include <iostream>
#include <vector>
#include <unordered_map>

using ll = long long;
int main() {
    using namespace std;
    ll n;
    cin >> n;
    vector<ll> vec(n,0);
    ll max = -1;
    int maxi;
    for(int i = 0;i < n;++i){
        cin >> vec[i];
        if(max < vec[i]){
            maxi = i;
            max = vec[i];
        }
    }
    for(int i = 0;i < n;++i){
        if(i == maxi){
            ll max2 = -1;
            for(int j = 0;j < n;++j){
                if(i == j)continue;
                if(max2 < vec[j]){
                    max2 = vec[j];
                }
            }
            cout << max2 << endl;
        }
        else cout << max << endl;
    }



}

Measured memory_bytes: 3200
n = int(input())

nana_go_sans = [{357, 375, 537, 573, 735, 753}]

order = len(str(n))
for i in range(3, order):
    nana_go_san = set()
    nana_go_san.add(int("3" + "5" * (i - 1) + "7"))
    nana_go_san.add(int("3" + "7" * (i - 1) + "5"))
    nana_go_san.add(int("5" + "3" * (i - 1) + "7"))
    nana_go_san.add(int("5" + "7" * (i - 1) + "3"))
    nana_go_san.add(int("7" + "3" * (i - 1) + "5"))
    nana_go_san.add(int("7" + "5" * (i - 1) + "3"))
    for num in nana_go_sans[i - 3]:
        nana_go_san.add(int("3" + str(num)))
        nana_go_san.add(int("5" + str(num)))
        nana_go_san.add(int("7" + str(num)))
        nana_go_san.add(int(str(num) + "3"))
        nana_go_san.add(int(str(num) + "5"))
        nana_go_san.add(int(str(num) + "7"))
    nana_go_sans.append(nana_go_san)

count = 0
for nana_go_san in nana_go_sans:
    for num in nana_go_san:
        if num <= n:
            count += 1

print(count)

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

int main(){
    string S, T;
    cin >> S >> T;
    int ans = 0;
    for (int i = 0; i < S.size(); i++){
        if( S[i] == T[i]){
            ans += 1;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
N = int(input())
*A, = map(int, input().split())
cnt = 0
for i in range(N):
    min = i
    for j in range(i, N):
        if A[min]  > A[j]:
            min = j
    if min != i:
        A[i], A[min] = A[min], A[i]
        cnt += 1
print(*A)
print(cnt)


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

using namespace std;

#ifdef SG
	#include <debug.h>
#else
	#define show(...)
	#define debug(...)
	#define deepen(...)
	#define timer(...)
#endif

#define ARG4(_1,_2,_3,_4,...) _4

#define forn3(i,l,r) for (int i = int(l); i < int(r); ++i)
#define forn2(i,n) forn3 (i, 0, n)
#define forn(...) ARG4(__VA_ARGS__, forn3, forn2) (__VA_ARGS__)

#define ford3(i,l,r) for (int i = int(r) - 1; i >= int(l); --i)
#define ford2(i,n) ford3 (i, 0, n)
#define ford(...) ARG4(__VA_ARGS__, ford3, ford2) (__VA_ARGS__)

#define ve vector
#define pa pair
#define tu tuple
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define fs first
#define sc second
#define all(a) (a).begin(), (a).end()
#define sz(a) ((int)(a).size())

typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef unsigned char uc;
typedef pa<int, int> pii;
typedef pa<int, ll> pil;
typedef pa<ll, int> pli;
typedef pa<ll, ll> pll;
typedef ve<int> vi;

const ld pi = 3.1415926535897932384626433832795l;

template<typename T> inline auto sqr (T x) -> decltype(x * x) {return x * x;}
template<typename T1, typename T2> inline bool umx (T1& a, T2 b) {if (a < b) {a = b; return 1;} return 0;}
template<typename T1, typename T2> inline bool umn (T1& a, T2 b) {if (b < a) {a = b; return 1;} return 0;}

const int N = 8010;

bool d[2][4 * N];

bool check(vi a, int res) {
	memset(d, 0, sizeof(d));
	d[0][2 * N] = 1;
	forn(i, sz(a)) {
		int i0 = (i & 1), i1 = i0 ^ 1;
		forn(j, 4 * N) {
			if (!d[i0][j])
				continue;
			d[i1][j - a[i]] = 1;
			d[i1][j + a[i]] = 1;
			d[i0][j] = 0;
		}
	}             
	return d[sz(a) & 1][res + 2 * N];
}

int main () {
	//std::ios::sync_with_stdio(false);
	cout.setf(ios::showpoint | ios::fixed);
	cout.precision(20);
#ifdef SG
	freopen((problemname + ".in").c_str(), "r", stdin);
//	freopen((problemname + ".out").c_str(), "w", stdout);
#endif
	string s;
	getline(cin, s);
	int x, y;
	cin >> x >> y;     
	bool ok = 1;
	forn(i, sz(s)) {
		if (s[i] == 'T') {
			x -= i;
			ok = 0;
			s.erase(s.begin(), s.begin() + i);
			break;
		}
	}
	if (ok) {
		if (sz(s) == x && y == 0) {
			puts("Yes");
		} else {
			puts("No");
		}
		return 0;
	}
	int n = sz(s);
	bool q = 0;
	vi ord[2];
	int cnt = 0;
	forn(i, n) {
		if (s[i] == 'T') {
			if (cnt > 0) {
				ord[q].pb(cnt);
			}
			cnt = 0;
			q = !q;
			continue;
		}
		cnt++;
	}
	if (cnt != 0) {
		ord[q].pb(cnt);
	}
	debug(mt(x, y));
	debug(all(ord[0]));
	debug(all(ord[1]));
	if (check(ord[0], x) && check(ord[1], y)) {
		puts("Yes");		
	} else {
		puts("No");
	}



	return 0;
}                              

Measured memory_bytes: 384
#include<bits/stdc++.h>
#define ll long long
#define fi first
#define se second
#define rep(i, j, k) for (auto i = j; i < k; i++)
#define rrep(i, j, k) for (auto i = j; i > k; i--)
using namespace std;

bool a[8000000];

void solve(int &m, int &n) {
  fill(a, a + 8000000, 0);
  int cnt = 0;
  rep(i, m, (int)1e8) {
    if (a[i]) continue;
    if (!a[i] && cnt >= n) {
      cout << i << endl;
      return;
    }
    cnt++;
    int now = i;
    while (now < 8000000) {
      a[now] = true;
      now += i;
    }
  }
}

int main() {
  int n, m;
  while (cin >> m >> n, n) solve(m, n);
}



Measured memory_bytes: 10896
bingo = [[int(i) for i in input().split()] for _ in range(3)]
n = int(input())

l = [int(input()) for _ in range(n)]
ans = [[0 for _ in range(3)] for _ in range(3)]

for i in l:
    for j in range(3):
        for k in range(3):
            if bingo[j][k] == i:
                ans[j][k] = 1
                break


flg = False
for i in range(3):
    if sum(ans[i]) == 3:
        flg = True
        break
    elif ans[0][i] + ans[1][i] + ans[2][i] == 3:
        flg = True
        break
    else:
        pass
    
if ans[0][0] + ans[1][1] + ans[2][2] == 3 or ans[0][2] + ans[1][1] + ans[2][0] == 3:
    flg = True
    
print('Yes' if flg else 'No')

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define   ll          long long int
#define   sz          200010
#define   sc(a)       scanf("%lld",&a)
#define   sc2(a,b)    scanf("%lld %lld",&a,&b)
#define   py          printf("Yes\n")
#define   pn          printf("No\n")
using namespace std;


int main()
{
    ll a,b,n,i,j;
    string x="",y="";
    cin>>n;
    string s;

    cin>>s;

    for(i=0;i<n/2;i++)x+=s[i];

    for(i=n/2;i<n;i++)y+=s[i];

    if(x==y)py;
    else
        pn;

    return 0;
}



Measured memory_bytes: 764
A = int(input())
B = int(input())
C = int(input())
X = int(input())
ans = 0
for a in range(A+1):
    for b in range(B+1):
        for c in range(C+1):
            if 500*(a)+100*(b)+50*(c) == X:
                ans += 1
print(ans)

Measured memory_bytes: 3064
import sys
if sys.argv[-1] == 'ONLINE_JUDGE':
    import os, zlib, base64
    open('solve.pyx', 'wb').write(zlib.decompress(base64.b85decode('c${rg(Qe`}5PV1CA68VSh7w|`-b01TeFbklgdBSV7LM)O4$!~9brMLb!!N+h?CkC=Pasu@O;kFpL349x_yIR!v6xPtKzzreH3Poact*W>OWdeT8KE1Ad#QZbe6pjhkqK)ehR981g|>ogrd7#YYxq{Yv!Eg_9Tz9E4a_vP`=%O?tT)SnSr-|P!b<eZ5cO_45fUrFYea9L^0tQAM=xL%nu`*r=n?<S!0;Laxg*Sa!E8O90KL{iI43j@0s5+aD*N2-dQEy`CQ~MYnGfXIDhXW5mT)<2;W}cs5SqHBbPnmm6FHr<15*g12vI5vLe<Xt2nUSf$bAmZleiiQoh!~LqV;!e_p=W|8LbR<9gxdxK3*}QWex&1u<GE;QE7zN(T*jNefMk*OZfdhaH=Bu16FG&$^0}B$x*-yyslsYWrur=4V^^X2cx)1)=ibe*XX;-Q()ITWpi8P#}%|ShaJ3>DpHlf%L6t`x2Px<MXkWopA!k9NmVS`tK@yV|7BmdkZ8Xjp{1wqa}Jn)fOUt;o_}fi*F5KK-*ob{(!AH94mh%Q4{WXvu-ghLBZB_{Vi^wI')))
    os.system('cythonize -i -3 -b solve.pyx')
import solve

Measured memory_bytes: 13904
N = int(input())

num = [[0] * 10 for i in range(10)]

for i in range(1, N+1):
    top = int(str(i)[0])
    end = int(str(i)[-1])
    num[top][end] += 1

count = 0
for i in range(10):
    for j in range(10):
        count += num[i][j] * num[j][i]

print(count)

Measured memory_bytes: 9072
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <climits>
#include <cmath>
#include <utility>
#include <string>
#include <cstring>
#include <functional>

using namespace std;

const int maxn = 1002, dir[4][2] = {{1,0},{-1,0},{0,1},{0,-1}};

int n, m, rem;
bool vis[maxn][maxn];

int main() {

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	queue<pair<int, int> > qu;
	
	cin >> n >> m;
	rem = n * m;

	for (int i = 0; i < n; ++i)
	{
		string s;
		cin >> s;
		for (int j = 0; j < m; ++j)
			if (s[j] == '#') {
				qu.push(make_pair(i, j));
				vis[i][j] = true;
				--rem;
			}
	}

	int ans = 0;
	while (rem && !qu.empty()) {
		++ans;

		int sz = qu.size();
		while (sz) {
			--sz;

			int x = qu.front().first, y = qu.front().second;
			qu.pop();
			
			for (int i = 0; i < 4; ++i) {
				int tx = x + dir[i][0], ty = y + dir[i][1];
				if (tx >= 0 && tx < n && ty >= 0 && ty < m && !vis[tx][ty]) {
					qu.push(make_pair(tx, ty));
					vis[tx][ty] = true;
					--rem;
				}
			}
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 9488
#include <cstdio>
#include <algorithm>
#define Abs(A) A > 0 ? A : -A
const int MaxN = 1e6 + 10;
int N, L, Ans, A[MaxN]; 
int Now;
int main() {
	scanf("%d%d", &N, &L);
	for(int i = 1; i <= N; i++) scanf("%d", &A[i]);
	for(int i = 1; i <= N; i++) 
		if(A[i] + A[i + 1] >= L) {
			Now = i;
			break;
		}
	int Cnt = 0;
	if(!Now) 
		puts("Impossible");
	else {
		puts("Possible");	
		for(int i = 1; i <= N - 1; i++) 
			if(i ^ Now) printf("%d\n", i);
			else break;
		for(int i = N - 1; i >= 1; i--) 
			if(i ^ Now) printf("%d\n", i);
			else break; 
		printf("%d\n", Now);
	}
}

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

int main() {
  char C;
  cin >> C;
  if(C=='a') {
    cout << 'b' << endl;
  }
  if(C=='b') {
    cout << 'c' << endl;
  }
  if(C=='c') {
    cout << 'd' << endl;
  }
  if(C=='d') {
    cout << 'e' << endl;
  }
  if(C=='e') {
    cout << 'f' << endl;
  }
  if(C=='f') {
    cout << 'g' << endl;
  }
  if(C=='g') {
    cout << 'h' << endl;
  }
  if(C=='h') {
    cout << 'i' << endl;
  }
  if(C=='i') {
    cout << 'j' << endl;
  }
  if(C=='j') {
    cout << 'k' << endl;
  }
  if(C=='k') {
    cout << 'l' << endl;
  }
  if(C=='i') {
    cout << 'm' << endl;
  }
  if(C=='m') {
    cout << 'n' << endl;
  }
  if(C=='n') {
    cout << 'o' << endl;
  }
  if(C=='o') {
    cout << 'p' << endl;
  }
  if(C=='p') {
    cout << 'q' << endl;
  }
  if(C=='q') {
    cout << 'r' << endl;
  }
  if(C=='r') {
    cout << 's' << endl;
  }
  if(C=='s') {
    cout << 't' << endl;
  }
  if(C=='t') {
    cout << 'u' << endl;
  }
  if(C=='u') {
    cout << 'v' << endl;
  }
  if(C=='v') {
    cout << 'w' << endl;
  }
  if(C=='w') {
    cout << 'x' << endl;
  }
  if(C=='x') {
    cout << 'y' << endl;
  }
  if(C=='y') {
    cout << 'z' << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
typedef vector<double> VD;
typedef vector<VD> VVD;

template<typename T> void chmin(T &a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T &a, T b) { if (a < b) a = b; }

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

int main() {
    ll n;
    cin >> n;
    set<ll> ans;
    for (ll x = 1; x * x <= n; x++){
        if (n % x) continue;
        ll y = n / x;
        if (x - 1 > y) ans.insert(x - 1);
        if (y - 1 > x) ans.insert(y - 1);
    }
    ll sum = 0;
    for (ll x : ans){
        sum += x;
    }
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
const int INF = 1001001001;

int main() {
string a,b,c;
cin >> a >> b >> c;
cout << char(a.at(0) - 32) << char(b.at(0) - 32) << char(c.at(0) - 32) << endl;




return 0;
}

Measured memory_bytes: 256
#include<algorithm>
#include<iomanip>
#include<iostream>
#include<map>
#include<set>
#include<stack>
#include<string>
#include<vector>
#include<bitset>
#include<cmath>
#define FOR(i,a,b) for(int i=(a); i<int(b); ++i)
#define RFOR(i,a,b) for(int i=(b)-1; i>=int(a); --i)
#define rep(i,n) FOR(i,0,n)
#define rep1(i,n) FOR(i,1,int(n)+1)
#define rrep(i, n) RFOR(i, 0, n)
#define rrep1(i, n) RFOR(i, 1, int(n) + 1)
#define all(c) begin(c), end(c)
#define al(d) d.begin(),d.end()
template <typename T>
using vec = std::vector<T>;
using vi = vec<int>;
using vvi = vec<vi>;
using pii = std::pair<int, int>;
using ll = long long;
using ld = long double;
using namespace std;
const int MOD = 1000000007;

template <typename T>
void putv(vector<T>& V){
	// cout << "The elements in the vector are: " << endl;
	for(auto x: V)
		cout << x << " ";
	cout << endl;
}
template <class T>
vector<T> getv(int n){
	vector<T> vec;
	rep(i,n){
		T input;
		cin >> input;
		vec.emplace_back(input);
	}
	return vec;
}

using AdjList = vector<vector<int>>;
using Weight = int;
using Flow = int;
struct Edge {
	int src, dst;
	Weight weight;
	Flow cap;
	Edge() : src(0), dst(0), weight(0) {}
	Edge(int s, int d, Weight w) : src(s), dst(d), weight(w) {}
};
using Edges = std::vector<Edge>;
using Graph = std::vector<Edges>;
using Array = std::vector<Weight>;
using Matrix = std::vector<Array>;
void add_edge(Graph &g, int a, int b, Weight w = 1) {
	g[a].emplace_back(a, b, w);
	g[b].emplace_back(b, a, w);
}
void add_arc(Graph &g, int a, int b, Weight w = 1) { g[a].emplace_back(a, b, w); }
// Recieve edge(=(int,int)) as an adj list.
AdjList getadj(int N, int M){
	// Initialize all lists of the graph as a empty vector.
	vector<int> init;
	vector<vector<int>> graph(N,init);
	rep(i,M){
		int a, b;
		cin >> a >> b;
		graph[a-1].emplace_back(b-1);
		graph[b-1].emplace_back(a-1);
	}
// rep(i,N)
// 	putv(graph[i]);
	return graph;
}

ll Manhattan_dist(ll x1, ll y1, ll x2, ll y2){
	return abs(x1-x2) + abs(y1-y2);
}
void out(bool ans){
	if(ans == true) cout << "yes" << endl;
	else cout << "no" << endl;
}
void Out(bool ans){
	if(ans == true) cout << "Yes" << endl;
	else cout << "No" << endl;
}
void OUT(bool ans){
	if(ans == true) cout << "YES" << endl;
	else cout << "NO" << endl;
}
ll gcd(const ll a, const ll b){
	return (b==0) ? a : gcd(b,a%b);
}
// $\min\{s\in\mathbb{N}:p^s|n\}$
ll hmt_p_divide_n(ll p, ll n){
	ll s = 0;
	while(n%p == 0){
		n /= p;
		s++;
	}
	return s;
}

// int dp(int n);
int dp[100010];
int main(){
	dp[0] = 0;
	for(int n = 1; n<=100000; n++){
		dp[n] = 100000;
		int power = 1;
		while(power <= n){
			dp[n] = min(dp[n], dp[n-power]+1);
			power *= 6;
		}
		power = 9;
		while(power <= n){
			dp[n] = min(dp[n], dp[n-power]+1);
			power *= 9;
		}
	}
	int N;
	cin >> N;
	cout << dp[N] << endl;
	return 0;
}

Measured memory_bytes: 640
#include <stdio.h>
int main()
{
 int a,b,c,d;
 scanf("%d%d", &a, &b);
 if(a >= 2 && a <= 13)
  c = a - 1;
 else
  c = 13;
 if(b >= 2 && b <= 13)
  d = b - 1;
 else
  d = 13;
 if(c > d)
  printf("Alice\n");
 else if(c < d)
  printf("Bob\n");
 else
  printf("Draw\n");
}

Measured memory_bytes: 128
//2020年4月17日現在

#include<stdio.h>
#include<cmath>
#include<math.h>
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<complex>
#include<queue>
#include<set>
#include<utility>
#include<iomanip>
#include<limits>
#include<thread>
#include<map>
#include<stack>
#include<numeric>
#include<cassert>
#include<random>
#include<chrono>
#include<unordered_set>
#include<unordered_map>
#include<fstream>
#include<list>
#include<functional>
#include<bitset>
#include<tuple>
#include<cstdio>
#include<ctime>
#include<cstdlib>

using namespace std;

template <class... A>
void prints() { cout << "\n"; }
template <class... A>
void prints_rest() { cout << "\n"; }
template <class T, class... A>
void prints_rest(const T &first, const A &... rest) { cout << " " << first; prints_rest(rest...); }
template <class T, class... A>
void prints(const T &first, const A &... rest) { cout << first; prints_rest(rest...); }
template <class T, class... A>
void printd(const T &first, const A &... rest) { cout << fixed << setprecision(15) << first; prints_rest(rest...); }


namespace {
	// printElems(&a[0], &a[n]);　みたいな感じで使う。
	void printElems(const int* begin, const int* end)
	{
		for (const int* p = begin; p != end; ++p) {
			std::cout << *p << ' ';
		}
		std::cout << std::endl;
	}
}

#define rep(i,n) for(int i=0; i<n; i++)
#define rep1(i,n) for(int i=1; i<n+1; i++)
#define repr(i,n) for(int i=n-1; i>=0; i--)
#define repr1(i,n) for(int i=n; i>0; i--)
#define FOR(i,j,n) for(int i=j; i < n; i++)
#define souatari(i,j,n) rep1(i,n-1)rep(j,i)
#define souatari1(i,j,n) for(int i=2; i<n+1; i++)rep1(j,i-1)
#define mp make_pair
#define F first
#define S second
#define elif else if

typedef long long ll;
typedef vector<int>  vi;
typedef vector<vi>  vvi;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<pii> vpii;
typedef array<int,3> arr3;
typedef long double D;


const ll llinf =  numeric_limits<ll>::max();
const ll _llinf = numeric_limits<ll>::lowest();
const int inf = numeric_limits<int>::max();
const int _inf = numeric_limits<int>::lowest();
const double dinf = numeric_limits<double>::infinity();
const ll MOD = 1000000007;
//const ll MOD = 998244353;
const ll BIG = 1LL<<60;

//--------------------------------------------------------


int c[30];
int s[400][30];
pii done[400][30];
int donepro[400];



int main(){
	chrono::system_clock::time_point start, end;
	double jikan;

    start = chrono::system_clock::now();

	int d;
	cin >> d;
	rep(i,26) cin >> c[i];
	rep(i,d)rep(j,26) cin >> s[i][j];
	srand(time(NULL));
	rep1(i,d) donepro[i] = rand()%26;
	rep1(i,d) prints(donepro[i]+1);






    end = chrono::system_clock::now();

    jikan = static_cast<double>(chrono::duration_cast<chrono::microseconds>(end - start).count() / 1000.0);



	return 0;
}




Measured memory_bytes: 3232
{-# OPTIONS_GHC -O2 -funbox-strict-fields #-}
import           Control.Monad         (replicateM)
import qualified Data.ByteString.Char8 as BC
import           Data.List             (minimum, sort)
import           Data.Maybe            (fromJust)

type Point = (Int, Int)
type Rect = (Point, Point)

main :: IO ()
main = do
  [n, k] <- getInts
  ps <- getPoints
  print $ solve n k ps

solve :: Int -> Int -> [Point] -> Integer
solve n k ps = minimum $ map area rs' where
  rs' = filter isValid rs
  rs  = [((x1, y1), (x2, y2)) | x1 <- xs
                              , x2 <- xs
                              , x1 < x2
                              , y1 <- ys
                              , y2 <- ys
                              , y1 < y2
                              ]
  (xs, ys) = (sort (map fst ps), sort (map snd ps))
  isValid r = length (filter (isIncluded r) ps) >= k

isIncluded :: Rect -> Point -> Bool
isIncluded ((x1, y1), (x2, y2)) (a, b) = x1 <= a && a <= x2 && y1 <= b && b <= y2

area :: Rect -> Integer
area ((x1, y1), (x2, y2)) = (x2' - x1') * (y2' - y1') where
  x1' = fromIntegral x1
  y1' = fromIntegral y1
  x2' = fromIntegral x2
  y2' = fromIntegral y2

readInts :: BC.ByteString -> [Int]
readInts = map (fst . fromJust . BC.readInt) . BC.words

getInts :: IO [Int]
getInts = readInts <$> BC.getLine

getIntss :: IO [[Int]]
getIntss = map readInts . BC.lines <$> BC.getContents

getPoints :: IO [Point]
getPoints = map (\[x, y] -> (x, y)) <$> getIntss


Measured memory_bytes: 2428
#include <iostream>
#include <string>
#include <list>

using namespace std;

void print_list(list<int> &V)
{
		for(list<int>::iterator it = V.begin();
			it != V.end();it ++)
		{
			if(it ==  V.begin()){
				cout << *it;
			}
			else{
				cout << " " << *it;
			}
		}
	cout << endl;
}
int main(void)
{	
	ios_base::sync_with_stdio(false);

	list<int> V;
	
	int n;
	cin >> n;

	for(int i = 0; i < n; i++){
		string s;
		cin >> s;
		
		int x;
		if(s == "insert"){
			cin >> x;
			//V.(V.begin(), x);
			V.push_front(x);
		}
		else if(s == "delete"){
			cin >> x;
			for(list<int>::iterator it = V.begin();
				it != V.end();it ++)
			{	
				if(*it == x){
					V.erase(it);
					break;
				}
			}
		}
		else if(s == "deleteFirst"){
			V.pop_front();
		}
		else{
			V.pop_back();
		}
	}
	print_list(V);
	
	return 0;
}

Measured memory_bytes: 34468
mod = 10 ** 9 + 7
fact = [i for i in range(10**5+1)]
fact[0] = 1
for i in range(10 ** 5):
  fact[i+1] *= fact[i]
  fact[i+1] %= mod
n,m = map(int,input().split())
if abs(n-m)>1:
  print(0)
else:
  if n!=m:
    print(fact[n]*fact[m]%mod)
  else:
    print(fact[n]*fact[m]*2%mod)


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

typedef long long ll;
typedef int64_t i6;

#define rep(i, n) for (ll i = 0; i < n; ++i)
#define rep2(i, n) for (ll i = 1; i <= n; ++i)
#define ALL(v) (v).begin(), (v).end()
#define Sort(x) sort(ALL(x))
#define Sort_rev(x) Sort(x);reverse(ALL(x))

template<typename V,typename T>
T find_num(V v, T num) {
    if ( find(ALL(v), num) == v.end() ) {
        return false;
    } else {
        return true;
    }
}

// π M_PI
// deg = rad*180/M_PI

double deg_to_rad( double deg ) {
    return (deg*M_PI)/180;
}

int main() {
    double a, b, h, m;
    cin >> a >> b >> h >> m;
    double hh = 360*h/12+(30*m/60);
    double mm = 360*m/60;
    double deg = abs(hh-mm);
    // cout << "a " << deg << endl;
    deg = min(deg, 360-deg);
    deg = deg_to_rad(deg);
    // cout << "deg " << cos(deg) << endl;
    double ans = a*a+b*b-2*a*b*cos(deg);
    // cout << "a" << ans << endl;
    ans = sqrt(ans);
    cout << setprecision(20) << ans << endl;
    return 0;
}


Measured memory_bytes: 4124
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <cmath>
#include <iomanip>
#include <algorithm>
using namespace std;

int main(){
    long long a, b;
    cin >> a >> b;
    long long A = min(a, b);
    long long B = max(a, b);
    if((A+B)%2 == 0){
        cout << (A+B)/2 << endl;
    } else {
        cout << "IMPOSSIBLE" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
N,A,B = input().split()

N = int(N)
A = int(A)
B = int(B)

def digitSum(n):
	s = str(n)
	array = list(map(int,s))
	return sum(array)

total = int(0)

for x in range(N+1):
	if(A <= digitSum(x) and digitSum(x) <= B):
		total += x

print(total)


Measured memory_bytes: 3060
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
using namespace std;
#define N 1000+20
int ans[4];
int main()
{
	string a;
	cin >> a;
	int len = a.length(),flag = 0;
	for (int i = 0; i < len; i++)
	{
		if (a[i] == 'N') ans[0] = 1;
		if (a[i] == 'S') ans[1] = 1;
		if (a[i] == 'W') ans[2] = 1;
		if (a[i] == 'E') ans[3] = 1;
	}
	if (ans[0] && ans[1] && ans[2] && ans[3]) flag = 1;
	if (ans[0] && ans[1] && !ans[2] && !ans[3]) flag = 1;
	if (!ans[0] && !ans[1] && ans[2] && ans[3]) flag = 1;
	if (flag) 
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}

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

int main()
{
    char s[4];
    scanf("%s",&s);
    int flag =0;
    for(int i=0;i<strlen(s)-1;i++){
        if(s[i]!=s[i+1])
        {
            flag=1;
            break;
        }
    }
    flag==1? printf("Yes"):printf("No");
    return 0;

    }


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
 
#define int long long int
#define vi vector<int>
#define vvi vector<vi>
#define read(a)  for(int i = 0; i < n; i++) cin >> a[i];
#define print(a)  for(int i = 0; i < n; i++) cout << a[i] << " ";
#define pb push_back
#define pql priority_queue<int>
#define pqs priority_queue<int, vi, greater<int>>
#define pqlv priority_queue<vi>
#define pqsv priority_queue<vi, vvi, greater<vi>>
// #define endl '\n'
#define N 10000002
#define MOD 1000000007
signed main() {
    int t = 1;
    // cin >> t;
    while(t--) {
        int n;
        cin >> n;
        int ans = 0;
        vi v(1e6 + 1, 0);
        vi a(n); read(a); sort(a.begin(), a.end());
        int prev = -1;
        for(int i = 0; i < n; i++) {
            int prev = a[i];
            if(i < n - 1 && a[i] == a[i + 1]) continue;
            if(i > 0 && a[i] == a[i - 1]);
            else if(!v[prev])    ans++;
            for(int j = prev; j <= 1e6; j += prev) {
                v[j] = 1;
            }
        }
        cout << ans << endl;
    }
} 

Measured memory_bytes: 12764
#include <iostream>
#include <vector>
#include <string>
#include <tuple>
#include <algorithm>
#include <numeric>
#include <climits>
#include <map>
#include <functional>
#include <cmath>
#include <cassert>
#include <set>

using namespace std;

int main()
{
    int n, k; cin >> n >> k;
    vector<int> x(n), y(n);
    for (int i = 0; i < n; i++) {
        cin >> x[i] >> y[i];
    }
    set<int> x1(x.begin(),x.end()), y1(y.begin(),y.end());
    vector<int> x2(x1.begin(),x1.end()),
        y2(y1.begin(),y1.end());

    long ans = LONG_MAX;
    for (int top = 0; top < y2.size() - 1; top++)
    for (int bottom = top + 1; bottom < y2.size(); bottom++)
    for (int left = 0; left < x2.size() - 1; left++)
    for (int right = left + 1; right < x2.size(); right++)
    {
        int count = 0;
        for (int i = 0; i < n; i++) {
            if (x[i] >= x2[left] && x[i] <= x2[right] &&
                y[i] >= y2[top] && y[i] <= y2[bottom])
                count++;
        }
        if (count >= k) {
            long area = (long)(x2[right] - x2[left]) *
                (y2[bottom] - y2[top]);
            ans = min(ans, area);
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#![allow(unused_imports)]
// use itertools::Itertools;
use proconio::{input, marker::*};

fn main() {
    input! {
        n: usize,
        x: usize,
        t: usize
    };
    println!("{}", (n / x + (n % x != 0) as usize) * t);
}


Measured memory_bytes: 2092
package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)

	var s string
	bucket := make(map[string]int, 4)
	for i := 0; i < n; i++ {
		fmt.Scan(&s)
		bucket[s]++
	}

	switch len(bucket) {
	case 3:
		fmt.Println("Three")
	default: // case 4:
		fmt.Println("Four")
	}
}


Measured memory_bytes: 512
#!/usr/bin/env python3
def main():
    import sys
    from collections import deque

    input = sys.stdin.readline

    N, M = map(int, input().split())
    G = [[] for _ in [0] * (N + 1)]
    for _ in [0] * M:
        a, b = map(int, input().split())
        G[a].append(b)
        G[b].append(a)
    
    q = deque([1])
    depth = [0 for _ in [0] * (N + 1)]
    while q:
        v = q.popleft()
        for nv in G[v]:
            if depth[nv] == 0:
                # depth[nv] = depth[v] + 1
                depth[nv] = v
                q.append(nv)
    if 0 in depth[2:]:
        print('No')
        return
    else:
        print('Yes')
        for guide in depth[2:]:
            print(guide)


if __name__ == '__main__':
    main()


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

void solveA(){
  int a,b;
  cin >> a >> b;

  if (b%a==0){
    cout << a+b << endl;
  }
  else {
    cout <<b-a << endl;
  }
}
void solveB(){  
}
void solveC(){
}
void solveD(){
}

int main(){
  solveA();
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline
n,m = input().split()
n = int(n)
m = int(m)
list = [[] for i in range(n)]
for i in range(n):
    list[i] = input().split()
    for j in range(int(list[i][0])):
        list[i][j] = int(list[i][j+1])
ans = 0
for i in range(m):
    flag = 1
    for j in range(n):
        if i+1 not in list[j]:
            flag = 0
    if flag == 1:
        ans += 1
print(ans)

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

using namespace std;

typedef long long ll;

const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = (ll)1e9 + 7;

int main()
{
  int N; scanf("%d", &N);
  ll T; scanf("%lld", &T);
  vector<ll> A(N + 1);
  for (int i = 0; i < N; ++i) {
    scanf("%lld", &A[i]);
  }
  A[N] = LLINF;
  ll ans = 0;
  for (int i = 0; i < N; ++i) {
    ans += min(A[i] + T, A[i + 1]) - A[i];
  }
  printf("%lld\n", ans);
  return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <cctype>
#include <string>

using namespace std;

int main(){
  int N, L;
  cin >> N >> L;
  string S, ans;
  vector<string> vec(N);

  for (int i = 0; i < N; i++){
    cin >> S;
    vec.at(i) = S;
  }

  sort(vec.begin(), vec.end());
  for (int i = 0; i < N; i++){
    ans += vec.at(i);
  }

  cout << ans << endl;

  return 0;
}


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

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            int r = int.Parse(Console.ReadLine());
            Console.WriteLine(r * r);

        }
    }

}

Measured memory_bytes: 13140
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        if (scanner.hasNextLine()) {
            String[] array = scanner.nextLine().split(" ");
            int a = Integer.parseInt(array[0]);
            int b = Integer.parseInt(array[1]);
            
            if (a <= b) {
                System.out.println(a);
            } else {
                System.out.println(a - 1);
            }
        }
    }
}

Measured memory_bytes: 21844
#include <math.h>
#include <stdio.h>
#include <bitset>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main() {
  int N;
  cin >> N;
  int count = 0;
  for (int i = 105; i <= N; i++) {
    if (i % 2 == 0) {
      continue;
    }
    int div = 0;
    for (int j = 1; j <= i; j++) {
      if (i % j == 0) {
        div++;
      }
    }
    if (div == 8) {
      count++;
    }
  }
  cout << count << endl;
}

Measured memory_bytes: 3600
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
using namespace std;

int N, a[10][10];
bool b[10][10];

int main() {
	for (int i = 0; i < 3; i++) {
		for (int j = 0; j < 3; j++) {
			scanf("%d", &a[i][j]);
		}
	}
	scanf("%d", &N);
	for (int i = 0; i < N; i++) {
		int temp;
		scanf("%d", &temp);
		for (int j = 0; j < 3; j++) {
			for (int k = 0; k < 3; k++) {
				if (a[j][k] == temp) {
					b[j][k] = true;
				}
			}
		}
	}
	if ((b[0][0] && b[0][1] && b[0][2]) || (b[1][0] && b[1][1] && b[1][2]) || (b[2][0] && b[2][1] && b[2][2])) {
		printf("Yes\n");
		return 0;
	}
	if ((b[0][0] && b[1][0] && b[2][0]) || (b[0][1] && b[1][1] && b[2][1]) || (b[0][2] && b[1][2] && b[2][2])) {
		printf("Yes\n");
		return 0;
	}
	if ((b[0][0] && b[1][1] && b[2][2]) || (b[0][2] && b[1][1] && b[2][0])) {
		printf("Yes\n");
		return 0;
	}
	printf("No\n");
	return 0;
}

Measured memory_bytes: 256