akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <numeric> 
using namespace std;
typedef long long ll;
const int INF = 1<<30; 
const int MOD = 1e9 + 7;
const int dx[] = {1, 0, -1, 0};
const int dy[] = {0, 1, 0, -1};
int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
    ll n, x, ans;
    cin >> n >> x;
    vector<ll> vec;
    for(int i = 0; i < n; i++)
    {
        ll a; cin >> a;
        vec.push_back(a);
    }
    vec.push_back(x);
    sort(vec.begin(), vec.end());
    for(int i = 0; i < vec.size() - 1; i++)
    {
        ll a = vec[i + 1] - vec[i];
        if(i > 0) ans = __gcd(a, ans);
        else ans = a;
    }
    cout << ans << endl;
	return 0;
}



Measured memory_bytes: 1400
//え？
//#pragma GCC optimize ("O3")
//#pragma GCC target ("avx2")
//#include<bits/stdc++.h>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const int CM = 1 << 17, CL = 12;
char cn[CM + CL], * ci = cn + CM + CL, * owa = cn + CM, ct;
const ll ma0 = 1157442765409226768;
const ll ma1 = 1085102592571150095;
const ll ma2 = 71777214294589695;
const ll ma3 = 281470681808895;
const ll ma4 = 4294967295;
inline int getint() {
	if (ci - owa > 0) {
		memcpy(cn, owa, CL);
		ci -= CM;
		fread(cn + CL, 1, CM, stdin);
	}
	ll tmp = *(ll*)ci;
	int dig = 68 - __builtin_ctzll((tmp & ma0) ^ ma0);
	tmp = tmp << dig & ma1;
	tmp = tmp * 10 + (tmp >> 8) & ma2;
	tmp = tmp * 100 + (tmp >> 16) & ma3;
	tmp = tmp * 10000 + (tmp >> 32) & ma4;
	ci += 72 - dig >> 3;
	return tmp;
}
inline int getintA() {
	if (ci - owa > 0) {
		memcpy(cn, owa, CL);
		ci -= CM;
		fread(cn + CL, 1, CM, stdin);
	}
	ll tmp = *(ll*)ci;
	int dig = ((tmp & ma0) ^ ma0) ? 68 - __builtin_ctzll((tmp & ma0) ^ ma0) : 0;
	tmp = tmp << dig & ma1;
	tmp = tmp * 10 + (tmp >> 8) & ma2;
	tmp = tmp * 100 + (tmp >> 16) & ma3;
	tmp = tmp * 10000 + (tmp >> 32) & ma4;
	ci += (64 - dig >> 3);
	while ((ct = *ci++) >= '0') tmp = tmp * 10 + ct - '0';
	return tmp;
}
char dn[1300000], *di = dn;
inline void putint(int X) {
	int keta = 0;
	char C[10];
	while (X) {
		*(C + keta) = '0' + X % 10;
		X /= 10;
		keta++;
	}
	for (int i = keta - 1; i >= 0; i--)* di++ = (*(C + i));
	*di++ = '\n';
}
int N;
int A[200001];
int E[400001], ne[400001], he[200001], it[200001];
int V[200001], v;
int S[200001], s;

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

	N = getint();
	rep1(i, N) A[i] = getintA();
	int k = 1;
	rep(i, N - 1) {
		int u = getint(), v = getint();
		E[k] = v;
		ne[k] = he[u];
		he[u] = k++;
		E[k] = u;
		ne[k] = he[v];
		he[v] = k++;
	}

	V[v++] = 2000000000;
	S[s++] = 1;
	while (s) {
		int p = S[s - 1];
		if (p > 0) {
			S[s - 1] = -p;
			if (V[v - 1] < A[p]) {
				it[p] = v;
				swap(V[v++], A[p]);
				for (auto to = he[p]; to; to = ne[to]) {
					if (he[E[to]] > 0) {
						S[s++] = E[to];
					}
				}
			}
			else {
				it[p] = lower_bound(V, V + v, A[p]) - V;
				swap(V[it[p]], A[p]);
				for (auto to = he[p]; to; to = ne[to]) {
					if (he[E[to]] > 0) {
						S[s++] = E[to];
					}
				}
			}
			he[p] = -v;
		}
		else {
			s--;
			p = -p;
			V[it[p]] = A[p];
			v -= !A[p];
		}
	}

	rep1(i, N) putint(-he[i]);
	fwrite(dn, 1, di - dn, stdout);

	Would you please return 0;
}

Measured memory_bytes: 10072
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static void Main(string[] args)
    {
        var input = Console.ReadLine().Split(' ');

        var N = int.Parse(input[0]);
        var K = int.Parse(input[1]);

        var S = Console.ReadLine().ToCharArray();
        var before = "";
        var now = "";
        var ans = 0;
        var single = 0;
        for (var i = 0; i < N; i++)
        {
            now = S[i].ToString();

            if(now == "L" && before == "R")
            {
                ans += 2;
            }

            if(i == 0 && now == "L")
            {
                ans += 1;
                single += 1;
            }

            if(i == N - 1 && now == "R")
            {
                ans += 1;
                single += 1;
            }

            before = now;

        }

        ans = ans - (K - single) * 2;

        if(ans == single)
        {
            ans = 0;
        }
        else if(ans > single)
        {
            ans = ans - single * 2;
        }
        else
        {
            ans = 0;
        }


        Console.WriteLine(ans == 0? N - 1: N - ans);
        Console.ReadLine();
    }


}


Measured memory_bytes: 13536
#include<stdio.h>
#include<math.h>
int main()
{
	int a,b,c,d;
	scanf("%d %d %d %d",&a,&b,&c,&d);
	if(abs(c-a+1)<=d*2)
		printf("Yes");
	else
		printf("No");
	return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<string>
using namespace std;
int main()
{
    string s;
    long long ans=0;
    cin>>s;
    for(int i=0;i<s.size();i++)
        ans+=(s[i]-'0');
    if(ans%9==0)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 3720
#include <bits/stdc++.h>
#define ll long long
#define double long double
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mod (ll)(1e9+7)
#define inf (ll)(3e18+7)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(x) x.begin(),x.end()
using namespace std;

int main(){
  string s;
  cin >> s;
  cout << s[0] << s.size()-2 << s[s.size()-1]; 
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
typedef pair<double,int>Q;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
int n,m,col[100005];
vector<int>edge[100005];
bool ok = 1;
int C = 0,D = 0;
void dfs(int v,int c){
	col[v] = c;
	if(c==0) C++; else D++;
	for(int i=0;i<edge[v].size();i++){
		if(col[edge[v][i]] != -1 && col[edge[v][i]] == c) ok = 0;
		if(col[edge[v][i]] == -1){
			dfs(edge[v][i],1-c);
		}
	}
}
int main(){
	cin>>n>>m;
	rep(i,m){
		int a,b;cin>>a>>b;a--;b--;
		edge[a].pb(b);
		edge[b].pb(a);
	}
	memset(col,-1,sizeof(col));
	rep(i,n){
		if(col[i] == -1) dfs(i,0);
	}
	if(!ok){
		cout<<1LL*n*(n-1)/2-m<<endl;
	}
	else{
		cout<<1LL*C*D-m<<endl;
	}
}

Measured memory_bytes: 6912
#!/usr/bin/env python3

def main():
    n, k, l = map(int, input().split())
    pq = get_edges(k)
    rs = get_edges(l)
    road_groups = get_group(n, pq)
    rail_groups = get_group(n, rs)
    count = {}
    for i in range(n):
        gp = (find(i, road_groups), find(i, rail_groups))
        if gp not in count:
            count[gp] = 1
        else:
            count[gp] += 1
    res = []
    for i in range(n):
        gp = (find(i, road_groups), find(i, rail_groups))
        res.append(count[gp])
    print(" ".join(map(str, res)))

def get_edges(k):
    pq = []
    for i in range(k):
        p1, q1 = map(int, input().split())
        pq.append((p1 - 1, q1 - 1))
    return pq

def get_group(n, edges):
    group = [i for i in range(n)]
    for x, y in edges:
        unite(x, y, group)
    return group

def unite(x, y, parents):
    px = find(x, parents)
    py = find(y, parents)
    parents[py] = px

def find(x, parents):
    if parents[x] == x:
        return x
    fx = find(parents[x], parents)
    parents[x] = fx
    return fx

main()


Measured memory_bytes: 85500
#include<iostream>
#include <cstring>
#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)
using ll = long long;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;


int main(){
  string S, T; cin >> S >> T;
  cout << T << S << endl;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

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

    int N = scanner.nextInt();
    Number[] numbers = new Number[N];
    for (int i = 0; i < N; i++) numbers[i] = new Number(i, scanner.nextInt());
    Arrays.sort(numbers, (n1, n2) -> n2.value - n1.value);

    long[][] dp = new long[N + 1][N + 1];
    for (int i = 0; i <= N; i++) {
      for (int j = 0; j <= N - i; j++) {
        if (i == 0 && j == 0) continue;
        Number a = numbers[i + j - 1];
        long left = 0;
        if (i > 0) left = dp[i - 1][j] + (long) a.value * (a.pos - i + 1);
        long right = 0;
        if (j > 0) right = dp[i][j - 1] + (long) a.value * (N - j - a.pos);
        dp[i][j] = Math.max(left, right);
      }
    }
    long max = 0;
    for (int i = 0; i <= N; i++) max = Math.max(max, dp[i][N - i]);
    System.out.println(max);
  }

  private static class Number {
    private final int pos;
    private final int value;

    private Number(int pos, int value) {
      this.pos = pos;
      this.value = value;
    }
  }
}


Measured memory_bytes: 79288
#include "bits/stdc++.h"
using namespace std;

#define REP(i, n) for(ll i = 0;i < n;i++)
#define REP1(i, n) for(ll i = 1;i < n;i++)
#define REPR(i, n) for(ll i = n-1;i >= 0;i--)
#define FOR(i, m, n) for(ll i = m;i < n;i++)

#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())

#define ll long long
#define ALL(a)  (a).begin(),(a).end()

#define pb(a) push_back(a)

int now,n,k=0;
vector<int> cc(100001);

vector<vector<pair<int, int>>> g;
const int N = 1e5;
int used[N];
int col[N];
int out[N];

void dfs(int i, int c) {
  if(used[i]) return;
  used[i] = 1;
  col[i] = cc[k];k++;
  for(auto to : g[i]) {
    dfs(to.first, c + to.second);
  }
}




int main() {
  cin>>n;
  g.resize(n*2);
  for(int i = 0; i < n-1; i++) {
    int a, b;
    cin >> a >> b;
    a--; b--;
    g[a].emplace_back(b, 1);
    g[b].emplace_back(a, 1);
  }

  
  REP(i,n)cin>>cc[i];

  sort(cc.begin(), cc.end(),greater<int>());
  
  ll mx=0;
REP(i,n-1){
  mx+=cc[i+1];
}
  cout<<mx<<endl;
  dfs(0, 0);


  REP(i,n){
    cout<<col[i]<<" ";
  }

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

Measured memory_bytes: 1920
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x)  cerr << #x << " = " << (x) << endl;
using namespace std;

template<typename T>
ostream& operator << (ostream& os, vector<T>& v){
	rep(i,v.size()){ os << v[i] << (i == v.size() - 1 ? "" : " "); } return os;
}
template<typename T>
istream& operator >> (istream& is, vector<T>& v){
	for(T& x: v){ is >> x; } return is;
}

#define int long long

class LCA{
	private:
		vector<vector<int>> g, parent;
		int n, root, log_n;
		bool inited;
		vector<int> depth;
		void dfs(int v, int p, int d){
			parent[0][v] = p;
			depth[v] = d;
			rep(i,g[v].size()){
				if(g[v][i] != p) dfs(g[v][i], v, d + 1);
			}
		}
		void init(){
			inited = true;
			dfs(root, -1, 0);
			rep(k,log_n - 1){
				rep(i,n){
					if(parent[k][i] < 0) parent[k + 1][i] = -1;
					else parent[k + 1][i] = parent[k][ parent[k][i] ];
				}
			}
		}
	public:
		LCA(int n, int root = 0) : g(n), parent(log2(n) + 1, vector<int>(n)), n(n), root(root), log_n(log2(n) + 1), inited(false), depth(n) { }
		void addEdge(int u, int v){
			g[u].emplace_back(v);
			g[v].emplace_back(u);
		}
		int get(int u, int v){
			if(not inited) init();
			if(depth[u] > depth[v]) swap(u, v);
			rep(k,log_n){
				if( (depth[v] - depth[u]) >> k & 1){
					v = parent[k][v];
				}
			}
			if(u == v) return u;
			for(int k = log_n - 1; k >= 0; k--){
				if(parent[k][u] != parent[k][v]){
					u = parent[k][u];
					v = parent[k][v];
				}
			}
			return parent[0][u];
		}
};

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

	vector<vector<int>> g(n);
	LCA lca(n);
	rep(i,n - 1){
		int p;
		cin >> p;
		p--;
		g[p].emplace_back(i + 1);
		lca.addEdge(i + 1, p);
	}

	queue<int> q;
	q.emplace(0);

	vector<int> dis(n);
	dis[0] = 0;

	vector<int> ord;
	while(not q.empty()){
		int pos = q.front(); q.pop();
		ord.emplace_back(pos);
		for(auto to : g[pos]){
			dis[to] = dis[pos] + 1;
			q.emplace(to);
		}
	}

	int ans = 0;
	rep(i,ord.size() - 1){
		ans += dis[ord[i]] + dis[ord[i + 1]] - 2 * dis[lca.get(ord[i], ord[i + 1])];
	}
	cout << ans << endl;
}



Measured memory_bytes: 34232
import queue
n = int(input())
h = list(map(int, input().split()))

q = queue.Queue()
ans = 0
def dec(ary):
  global q, ans
  m = min(ary)
  ans += m
  tmp = []
  for i in range(len(ary)):
    t = ary[i] - m
    if t > 0:
      tmp.append(t)
    else:
      if len(tmp) > 0:
        q.put(tmp)
      tmp = []
  if len(tmp) > 0:
    q.put(tmp)
tmp = []
for i in range(n):
  if h[i] > 0:
    tmp.append(h[i])
  else:
    if len(tmp) > 0:
      #print(tmp)
      q.put(tmp)
    tmp = []

if len(tmp) > 0:
  q.put(tmp)

while q.empty() == False:
  dec(q.get())
print(ans)

Measured memory_bytes: 75016
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include <numeric>
#include<map>
 
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<n; ++i)
#define ALL(a) (a).begin(),(a).end()

int  main(){
    ll x;
    cin >> x;

    ll ans = x/11 * 2;
    if(x%11 > 6)ans+=2;
    else if(x%11 > 0)ans++;

    cout << ans << endl;
    
    
}

Measured memory_bytes: 256
import sys
from math import ceil, floor, sqrt, sin, cos, pi
from itertools import accumulate, permutations, combinations
from fractions import gcd # 最大公約数
from collections import deque, Counter
from operator import itemgetter
from heapq import heappop,heappush
sys.setrecursionlimit(10**7)
def lcm(x, y): return ((x * y) // gcd(x, y)) # 最小公倍数
# list(map(int, input().split()))

n = int(input())
x = []
y = []
ans = 0
for k in range(n):
    i, j = map(int, input().split())
    x.append(i)
    y.append(j)
for i in range(n-1):
    for j in range(i+1, n):
        ans += sqrt((x[i] - x[j])**2 + (y[i]- y[j])**2)
ans = ans * 2 / n
print(ans)

Measured memory_bytes: 5052
// -*- coding: utf-8 -*-
// Last-Updated : <2014/06/19 00:45:07 by samui>

#include <algorithm>
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <climits>
#define MP(a, b) make_pair(a, b)
#define X first
#define Y second
#define rep(i,n) for(int (i) = 0; (i) < (int)(n); ++(i))
#define rer(i,l,n) for(int (i) = l; (i) <= (int)(n); ++(i))
#define reu(i,l,n) for(int (i) = l; (i) < (int)(n); ++(i))
template<typename T,typename U> inline void amin(T &x,U y){ if(y<x) x = y;}
template<typename T,typename U> inline void amax(T &x,U y){ if(x<y) x = y;}
template<typename TYPE,std::size_t SIZE>
std::size_t len(const TYPE (&array)[SIZE]){return SIZE;}
void abc(float x);
int main(int argc, char *argv[])
{
  float a;
  while(std::cin>>a){
    abc(a);
  }
  return 0;
}
void abc(float x)
{

  float t = x/9.8;
  float y = t*t*4.9;;
  float ans = int((y+5)/5.0);;
  while(ans*5-5<y)
    ++ans;
    std::cout<<ans<<std::endl;
}

Measured memory_bytes: 1272
import std.stdio;
import std.string;
import std.conv;
import std.typecons;
import std.algorithm;
import std.functional;
import std.bigint;
import std.numeric;
import std.array;
import std.math;
import std.range;
import std.container;
import std.ascii;
void times(alias pred)(int n) {
    foreach(i; 0..n) pred();
}
auto rep(alias pred, T = typeof(pred()))(int n) {
    T[] res = new T[n];
    foreach(ref e; res) e = pred();
    return res;
}

void main() {
    string a = "CODEFESTIVAL2016";
    string str = readln.chomp;
    int ans = 0;
    foreach(i; 0..a.length) {
        if (a[i]!=str[i])ans++;
    }
    ans.writeln;
}


Measured memory_bytes: 380
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;

const ll MAX = 1e7;

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

  vector<ll> divs(n + 10, 1);

  for (ll i = 2; i <= n; i++) {
    ll num = i;
    while (num <= n) {
      divs[num]++;
      num += i;
    }
  }

  ll ans = 0;
  for (int i = 1; i <= n; i++) {
    ans += i * divs[i];
  }
  cout << ans << endl;
}


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

void solve() 
{
    int n,k;cin>>n>>k;
    cout<<((n+1)/2>=k?"YES":"NO")<<endl;
}

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAX = 100 + 3;

int edge;
bool G[MAX][MAX];

inline void makeEdge(int i, int j)
{
	edge++;
	G[i][j] = true;
	G[j][i] = true;
	return;
}

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

	int n, k;
	cin >> n >> k;

	int mx = ((n-2)*(n-3))/2 + n-2;
	if(k>mx){
		cout << -1;
		return 0;
	}

	makeEdge(1, 2);
	for(int i = 3; i <= n; i++)
		makeEdge(2, i);

	int extra = mx-k;
	for(int i = 3; i <= n && extra>0; i++){
		for(int j = i+1; j <= n && extra>0; j++){
			makeEdge(i, j);
			extra--;
		}
	}
	for(int i = 3; i <= n && extra>0; i++){
		makeEdge(1, i);
		extra--;
	}

	int cnt = 0;
	cout << edge << "\n";
	for(int i = 1; i <= n; i++){
		for(int j = 1; j <= n; j++){
			if(G[i][j] == true){
				cout << i << " " << j << "\n";
				G[i][j] = false;
				G[j][i] = false;
				cnt++;
			}
		}
	}
	assert(cnt==edge);

	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan=new Scanner(System.in);
		int n=scan.nextInt(),a=scan.nextInt(),b=scan.nextInt();
		if(a*n<b) {
			System.out.println(a*n);
		}
		else {
			System.out.println(b);
		}

	}

}

Measured memory_bytes: 35772
#include<bits/stdc++.h>
#define io ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0)
typedef long long int ll;
using namespace std;
int gcd(int a,int b){
	if(b == 0)
		return a;
	else
		return gcd(b,a%b);
}
int g(int a,int b,int c){
	int d = gcd(a,b);
	return gcd(d,c);
}
int main(){
	io;
	int k;
	cin >> k;
	ll ans = 0;
	for(int i = 1;i <= k;++i){
		for(int j = 1;j <= k;++j){
			for(int t = 1;t <= k;++t){
				ans += g(i,j,t);
			}
		}
	}
	cout << ans;
	return 0;
}


Measured memory_bytes: 3652
n,d = gets.split.map(&:to_i)
x = n.times.map{gets.split.map(&:to_i)}
ans = 0
x.combination(2) do |i| 
  r2 = i[0].zip(i[1]).map{|a,b| (a-b)**2}.inject(:+)
  ans += 1 if Math.sqrt(r2).to_i**2 == r2
end 
p ans

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

const double eps = 1e-6;
 
int main(){
  int a, b;
  cin >> a >> b;
  if(a != 1 && b!= 1) cout << 1 << endl;
  if(a != 2 && b!= 2) cout << 2 << endl;
  if(a != 3 && b!= 3) cout << 3 << endl;
}

Measured memory_bytes: 3628
L, R = map(int, input().split())

minNum = 0
maxNum = 0
ans = 9999

tempL = int(L / 2019)
tempR = int(R / 2019)
if(tempL != tempR):
    ans = 0
else:
    for i in range(L, R):
        for j in range(L + 1, R + 1):
            ans = min(ans, (((i % 2019) * ( j % 2019)) % 2019))

print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
int main(){
    int64_t n,a,b;
    cin>>n>>a>>b;
    if(a==0 and b==0)cout<<0<<endl;
    else{
    int64_t ans1= n/(a+b)*a;
    int64_t ans2;
    if(n%(a+b)>=a) ans2=a;
    else ans2=n%(a+b);

    cout<<ans1+ans2<<endl;
    }



    }


Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main() {
	int a=0, b=0, c=0;
	int tmp[2];
	cin >> tmp[0] >> tmp[1];
	if (tmp[0] == 2 || tmp[1] == 2) {
	
		cout << "No" << endl;
		return 0;
	}
	else if (tmp[0] == 1 || tmp[0] == 3 || tmp[0] == 5 || tmp[0] == 7 || tmp[0]
		== 8 || tmp[0] == 10 || tmp[0] == 12) {
		if (tmp[1] == 1 || tmp[1] == 3 || tmp[1] == 5 || tmp[1] == 7 || tmp[1]
			== 8 || tmp[1] == 10 || tmp[1] == 12) {
			cout << "Yes" << endl;
			return 0;
		}
		else {
			cout << "No" << endl;
			return 0;
		}
	}
	else {
		if (tmp[1] == 4 || tmp[1] == 6 || tmp[1] == 9 || tmp[1] == 11) {
			cout << "Yes" << endl;
			return 0;
			}
		else {
			cout << "No" << endl;
			return 0;
		
		}
	
	}


}


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

using namespace std;

int main(void)
{
	int n, k;
	cin >> n >> k;
	string s; 
	cin >> s;
	for (int i = 0; i < n; i++) if (i == k - 1) s[i] += 32;
	cout << s;
	return (0);
}

Measured memory_bytes: 256
import bisect,collections,copy,heapq,itertools,math,string
import sys
def S(): return sys.stdin.readline().rstrip()
def M(): return map(int,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
N = I()
if N % 9 == 0:
    print('Yes')
else:
    print('No')

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

int main() {
  string N ; // 1000<=N<=9999 , N is Integer
  
  cin >> N ;

  if((N[0] == N[1] && N[1] == N[2]) || (N[1] == N[2] && N[2] == N[3])){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "debug.h"
#else
#define dump(...)
#endif
#define endl "\n"
#define ll long long
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define REP(i, x) for (int i = 0; i < (int)(x); i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); i++)
#define RREP(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define RREPS(i, x) for (int i = ((int)(x)); i > 0; i--)
#define INF 2147483647
#define LLINF 9223372036854775807LL
#define vi vector<int>
#define vvi vector<vector<int>>
#define pi pair<int, int>
#define ALL(a) (a).begin(), (a).end()
#define BIT(n) (1LL << (n))
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end()) //sortしてからつかうこと
constexpr ll MOD = 1e9 + 7;
int dx[8] = {1, 0, -1, 0, 1, 1, -1, -1};
int dy[8] = {0, 1, 0, -1, 1, -1, 1, -1};
ll A, B, C, D, E, F, G, H, N, M, L, K, P, Q, R, W, X, Y, Z;
string S, T;
ll ans = 0;

template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
    for (T &x : vec)
        is >> x;
    return is;
}
class hoge {
public:
    vector<ll> a, f;
    vector<ll> tmp;
    hoge() : a(N), f(N), tmp(N) {
        cin >> a >> f;
        sort(f.rbegin(), f.rend());
        sort(a.begin(), a.end());
    }

    bool isOK(ll index, ll key) {
        REP(i, N)
        tmp[i] = index / f[i];
        ll k = 0;
        REP(i, N) {
            if (a[i] > tmp[i]) {
                k += a[i] - tmp[i];
            }
        }
        dump(k, a, tmp);
        if (k <= key)
            return true;
        else
            return false;
    }

    ll binary_search(ll key) {
        ll ng = -1;       //「index = 0」が条件を満たすこともあるので、初期値は -1
        ll ok = (ll)1e15; // 「index = a.size()-1」が条件を満たさないこともあるので、初期値は a.size()
        /* ok と ng のどちらが大きいかわからないことを考慮 */
        while (abs(ok - ng) > 1) {
            ll mid = (ok + ng) / 2;
            if (isOK(mid, key))
                ok = mid;
            else
                ng = mid;
        }
        return ok;
    }
};

signed main() {
    cin >> N >> K;
    hoge h;
    cout << h.binary_search(K) << endl;
}

Measured memory_bytes: 7984
#include<stdio.h>
int main()
{
    char a[4][4];
    int i,j;
    for(i=0;i<3;i++)
    {
        for(j=0;j<3;j++)
       {
        scanf("%c",&a[i][j]);

        if(j==2)
            getchar();
       }
    }
for(i=0;i<3;i++)
    {

        printf("%c",a[i][i]);
    }

}


Measured memory_bytes: 128
#-*-coding:utf-8-*-
import itertools
import math

def main():
    lists = []
    N= int(input())
    lists=[list(map(int,input().split())) for _ in range(N)]
    ans=0
    length=0
    #permutationsは順列を列挙
    for line in itertools.permutations(lists):
        a = []
        b = []
        for data in line:
            if len(b) ==0:
                b = data
                continue
            else:
                a = b
                b = data
                length = math.sqrt(((b[0]-a[0])**2)+((b[1]-a[1])**2))
                ans+=length
    #factorical=階上の値
    print(ans/math.factorial(N))

if __name__ == "__main__":
    main()

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

using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;
using LL = long long;
using VL = vector<LL>;
using VVL = vector<VL>;
using PLL = pair<LL, LL>;
using VS = vector<string>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

#define FF first
#define SS second

#define DUMP(x) cout<<#x<<":"<<(x)<<endl
template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}
template<class T>
istream& operator>>(istream& is, vector<T>& xs){
  for(auto& x: xs)
	is >> x;
  return is;
}
template<class S, class T>
ostream& operator<<(ostream& os, const pair<S,T>& p){
  return os << p.FF << " " << p.SS;
}
template<class T>
ostream& operator<<(ostream& os, const vector<T>& xs){
  for(unsigned int i=0;i<xs.size();++i)
	os << (i?" ":"") << xs[i];
  return os;
}
template<class T>
void maxi(T& x, T y){
  if(x < y) x = y;
}
template<class T>
void mini(T& x, T y){
  if(x > y) x = y;
}


const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1e9+7;

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

  int N;
  cin >> N;
  VI cnt(5);
  string MARCH = "MARCH";
  REP(i,N){
	string s;
	cin >> s;
	REP(j,5)
	  if(s[0] == MARCH[j]){
		cnt[j]++;
		break;
	  }
  }

  LL ans = 0;
  for(int b=0;b<(1<<5);++b){
	if(__builtin_popcount(b) != 3) continue;
	LL p = 1;
	REP(i,5) if(b>>i&1) p *= cnt[i];
	ans += p;
  }
  cout << ans << endl;

  return 0;
}


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

using namespace std; 

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef pair<LL, LL> PLL;
typedef vector<PLL> VPLL;
typedef priority_queue<int> PQ_DESC;
typedef priority_queue<int, vector<int>, greater<int>> PQ_ASC;
typedef priority_queue<PII> PQ_DESC_PII;
typedef priority_queue<PII, vector<PII>, greater<PII>> PQ_ASC_PII;

#define ALL(c) (c).begin(),(c).end()
#define PB push_back
#define MP make_pair
#define SORT_ASC(c) sort(ALL(c))
//#define SORT_DESC(c) sort(ALL(c), greater<typeof(*((c).begin()))>())
#define SORT_DESC(c) sort((c).rbegin(),(c).rend())
#define REV(c) reverse((c).begin(), (c).end())
#define SIZE(a) int((a).size())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ROF(i,a,b) for(int i=(b-1);i>=(a);--i)
#define REP(i,n) FOR(i,0,n)
#define PER(i,n) ROF(i,0,n)

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int LARGE_INT = 1e9+100;
const int INF = 2e9+100;
const LL INF_LL = (LL)INF*(LL)INF;
const int MOD = 1e9+7;

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

LL modpow(LL a, LL n) {
    LL res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}

void Main()
{
    int a,b,h,m;cin>>a>>b>>h>>m;

    double hd = h*30.0+m*30.0/60.0;
    double md = m*6.0;

    double d=abs(hd-md);
    if(d>=180){
        d=360-d;
    }
    double r=180-d;
    r *= M_PI/180;

    double result = sqrt((b+a*cos(r))*(b+a*cos(r))+(a*sin(r))*(a*sin(r)));
    cout<<result<<endl;





	return;
}

int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
    return 0;
}

Measured memory_bytes: 4116
#include <stdio.h>

int main(void){
	int N, A;
	float bo=0;
	
	scanf("%d", &N);
	
	while(N>0){
		scanf("%d", &A);
		bo += 1/(float)A;
		N--;
	}
	printf("%f\n", 1.0/bo);
	
	return 0;
}

Measured memory_bytes: 128
import sys 
input=sys.stdin.readline
N,Q=map(int,input().split())
S=input()
move=[input().split() for i in range(Q)]
def check(i):
    now=i
    for m in move:
        if S[now]==m[0]:
            if m[1]=="L":
                now-=1
            else:
                now+=1
        if now<0:
            return -1
        if now>=N:
            return 1
    return 0
Lmin=-1
Lmax=N
Rmin=-1
Rmax=N
C={(1,2)}
while True:
    if len(C)==0:
        break
    c=C.pop()
    now=N*c[0]//c[1]
    x=check(now)
    if x==0:
        if Lmax>now:
            Lmax=now
            C|={(c[0]*2-1,c[1]*2)}
        if Rmin<now:
            Rmin=now
            C|={(c[0]*2+1,c[1]*2)}
    elif x==1:
        if now<Rmax:
            Rmax=now
            C|={(c[0]*2-1,c[1]*2)}
    elif x==-1:
        if Lmin<now:
            Lmin=now
            C|={(c[0]*2+1,c[1]*2)}
print(Rmax-Lmin-1)

Measured memory_bytes: 41332
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		long fact = factorial(sc.nextLong());
		System.out.println(fact);
	}
	
	public static long factorial(long fact){
		if(fact == 0){
			fact = 1;
		}else{
			for(long i = fact-1;i >= 1;i--){
				fact *= i;
			}
		}
		return fact;
	}
}

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

using namespace std;
int main(){
	int N, K;
	cin >> N >> K;

	vector<int> h(N);
	for(int index = 0; index < N; index++)
		cin >> h[index];

	vector<long long int> DP(N, LLONG_MAX);
	DP[0] = 0;
	for(int index = 0; index < N; index++){
		for(int index2 = 1; index2 <= K; index2++){
			if((index + index2) < N)
				DP[index + index2] = min(DP[index + index2], DP[index] + abs(h[index + index2] - h[index]));
			else break;
		}
	}
	cout << DP[N - 1];
	return 0;
}


Measured memory_bytes: 1408
use std::cmp::*;
use std::io::*;

fn main() {
    let mut s: String = String::new();
    std::io::stdin().read_to_string(&mut s).ok();
    let mut itr = s.trim().split_whitespace();
    let n: usize = itr.next().unwrap().parse().unwrap();
    let k: usize = itr.next().unwrap().parse().unwrap();
    let a: Vec<usize> = (0..n)
        .map(|_| itr.next().unwrap().parse().unwrap())
        .collect();
    let mut dp: Vec<bool> = vec![false; k + 1];
    dp[0] = false;
    for i in 1..k + 1 {
        for j in 0..n {
            if i >= a[j] && !dp[i - a[j]] {
                dp[i] = true;
                break;
            }
        }
    }
    if dp[k] {
        println!("First");
    } else {
        println!("Second");
    }
}


Measured memory_bytes: 4476
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigDecimal;
	
public class Main {

	/* several useful subroutines */
	private static BufferedReader brStdin = new BufferedReader(new InputStreamReader(System.in));
	private static String[] readBuf = null;
	private static int readPtr = 0;
	private static String getString() throws IOException {
		while ( readBuf == null || readPtr >= readBuf.length ) {
			readBuf = brStdin.readLine().split(" ");
			readPtr = 0;
		}
		return readBuf[readPtr++];
	}
	private static int getInt() throws IOException {
		return Integer.parseInt(getString());
	}
	private static long getLong() throws IOException {
		return Long.parseLong(getString());
	}
	private static BigDecimal getBD() throws IOException {
		return new BigDecimal(getString());
	}
	@SuppressWarnings("unused")
	private static String[] getStringArray(int size) throws IOException {
		String stringArray[] = new String[size];
		for (int i = 0; i < stringArray.length; i++) {
			stringArray[i] = getString();
		}
		return stringArray;
	}
	@SuppressWarnings("unused")
	private static int[] getIntArray(int size) throws IOException {
		int intArray[] = new int[size];
		for (int i = 0; i < intArray.length; i++) {
			intArray[i] = getInt();
		}
		return intArray;
	}
	@SuppressWarnings("unused")
	private static long[] getLongArray(int size) throws IOException {
		long longArray[] = new long[size];
		for (int i = 0; i < longArray.length; i++) {
			longArray[i] = getLong();
		}
		return longArray;
	}
	@SuppressWarnings("unused")
	private static BigDecimal[] getBDArray(int size) throws IOException {
		BigDecimal bdArray[] = new BigDecimal[size];
		for (int i = 0; i < bdArray.length; i++) {
			bdArray[i] = getBD();
		}
		return bdArray;
	}
	@SuppressWarnings("unused")
	private static long calculateLCM(long a, long b) throws IOException {
		if ( a  < b ) {
			long t = a;
			a = b;
			b = t;
		}
		while ( b > 0 ) {
			long t = b;
			b = a % b;
			a = t;
		}
		return a;
	}

	
	/* main routine */
	
	public static void main(String args[]) throws IOException {
		long x = getLong();
		int y = 0;
		for ( long d = 100 ; d < x ; y++ ) {
			d *= 1.01;
		}
		System.out.println( y );
	}
}


Measured memory_bytes: 32744
#include<iostream>
using namespace std;
int main()
{
    char S[4];
    int i, a=0;
    cin>>S;
    for(i=0;i<3;i++)
    {
        if(S[i]==S[i+1]){
            a=1;
            break;
        }
    }
    if(a==1)
        cout<<"Bad"<<endl;
    else
        cout<<"Good"<<endl;


    return 0;
}



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

typedef long double ll;

const long long MOD = 1000000007;
long long modpow(long long a, long long n, long long m)
{
    long long ans = 1;
    while (n)
    {
        if (n & 1)
        {
            ans = (ans * a) % m;
        }
        a = (a * a) % m;
        n >>= 1;
    }
    return ans;
}
long long combi(long long n, long long a)
{
    long long ans = 1, ans1 = 1;
    for (long long i = n - a + 1; i <= n; i++)
    {
        ans *= i % MOD;
        ans %= MOD;
    }

    for (long long i = 2; i <= a; i++)
        ans1 = (ans1 * i) % MOD;
    ans1 = modpow(ans1, MOD - 2, MOD);
    return ((ans % MOD) * ans1) % MOD;
}

int main()
{

    ll a, b, c;
    cin >> a >> b >> c;

    if (a+b+2.0*sqrt(a*b)<c)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }

    return 0;
}


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

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

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcount

#define INF 1e16
#define mod 1000000007

struct edge{
  int f,t,w;
};

ll A,B;
ll f[101][101];
ll dist[202][202];
ll d[10][10];
vector<edge> es;

int main(){
  cin>>A>>B;
  rep(i,A)rep(j,B)cin>>d[i][j];

  rep(i,101)rep(j,101){
    rep(a,A)rep(b,B){
      maxch(f[i][j],d[a][b]-i*(a+1)-j*(b+1));
    }
  }

  int S=0,T=201;
  rep(a,A)rep(b,B){
    rep(i,202)rep(j,202)dist[i][j]=(i==j?0:INF);
    rep(i,100)dist[i][i+1]=a+1;
    repl(i,101,201)dist[i][i+1]=b+1;
    rep(i,101)repl(j,101,202)dist[i][j]=f[i][201-j];
    rep(k,202)rep(i,202)rep(j,202)minch(dist[i][j],dist[i][k]+dist[k][j]);
    if(dist[S][T]!=d[a][b]){
      cout<<"Impossible"<<endl;
      return 0;
    }
  }
  cout<<"Possible"<<endl;
  rep(i,100)es.push_back((edge){i,i+1,-1});
  repl(i,101,201)es.push_back((edge){i,i+1,-2});
  rep(i,101)repl(j,101,202)es.push_back((edge){i,j,f[i][201-j]});
  cout<<202<<" "<<es.size()<<endl;
  rep(i,es.size()){
    cout<<es[i].f+1<<" "<<es[i].t+1<<" ";
    if(es[i].w==-1)cout<<"X";
    else if(es[i].w==-2)cout<<"Y";
    else cout<<es[i].w;
    cout<<endl;
  }
  cout<<S+1<<" "<<T+1<<endl;
  return 0;
}


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

using namespace std;
int main(){
  int n;
  cin >> n;
  int pre_time = 0;
  int pre_x = 0;
  int pre_y = 0;
  string ans="Yes";
  for(int i=0;i<n;i++){
    int t, x, y;
    cin >> t >> x >> y;
    int time_dif = t - pre_time;
    int check = time_dif - (abs(x - pre_x) + abs(y - pre_y));
    //cout << i << ":" << check << endl;
    if((check%2!=0)||check<0){
      ans = "No";
      break;
    }
    pre_x = x;
    pre_y = y;
    pre_time = t;
  }
  
  cout << ans << endl;
}


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


using namespace std;

int const size = 1e5 + 100;
vector < pair <int, int> > ed[size];
int coord[size];
int used[size];

bool dfs(int v){
	used[v] = 1;
	//cout << v << ' ' << coord[v] << endl;
	for (int i = 0; i < (int)ed[v].size(); i++){
		int u = ed[v][i].first;
		int d = ed[v][i].second;
		//cout << v << " -> " << u << ' ' << d << endl;
		if (used[u] == 0){
			coord[u] = coord[v] + d;
			if (!dfs(u))
				return false;
		}
		else if (coord[u] != coord[v] + d){
			return false;	
		}	
	}
	return true;

}

int main(){
	int n, m;
	cin >> n >> m;
	for (int i = 0; i < m; i++){
		int l, r, d;
		cin >> l >> r >> d;
		ed[l].push_back(make_pair(r, d));
		ed[r].push_back(make_pair(l, -d));
	}
	for (int i = 1; i < n+1; i++){
		if (used[i] == 0){
			if (dfs(i))
				continue;
			cout << "No";
			return 0;
		}
	}
	cout << "Yes";
	return 0;
}

Measured memory_bytes: 12416
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
   int n=sc.nextInt();
    int cnt=0;
    int max=-1;
    int val=0;
    for(int i=1; i<=n; i++){
      int element=i;
      boolean ok=true;
      while(ok){
        if(element%2==0){
          cnt++;
          element=element/2;
        }else{
          ok=false;
        }
      }
      if(max<cnt){
        max=cnt;
        val=i;
      }
      cnt=0;
    }
    System.out.println(val);
  }
}

Measured memory_bytes: 23892
#include<bits/stdc++.h>
const int N=1e6+5,mo=1e9+7;
int f[N][3],i,k,l,fac[N],vf[N],inv[N],n,ans;
inline int C(int n,int m){return 1ll*vf[m]*vf[n-m]%mo*fac[n]%mo;}
int main(){
	for(i=*vf=*fac=1;i<N;++i)
		inv[i]=i==1?1:1ll*(mo-mo/i)*inv[mo%i]%mo,
		vf[i]=1ll*vf[i-1]*inv[i]%mo,
		fac[i]=1ll*fac[i-1]*i%mo;
	scanf("%d",&n);
	f[0][0]=1;
	for(i=0;i<n;++i)for(k=0;k<3;++k)for(l=0;l<3;++l)if(k!=l)
		f[i+1][l]=(f[i+1][l]+f[i][k])%mo;
	for(i=1;i<=n;++i)ans=(ans+1ll*C(n,i)*f[i][1]%mo*inv[i])%mo;
	for(i=1;i<=n;++i)ans=1ll*ans*inv[3]%mo;ans=1ll*ans*inv[n]%mo;
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 23680
a,o,r = 0,0,0
while 1:
    s = sorted(list(map(int,input().split())))
    if(sum(s[:2]) <= s[2]): break
    b = s[0]**2 + s[1]**2 - s[2]**2
    if b > 0: a+=1
    elif b < 0:o+=1
    else: r+=1         
print(sum([a,o,r]),r,a,o)

Measured memory_bytes: 7668
#include <stdio.h>
#include <algorithm>
#include <bitset>

const int MOD = 998244353;

int main() {
  int N, M; scanf("%d%d", &N, &M);
  std::bitset<300> A[300];
  for(int i = 0; i < N; ++i) {
    for(int j = 0; j < M; ++j) {
      int a; scanf("%d", &a);
      A[i][j] = a;
    }
  }
  int r = 0;
  for(int j = 0; j < M; ++j) {
    int min_i = N;
    for(int i = r; i < N; ++i) {
      if(A[i][j]) {
        min_i = i;
        break;
      }
    }
    if(min_i == N) continue;
    if(min_i > r) {
      A[r] ^= A[min_i];
    }
    for(int i = r + 1; i < N; ++i) {
      if(A[i][j]) {
        A[i] ^= A[r];
      }
    }
    ++r;
  }
  // fprintf(stderr, "r = %d\n", r);
  int count = 1;
  for(int i = 0; i < r; ++i) count = 2 * count % MOD;
  --count; if(count < 0) count += MOD;
  for(int i = r; i < N + M - 1; ++i) count = 2 * count % MOD;
  printf("%d\n", count);
  return 0;
}


Measured memory_bytes: 128
#include <string>
#include <vector>
#include <iostream>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <functional>
#include <utility>
#include <map>
using namespace std;


#define prec(i) cout << fixed << setprecision(i)

const long long int MOD = 1000000007;


int ctoi(char c) {
	if (c >= '0' && c <= '9')
		return c - '0';
	else
		return -1;
}

int main()
{
	bool b = true;
	string s;

	cin >> s;

	for (int i = 0; i < s.length(); i++) {
		if ((i + 1) % 2 == 1 && s[i] == 'L')
			b = false;
		else if((i + 1) % 2 == 0 && s[i] == 'R')
			b = false;

		if (!b)
			break;
	}

	if (b)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;

	return 0;

}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <queue>
#include <cmath>
#include <map>
#include <iomanip>

using namespace std;
typedef long long  ll;

int main() {
	ll N, P;
	cin >> N >> P;
	bool flag = true;
	ll ans = 1;
	for (ll i = 0; i < N; i++)
	{
		ll temp = 0;
		cin >> temp;
		if (temp % 2) flag = false;
		ans *= 2;
	}
	ans /= 2;
	if (flag) {
		if (P == 1) {
			cout << 0 << endl;
		}
		else {
			cout << ans * 2 << endl;
		}
	}
	else {
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 256
alpabet=['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
inn=input()

for i in range(len(alpabet)):
    if alpabet[i]==inn:
        print(alpabet[i+1])
        break


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

#define l long 
using namespace std;

int solve(int idx , int n , vector<vector<int>>&dp ,vector<vector<int>>&act , int check)
{

    if(idx >= n)
      return 0;
    
    if(dp[idx][check] != -1)
     return  dp[idx][check];

    int op1 = -1e7;
    int op2 = -1e7;
    int op3 = -1e7;
   
   if(check != 0)
    op1 = solve(idx+ 1, n , dp , act , 0) + act[idx][0];
   
   if(check != 1)
    op2 = solve(idx +1 , n , dp , act , 1) + act[idx][1];

    if(check != 2)
    op3 = solve(idx + 1, n , dp , act , 2)+ act[idx][2];


    dp[idx][check] = max(op1 ,max(op2 , op3));
    
    return dp[idx][check];
}

int main()
{
     

    int n;
    cin>>n;

    vector<vector<int>>act(n , vector<int>(3));
    for(int i = 0 ;i<n ;i++)
    {
        int a,b,c;
        cin>>a>>b>>c;
        act[i][0] = a;
        act[i][1] = b;
        act[i][2] = c;
    }


    vector<vector<int>>dp(n +1 , vector<int>(4 , -1));

    int ans = solve(0 , n , dp , act , 3);
    /*for(int i = 0 ;i<n+1 ;i++)
    {
        for(int j = 0 ;j<4 ;j++)
         cout<<dp[i][j]<<" ";
        
        cout<<"\n";
    }*/
    cout<<ans<<endl;
    return 0;

}

Measured memory_bytes: 21936
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define trav(var, container) for(auto& var: container)
#define all(x) x.begin(), x.end()
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define sz(x) (int)x.size()
using namespace std;
using namespace __gnu_pbds;
using ld = long double; 
using ll = long long;
using vi = vector<int>;
using pii = pair<int, int>;
struct chash { // large odd number for C
    const uint64_t C = ll(4e18 * acos(0)) | 71;
    ll operator()(ll x) const { return __builtin_bswap64(x*C); }
};
const int MOD = (int)1e9 + 7;
const int MAXN = 1000;
bitset<MAXN + 1> is_prime;
vector<int> primes;
void gen_primes() {
	is_prime.set();
	is_prime[0] = is_prime[1] = false;
	for(int i = 2; i <= MAXN; ++i) {
		if(is_prime[i]) {
			primes.emplace_back(i);
			for(int j = 2 * i; j <= MAXN; j += i) {
				is_prime[j] = false;
			}
		}
	}
}

int main() {
	ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
	gen_primes();
	int n;
	cin >> n;	
	ll ans = 1;
	for(int& prime: primes) {
		int cnt = 0;
		for(int i = prime; i <= n; i += prime) {
			int x = i;
			while(x % prime == 0) {
				x /= prime;
				++cnt;
			}
		}
		ans *= cnt + 1;
		ans %= MOD;
	}
	cout << ans;
	return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define REP(x,y,z) for(int x=y;x<=z;x++)
#define MSET(x,y) memset(x,y,sizeof(x))
#define M 105
using namespace std;

int n,m,in[M];
bool dp[100005];
int main()
{
    while (~scanf("%d%d",&n,&m)) {
        REP(i,1,n) scanf("%d",&in[i]);

        MSET(dp, false);
        REP(i,1,m)REP(j,1,n) {
            if (i>=in[j] && !dp[i-in[j]]) dp[i] = true;
        }
        puts(dp[m]?"First":"Second");
    }
    
    return 0;
}




Measured memory_bytes: 384
import math
a, b, c = map(lambda x: float(x), input().split(" "))
h = math.sin(math.radians(c)) * b
S = a * h / 2.0
L = a + b + math.sqrt(a ** 2 + b ** 2 - 2 * a * b * math.cos(math.radians(c)))
print(S)
print(L)
print(h)



Measured memory_bytes: 5696
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define MOD 1000000007
#define INF (1<<30)
#define LINF (1LL<<60)
#define endl "\n"
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define Flag(x) (1<<(x))
#define Flagcount(x) __builtin_popcount(x)
#define pint pair<int,int>
#define pdouble pair<double,double>
typedef unsigned long long int ull;
typedef long long lint;

multiset<lint> decomp(lint N){
    multiset<lint> res;
    for(int i=2;i<=100;i++){
        while(N%i==0) N/=i,res.insert(i);
        if(N==1) break;
        if(i==100) res.insert(N);
    }
    return res; 
}

int main(void){
    lint N;
    cin >> N;
    lint ans[1010]={};
    multiset<lint> div;
    while(N>1){
        div=decomp(N);
        while(!div.empty()){
            auto itr=div.begin();
            ans[*itr]++;
            div.erase(itr);
        }
        N--;
    }
    lint answer=1;
    for(int i=2;i<=1000;i++){
        answer=(answer*(ans[i]+1))%MOD;
    }
    cout << answer << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds; 
using ll = long long int;
#define INF             1e14
#define dd              double
#define MOD             1000000007
#define my_sizeof(type) ((char *)(&type+1)-(char*)(&type)) 
#define nl              cout<<endl
#define fill(a,val)     memset(a,val,sizeof(a))
#define mp              make_pair
#define endl            "\n"
#define pb              push_back
#define ff              first    
#define ss              second
#define SIZE            200005
#define all(v)          v.begin(),v.end()
#define s(ar,n)         sort(ar,ar+n)
#define rs(ar,n)        sort(ar, ar+n, greater<ll>()) 
#define oa(a,n)         for(ll i=0;i<n;i++)cout<<a[i]<<" ";nl
#define cn(a,n)         for(ll i=0;i<n;i++)cin>>a[i];
#define maxa(ar,N)      *max_element(ar,ar+N)
#define mina(ar,N)      *min_element(ar,ar+N)
#define fastio()        ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define printclock      cerr<<"Time : "<<1000*(long double)clock()/(long double)CLOCKS_PER_SEC<<"ms\n";
typedef tree<pair<ll,ll>, null_type, less<pair<ll,ll>>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
// find_by_order() - 0 indexing
// order_of_key() - number of elements strictly smaller
ll power(ll x, ll y){
    ll res=1;x=x;
    while(y>0){
        if(y&1)
            res = (res*x);
        y = y>>1;
        x = (x*x);
    }
    return res;
}  
ll logtwo(ll n){
    if(n==1)
        return 0;
    return logtwo(n/2)+1;
}
//---------------------------------------GL HF------------------------------------------------------
// -------------------------------------ManavJ07----------------------------------------------------
signed main()
{
    fastio();   
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif
    int t=1;
    //cin>>t;
    while(t--)
    {
        ll a;
        for(ll i=1;i<=5;i++){
            cin>>a;
            if(a==0){

                cout<<i;
                return 0;
            }
        }
    }
}

Measured memory_bytes: 3612