akhauriyash/Code-Regression huggingface dataset:
#include <vector>
#include <iostream>
#include <cmath>
#include <map>
#include <algorithm>
#include <fstream>
#include <unistd.h>
#include <string>
#include <numeric>
#include <queue>
#include <deque>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
typedef vector<P> vp;
typedef vector<PL> vpl;
typedef vector<vector<P>> vvp;
const int INF = 1001001001;
const ll LINF = 1e18;
const string endstr = "\n";
#define FOR(i, a, b) for(ll i = (a); i < b; i++)
#define REP(i, n) for(ll i = 0; i < n; i++)

template <typename T>
T gcd(T a, T b) {
    return (a == 0) ? b : gcd(b%a, a);
}
template <typename T>
T lcm(T a, T b) {
    return a / gcd(a, b) * b;
}

bool p_comp_fs(const P p1, const P p2){ return p1.first < p2.first;};
bool p_comp_fg(const P p1, const P p2){ return p1.first > p2.first;};
bool p_comp_ss(const P p1, const P p2){ return p1.second < p2.second;};
bool p_comp_sg(const P p1, const P p2){ return p1.second > p2.second;};
template <typename T>
vector<T> uniquen(vector<T> vec){
    vec.erase(unique(vec.begin(), vec.end()), vec.end());
    return vec;
}


int main(){
    ll N; cin >> N;
    deque<ll> as;
    REP(i, N){
        ll a; cin >> a;
        if(N % 2 == 0){
            if(i % 2 == 0) as.push_back(a);
            else as.push_front(a);
        }
        else{
            if(i % 2 != 0) as.push_back(a);
            else as.push_front(a);
        }
    }
    
    string ret_str;
    REP(i, N){
        ret_str += to_string(as[i]) + " ";
    }
    cout << ret_str << endstr;
    return 0;
}


Measured memory_bytes: 5892
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		int nmax = 200000;
		int[] fact = new int[nmax + 1];
		fact[0] = 1;
		for (int i = 1; i <= nmax; i++) {
			fact[i] = (int) ((long) fact[i - 1] * i % PRIME);
		}

		Scanner scanner = new Scanner(System.in);

		int n = scanner.nextInt();
		int k = scanner.nextInt();

		int imax = k < n - 1 ? k : n - 1;

		int sum = 0;

		for (int i = 0; i <= imax; i++) {
			long comb = (long) fact[n] * fact[n - 1] % PRIME;
			comb = comb * inverse(fact[i]) % PRIME;
			comb = comb * inverse(fact[i]) % PRIME;
			comb = comb * inverse(fact[n - i]) % PRIME;
			comb = comb * inverse(fact[n - 1 - i]) % PRIME;

			sum = (sum + (int) comb) % PRIME;
		}

		while (sum < 0)
			sum += PRIME;

		System.out.println(sum);
	}

	static int fact(int n) {
		if (n == 1)
			return 1;
		return (int) ((long) n * fact(n - 1) % PRIME);
	}

	static int comb(int n, int k) {
		long numer = 1, denom = 1;
		int l = n - k < k ? n - k : k;

		for (int i = 0; i < l; i++) {
			numer = (numer * (n - i) % PRIME) * (n - i - 1) % PRIME;
			denom = (denom * (i + 1) % PRIME) * (i + 1) % PRIME;
		}

		//		long comb = (long) fact(n) * inverse(fact(k)) % PRIME;
		//		comb = comb * inverse(fact(n - k)) % PRIME;
		return (int) (numer * inverse((int) denom) % PRIME);

	}

	static int inverse(int denom) {
		if (denom == 0)
			return 0;

		int a = PRIME;
		int b = denom;
		int x = 0;
		int y = 1;
		int temp;

		while (a % b != 0) {
			x -= a / b * y;
			temp = x;
			x = y;
			y = temp;
			temp = a % b;
			a = b;
			b = temp;
		}

		//		while (y < 0)
		//			y += PRIME;

		return y;
	}

	static final int PRIME = 1000000007;

}


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

x_fix_max = None
x_fix_min = None
x_inc_max = None
x_inc_min = None
x_dec_max = None
x_dec_min = None

y_fix_max = None
y_fix_min = None
y_inc_max = None
y_inc_min = None
y_dec_max = None
y_dec_min = None

for i in range(n):
    x, y, d = [a for a in input().split()]
    if d == "R":
        if x_inc_max is None or x_inc_max < int(x):
            x_inc_max = int(x)
        if x_inc_min is None or x_inc_min > int(x):
            x_inc_min = int(x)
        if y_fix_max is None or y_fix_max < int(y):
            y_fix_max = int(y)
        if y_fix_min is None or y_fix_min > int(y):
            y_fix_min = int(y)
    if d == "L":
        if x_dec_max is None or x_dec_max < int(x):
            x_dec_max = int(x)
        if x_dec_min is None or x_dec_min > int(x):
            x_dec_min = int(x)
        if y_fix_max is None or y_fix_max < int(y):
            y_fix_max = int(y)
        if y_fix_min is None or y_fix_min > int(y):
            y_fix_min = int(y)
    if d == "U":
        if y_inc_max is None or y_inc_max < int(y):
            y_inc_max = int(y)
        if y_inc_min is None or y_inc_min > int(y):
            y_inc_min = int(y)
        if x_fix_max is None or x_fix_max < int(x):
            x_fix_max = int(x)
        if x_fix_min is None or x_fix_min > int(x):
            x_fix_min = int(x)
    if d == "D":
        if y_dec_max is None or y_dec_max < int(y):
            y_dec_max = int(y)
        if y_dec_min is None or y_dec_min > int(y):
            y_dec_min = int(y)
        if x_fix_max is None or x_fix_max < int(x):
            x_fix_max = int(x)
        if x_fix_min is None or x_fix_min > int(x):
            x_fix_min = int(x)

if x_inc_min is None:
    x_inc_min = 10 ** 10
if x_dec_min is None:
    x_dec_min = 10 ** 10
if x_fix_min is None:
    x_fix_min = 10 ** 10
if x_inc_max is None:
    x_inc_max = -10 ** 10
if x_dec_max is None:
    x_dec_max = -10 ** 10
if x_fix_max is None:
    x_fix_max = -10 ** 10
if y_inc_min is None:
    y_inc_min = 10 ** 10
if y_dec_min is None:
    y_dec_min = 10 ** 10
if y_fix_min is None:
    y_fix_min = 10 ** 10
if y_inc_max is None:
    y_inc_max = -10 ** 10
if y_dec_max is None:
    y_dec_max = -10 ** 10
if y_fix_max is None:
    y_fix_max = -10 ** 10

t_list = [0]
t_list += [-x_inc_max + x_fix_max, x_dec_max - x_fix_max, (x_dec_max - x_inc_max) / 2]
t_list += [-y_inc_max + y_fix_max, y_dec_max - y_fix_max, (y_dec_max - y_inc_max) / 2]
t_list += [-x_inc_min + x_fix_min, x_dec_min - x_fix_min, (x_dec_min - x_inc_min) / 2]
t_list += [-y_inc_min + y_fix_min, y_dec_min - y_fix_min, (y_dec_min - y_inc_min) / 2]


min_mult = None
for t in t_list:
    if t < 0:
        continue
    x_max = max(x_inc_max + t, x_fix_max, x_dec_max - t)
    x_min = min(x_inc_min + t, x_fix_min, x_dec_min - t)
    y_max = max(y_inc_max + t, y_fix_max, y_dec_max - t)
    y_min = min(y_inc_min + t, y_fix_min, y_dec_min - t)
    mult = (x_max - x_min) * (y_max - y_min)
    if min_mult is None or min_mult > mult:
        min_mult = mult
print(str(min_mult))


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

if N<10:
    print(N)
elif 10<=N and N<100:
    print(9)
elif 100<=N and N<1000:
    print(9+(N-99))
elif 1000<=N and N<10000:
    print(900+9)
elif 10000<=N and N<100000:
    print(909+(N-9999))
elif N==100000:
    print(90000+900+9)


Measured memory_bytes: 2940
import scala.io.Source
import scala.math.sqrt

object Main extends App {
  val Array(x1: Double, y1: Double, x2: Double, y2: Double) = Source.stdin.getLines.next.split(" ").map(_.toDouble)

  val v = sqrt((x2-x1)*(x2-x1) + (y2-y1)*(y2-y1))
  println(v)
}

Measured memory_bytes: 44160
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>

using namespace std;

//----------------------- Print Function ----------------------//

inline void print() {
    cout << endl;
}
template <typename First, typename... Rest>
void print(const First &first, const Rest &... rest) {
    cout << first << ' ';
    print(rest...);
}

template <typename T>
void print(const vector<T> &v) {
    for (auto e : v) cout << e << ' ';
    cout << endl;
}

//------------------------- Libraries -------------------------//

template<int MOD> struct Fp {
    long long val;
    constexpr Fp(long long v = 0) noexcept : val(v % MOD) {
        if (val < 0) val += MOD;
    }
    constexpr int getmod() { return MOD; }
    constexpr Fp operator - () const noexcept {
        return val ? MOD - val : 0;
    }
    constexpr Fp operator + (const Fp& r) const noexcept { return Fp(*this) += r; }
    constexpr Fp operator - (const Fp& r) const noexcept { return Fp(*this) -= r; }
    constexpr Fp operator * (const Fp& r) const noexcept { return Fp(*this) *= r; }
    constexpr Fp operator / (const Fp& r) const noexcept { return Fp(*this) /= r; }
    constexpr Fp& operator += (const Fp& r) noexcept {
        val += r.val;
        if (val >= MOD) val -= MOD;
        return *this;
    }
    constexpr Fp& operator -= (const Fp& r) noexcept {
        val -= r.val;
        if (val < 0) val += MOD;
        return *this;
    }
    constexpr Fp& operator *= (const Fp& r) noexcept {
        val = val * r.val % MOD;
        return *this;
    }
    constexpr Fp& operator /= (const Fp& r) noexcept {
        long long a = r.val, b = MOD, u = 1, v = 0;
        while (b) {
            long long t = a / b;
            a -= t * b; swap(a, b);
            u -= t * v; swap(u, v);
        }
        val = val * u % MOD;
        if (val < 0) val += MOD;
        return *this;
    }
    constexpr bool operator == (const Fp& r) const noexcept {
        return this->val == r.val;
    }
    constexpr bool operator != (const Fp& r) const noexcept {
        return this->val != r.val;
    }
    friend constexpr ostream& operator << (ostream &os, const Fp<MOD>& x) noexcept {
        return os << x.val;
    }
    friend constexpr Fp<MOD> modpow(const Fp<MOD> &a, long long n) noexcept {
        if (n == 0) return 1;
        auto t = modpow(a, n / 2);
        t = t * t;
        if (n & 1) t = t * a;
        return t;
    }
};
using mint = Fp<1000000007>;

//--------------------------- Solve ---------------------------//

void solve() {
    int N; cin >> N;

    vector<long long> prime(N+1);
    for (int i = 1; i <= N; i++) {
        int n = i;
        for (int a = 2; a*a <= n; a++) {
            if (n % a != 0) continue;
            int ex = 0;
            while (n % a == 0) {
                prime[a]++;
                n /= a;
            }
        }
        if (n != 1) prime[n]++;
    }

    mint ans = 1;
    for (int i = 1; i <= N; i++) {
        ans *= prime[i] + 1;
    }
    
    cout << ans << '\n';
}

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

    solve();

    return 0;
}

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

int main(){
	string s;
	int c_num[2];
	int c_pos[2][1000];
	string c[2];
	c[1]="apple";
	c[0]="peach";
	getline(cin,s);
	for(c_num[0]=0;(c_num[0]<1000)&&((c_pos[0][c_num[0]]=s.find("apple"))!=string::npos);c_num[0]++){
		s.replace(c_pos[0][c_num[0]],5,"aaaaa");
	}
	for(c_num[1]=0;(c_num[1]<1000)&&((c_pos[1][c_num[1]]=s.find("peach"))!=string::npos);c_num[1]++){
		s.replace(c_pos[1][c_num[1]],5,"aaaaa");
	}
	
	for(int i=0;i<2;i++){
		for(int j=0;j<c_num[i];j++){
			s.replace(c_pos[i][j],5,c[i]);
		}
	}
	cout<<s<<endl;
}

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

#define rep(i, a, n)  for(ll i=a; i<n; i++)
#define per(i, a, n)  for(ll i=n-1; i>=a; i--)
#define fill0(n)  setfill('0') << right << setw(n)
#define all(x)  (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define LONGMAX 1e18
#define INTMAX 1000000000
using namespace std;
typedef long long ll;
int n;
map<ll, ll> mp;
// 連想配列(辞書)を使いましょう。
int main(){
  std::cin >> n;
  rep(i,1,n+1){
    ll tmp;
    std::cin >> tmp;
    mp[tmp]++;
  }
  ll ans =0;
  for (auto p:mp){
    ll x = p.first;
    ll n = p.second;
    if(x>n)ans+=n;//全部削除
    else ans += n-x;
  }
  std::cout << ans << '\n';

}


Measured memory_bytes: 6272
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,h,w,a[1000],b[1000],ans=0;
    cin>>n>>h>>w;
    for(int i=0;i<n;i++){
        cin>>a[i]>>b[i];
        if(a[i]>=h&&b[i]>=w)ans++;
    }
    cout<<ans<<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;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,N) for(int i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1

ll n;

int main(){
	cin >> n;
	ll ans = 0;
	rep(i,5){
		ll num;
		cin >> num;
		ans = max(ans,n/num - (n%num == 0));
	}
	cout << 5+ans << endl;
}

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

int n, m, a, b, c;
vector<pair<int,int> > e[10101];

int prim(int n, vector<pair<int,int> > e[]) {
	priority_queue<pair<int,int>, vector<pair<int,int> >, greater<pair<int,int> > > q;
	bool used[n];
	memset(used, 0, sizeof(used));
	q.push({0,0});
	int res = 0;
	while (!q.empty()) {
		int cost = q.top().first, v = q.top().second; q.pop();
		if (used[v]) continue;
		used[v] = true;
		res += cost;
		for (int i=0; i<e[v].size(); ++i) q.push({e[v][i].second, e[v][i].first});
	}
	return res;
}

signed main() {
	cin >> n >> m;
	for (int i = 0; i < m; ++i) {
		cin >> a >> b >> c;
		e[a].push_back({b,c}), e[b].push_back({a,c});
	}
	cout << prim(n,e) << endl;
}


Measured memory_bytes: 7764
import java.util.*;
 
public class Main {
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		String b = sc.next();
		String ans = "";
		if (b.equals("A")) {
			ans = "T";
		}
		else if (b.equals("T")) {
			ans = "A";
		}
		else if (b.equals("C")) {
			ans = "G";
		}
		else if (b.equals("G")) {
			ans = "C";
		}
    System.out.println(ans);
  }
}

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

using namespace std;

const double pi  =3.141592653589793238463;

int main(){
  int a,b,h,m;
  cin >>a>>b>>h>>m;
  double angleh = (h*30+m*0.5)*(pi/180.0);
  double anglem = (m*6)*(pi/180.0);
  if(angleh>anglem) angleh=angleh-anglem;
  else angleh=anglem-angleh;
  double result = sqrt((a*a)+(b*b)-(2*a*b*cos(angleh)));
  printf("%.20lf",result);
  return 0;
}


Measured memory_bytes: 4192
#include <bits/stdc++.h>
using namespace std;
int main(void){
    string s;
    cin >> s;
    //substr(開始位置, 取り出す長さ);
    int s1 = stoi(s.substr(0,2));
    int s2 = stoi(s.substr(2,2));
    
    if((s1==0||s1>12)&&s2>0&&s2<=12){
        cout << "YYMM" << endl;
    } else if((s2==0||s2>12)&&s1>0&&s1<=12){
        cout << "MMYY" << endl;
    } else if(s1<=12&&s1>0&&s2>0&&s2<=12){
        cout << "AMBIGUOUS" << endl;
    } else {
        cout << "NA" << endl;
    }
    
    return 0;
}


Measured memory_bytes: 256
n = int(input())
B = []
def dfs(A):
  x = int(''.join(A))
  if x <= n:
    if '7' in A and '5' in A and '3' in A:
      B.append(x)
    dfs(A + ['7'])
    dfs(A + ['5'])
    dfs(A + ['3'])

dfs(['0'])
print(len(B))

Measured memory_bytes: 4072
#include <stdio.h>
 
#define N 100
 
int min(int, int);
 
int main(){
    int i, j, k, l, n, p[N+1], m[N+1][N+1];
 
    scanf("%d", &n);
    for(i=1; i<=n; i++){
        scanf("%d %d", &p[i - 1], &p[i]);
    }
 
    for (i = 1; i <= n; i++ ) {
        m[i][i] = 0;
    }
    for (l = 2; l <= n; l++ ) {
        for (i = 1; i <= n - l + 1; i++ ) {
            j = i + l - 1;
            m[i][j] = (1 << 21);
            for (k = i; k <= j - 1; k++ ) {
                m[i][j] = min(m[i][j], m[i][k] + m[k + 1][j] + p[i - 1] * p[k] * p[j]);
            }
        }
    }
    
    printf("%d\n", m[1][n]);
 
    return 0;
}
 
int min(int a, int b){
    if(a < b)return a;
    else return b;
}

Measured memory_bytes: 636
s = input()
t = input()
l = len(t)
ls = len(s)
ans = 0

for i in range(ls-l+1):
    num = 0
    for j in range(l):
        if s[i+j]==t[j]:
            num += 1
    ans = max(ans, num)

print(l-ans)

Measured memory_bytes: 9028
import java.util.*;

public class Main {    
    public static void main(String[] args){        
        Scanner sc = new Scanner(System.in);                                
         
        int N = sc.nextInt();
        
        int T[] = new int[N];
        
        for(int i = 0;i < N;i++){
            T[i] = sc.nextInt();
        }
         
        int M = sc.nextInt();
        
        int ans[] = new int[M];
        
        for(int i = 0;i < M;i++){
            int p = sc.nextInt();
            int temp = T[p-1];
            T[p-1] = sc.nextInt();
            for(int j = 0;j < N;j++){
               ans[i] += T[j];
            } 
            T[p-1] = temp;
        }
                        
        for(int i = 0;i < M;i++){
            System.out.println(ans[i]);        
        }
        
    }            
}
        
        

Measured memory_bytes: 22228
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 1e5 + 50;
const ll inf = 1e18;
const int mod = 998244353;
int sum,n;
int a[maxn];
ll dp[305][305 * 305];
ll ans = 1;
int main()
{
    scanf("%d", &n);
    for (int i = 1; i <= n; ++i)
        scanf("%d", a + i),sum += a[i], ans = (ans * 3) % mod;
    dp[0][0] = 1;
    for (int i = 1; i <= n; ++i)
    {
        for (int j = 0; j <= sum; ++j)
        {
            dp[i][j] = dp[i - 1][j] * 2 % mod;
            if (j >= a[i])
                dp[i][j] = (dp[i][j] + dp[i - 1][j - a[i]]) % mod;
        }
    }
    for (int i = (sum + 1) / 2; i <= sum; ++i)
        ans = (ans - dp[n][i] * 3 % mod + mod) % mod;
    if (sum % 2 == 0)
    {
        memset(dp, 0, sizeof dp);
        dp[0][0] = 1;
        for (int i = 1; i <= n; ++i)
        {
            for (int j = 0; j <= sum; ++j)
            {
                dp[i][j] = dp[i - 1][j] % mod;
                if (j >= a[i])
                    dp[i][j] = (dp[i][j] + dp[i - 1][j - a[i]]) % mod;
            }
        }
        ans = (ans + dp[n][sum / 2] * 3) % mod;
    }
    printf("%lld\n", ans);
    return 0;
}

Measured memory_bytes: 221952
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <list>
#include <utility>
#include <tuple>
#include <cstdio>
#include <set>
#include <queue>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <cmath>
#include <limits>
#include <iomanip>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<(n);++i)
using namespace std;
const long long INF = 1LL << 60;
typedef long long ll;
int main() {
    int N;
    cin >> N;
    vector<int> time(N);
    vector<vector<int>> data(N, vector<int>(2));// data[i][0] = x , data[i][1] = y
    //
    for(int i=0;i<N;i++){
        cin >> time[i] >> data[i][0] >> data[i][1];
    }
    //
    bool bre = false;
    //
    for(int i=0;i<N;i++){
        int dist;
        if(i==0){
            dist = abs(data[i][0]) + abs(data[i][1]);
        }
        else{
            dist = abs(data[i][0]-data[i-1][0]) + abs(data[i][1]-data[i-1][1]);
        }
        // time
        int bw_time;
        if(i==0){
            bw_time = time[i];
        }
        else{
            bw_time = time[i] - time[i-1];
        }
        //
        for(int j=bw_time;j>=-1;j=j-2){
            if(j==dist){
                break;
            }
            else if(j<=0){
                bre = true;
                break;
            }
        }
        if(bre){
            break;
        }
    }
    //
    if(bre){
        cout << "No" << endl;
    }
    else{
        cout << "Yes" << endl;
    }
}

Measured memory_bytes: 9036
#include <stdio.h>
int n, m, i, j, k, a, b, ans, c[105], s[105];
int main(){
	scanf("%d", &n);
	for(i=2; i<=n; i++){
		for(m=i, j=2; j<=m; j++){
			while(m%j == 0){
				c[j]++, m /= j;
			}
		}
	}
	for(j=2; j<=n; j++){
		if(++c[j] >= 3) s[++a] = c[j];
		if(c[j] >= 5) b++;
	}
	for(i=1; i<=a; i++){
		if(s[i] >= 75) ans++;
		if(s[i] >= 25) ans += a-1;
		if(s[i] >= 15) ans += b-1;
	}
	ans += b*(b-1)*(b-2)/3/2/1*3;
	ans += b*(b-1)/2 * (a-b);
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 128
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream> 
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>  
using namespace std;
#define Ma_PI 3.141592653589793
#define eps 0.00000000000000000000000001
#define LONG_INF 10000000000000000LL
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define MOD  998244353
#define REP(i,n) for(long long i = 0;i < n;++i)
vector<int> vertexs[800];
int colored[800];
int visited[800];
int dp[800];
int main(){
#define int long long
	int n, m;
	cin >> n >> m;
	set<pair<int, int>> geko;
	REP(i, m) {
		int a, b;
		cin >> a >> b;
		a--;
		b--;
		geko.insert(make_pair(min(a,b), max(a,b)));
	}
	int ans = 0;
	REP(i, n) {
		for (int q = i + 1; q < n; ++q) {
			if (geko.find(make_pair(i, q)) == geko.end()) {
				vertexs[i].push_back(q);
				vertexs[q].push_back(i);
				ans--;
			}
		}
	}
	dp[0] = 1;
	REP(i, n) {
		if (visited[i] == 0) {
			visited[i] = 1;
			colored[i] = 0;
			queue<int> next;
			next.push(i);
			vector<int> bobo;
			while (next.empty() == false) {
				int now = next.front();
				next.pop();
				bobo.push_back(now);
				for (int q = 0; q < vertexs[now].size(); ++q) {
					int next_itr = vertexs[now][q];
					if (visited[next_itr] == 0) {
						visited[next_itr] = 1;
						colored[next_itr] = (colored[now] + 1) % 2;
						next.push(next_itr);
					}
					else {
						if (colored[next_itr] + colored[now] != 1) {
							cout << -1 << endl;
							return 0;
						}
					}
				}
			}
			int cnt = 0;
			for (int q = 0; q < bobo.size(); ++q) {
				if (colored[bobo[q]] == 0) {
					cnt++;
				}
			}
			for (int q = 799; q >= 0; --q) {
				if (dp[q] == 1) {
					dp[q] = 0;
					dp[q + cnt] = 1;
					dp[q + (bobo.size() - cnt)] = 1;
				}
			}
		}
	}
	int tea = LONG_INF;
	for (long long q = 0; q <= n; ++q) {
		if (dp[q] == 1) {
			tea = min(tea, q * (q-1) + (n - q - 1) * (n - q));
		}
	}
	cout << tea/2 << endl;
	return 0;
}

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

int main(){
    string s;
    cin >> s;
    int l = (int)s.length();
    for (int i=0; i<l; i++){
        if (s[i] == ','){
            cout << ' ';
        }
        else {
            cout << s[i];
        }
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
n,k = map(int,input().split())
w = []
for i in range(n):
	w.append(int(input()))
s = sum(w)
m = max(w) - 1
while (s-m) > 1:
	mid = (s+m+1)//2
	tmp = 0
	c = 0	
	for i in w:
		if tmp+i > mid:
			tmp = i
			c += 1
		else:
			tmp += i
	if c < k:
		s = mid
	else:
		m = mid
print(s)


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

using ull = unsigned long long;

int main() {

    ull l, r;

    cin >> l >> r;

    if(l + 2019 < r) { 
        r = l + 2019;
    }

    ull ans = 2019;

    for(ull i = l; i < r; ++i) {
        for(ull j = l + 1; j <= r; ++j) {

            ans = min(ans, (i * j) % 2019);

        }
    }

    cout << ans << endl;

    return 0;

}


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

//#define int long long
#define ll long long
#define all(v) (v).begin(), (v).end()
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<n;++i)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define EPS (1e-7)
#define gearup ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef pair<ll, ll> P;
typedef vector<ll> vl;
typedef vector<vector<ll> > vvl;
typedef vector<vector<vector<ll> > > vvvl;
ll MOD = 1000000007;
const long long L_INF = 1LL << 60;
const int INF = 2147483647; // 2^31-1
const double PI = acos(-1);
//cout<<fixed<<setprecision(10);

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;}
template<class T> void debug(T v){rep(i,v.size()) cout<<v[i]<<" ";cout<<endl;}
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};

signed main()
{   
    gearup;
    int n;cin >> n;
    bool is_res = false;
    for(int i=0;i<= 25;i++){
        for(int j=0;j<= 15;j++){
            if(4*i+7*j==n){
                is_res = true;
            }
        }
    }
    cout << (is_res?"Yes":"No") << endl;
}


Measured memory_bytes: 256
from sys import stdin
import math
import re
import queue

input = stdin.readline

MOD = 1000000007
INF = 122337203685477580

def solve():
    S = (input().rstrip())
    ref = "CODEFESTIVAL2016"

    cnt = 0
    for x in range(len(ref)):
        if(S[x] != ref[x]):
            cnt += 1
    
    print(cnt)
   


if __name__ == '__main__':
    solve()


Measured memory_bytes: 4196
#![allow(unused_variables)]
#![allow(unused_imports)]
#![allow(dead_code)]
use std::io;
use std::str::FromStr;
use std::iter::FromIterator;
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::mem::{replace, swap};


// abcde
fn read_string() -> String {
    let mut line = String::new();
    io::stdin().read_line(&mut line).unwrap();
    line
}

// -3.2
fn read_as_primitive<T: FromStr>() -> T {
    let s = read_string();
    s.trim().parse().ok().expect("failed to parse input")
}

// 1 -3 0 999
fn read_as_collection<U: FromStr, T: FromIterator<U>>() -> T {
    let s = read_string();
    s.trim().split_whitespace().map(|s| s.parse().ok().expect("failed to parse")).collect()
}

// #.#.###..
fn read_as_chars<T: FromIterator<char>>() -> T {
    let s = read_string();
    s.chars().collect()
}

// 1 abc
fn read_as_pair<T: FromStr, U: FromStr>() -> (T, U) {
    let s = read_string();
    let elems: Vec<_> = s.trim().split_whitespace().collect();
    (
        elems[0].parse().ok().expect("failed to parse"),
        elems[1].parse().ok().expect("failed to parse"),
    )
}

// 1.5 -2 abc
fn read_as_triple<T: FromStr, U: FromStr, V: FromStr>() -> (T, U, V) {
    let s = read_string();
    let elems: Vec<_> = s.trim().split_whitespace().collect();
    (
        elems[0].parse().ok().expect("failed to parse"),
        elems[1].parse().ok().expect("failed to parse"),
        elems[2].parse().ok().expect("failed to parse"),
    )
}

// Usage:
// let mut v: Vec<f64> = vec![0.1, 1.0, 2.0];
// v.sort_by_key(|&x| Total(x));
// 
// src: https://qiita.com/hatoo@github/items/fa14ad36a1b568d14f3e
//      https://github.com/rust-lang/rust/pull/53938
//
#[derive(PartialEq, PartialOrd)]
pub struct Total<T>(pub T);

impl<T: PartialEq> Eq for Total<T> {}

impl<T: PartialOrd> Ord for Total<T> {
    fn cmp(&self, other: &Total<T>) -> std::cmp::Ordering {
        self.0.partial_cmp(&other.0).unwrap()
    }
}


fn main() {

    let x: i64 = read_as_primitive();
    let ans = match x {
        7 => "YES",
        5 => "YES",
        3 => "YES",
        _ => "NO",
    };
    println!("{}", ans);
}

Measured memory_bytes: 4352
# coding: utf-8

N = int(input())
line1 = input().split(" ")
line2 = input().split(" ")
line3 = input().split(" ")

line22 = {}
for i in range(N):
    line22[i + 1] = int(line2[i])

total = 0
memory = - 1
for number in line1:
    num = int(number)
    total += line22[num]
    if num == memory + 1:
        total += int(line3[memory - 1])
    memory = num

print(total)

Measured memory_bytes: 3064
#include<stdio.h>
int main()
{
	char S[6];
	int is_yes=0;
	scanf("%s",S);
	for(int i=0;;i++)
	{
		if(S[i]=='\0')
		{
			break;
		}
		else if(S[i]=='A'&&S[i+1]=='C')
		{
			is_yes=1;
			printf("Yes\n");
			break;
		}
	}
	if(is_yes==0)
	{
		printf("No\n");
	}
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <string>
#include <set>
#include <vector>
#include <queue>
#include <stack>
#include <map>
using namespace std;
#define ms(a, x) memset(a, x, sizeof(a))
#define fore(i, a, n) for (long long i = a; i < n; i++)
#define ford(i, a, n) for (long long i = n - 1; i >= a; i--)
#define si(a) scanf("%d", &a)
#define sl(a) scanf("%lld", &a)
#define sii(a, b) scanf("%d%d", &a, &b)
#define siii(a, b, c) scanf("%d%d%d", &a, &b, &c)
#define sll(a, b) scanf("%lld%lld", &a, &b)
#define slll(a, b, c) scanf("%lld%lld%lld", &a, &b, &c)
#define debug(a) cout << a << endl
#define pr(a) printf("%d ", a)
#define endl '\n'
#define pi acos(-1.0)
#define tr t[root]
#define lson t[root << 1]
#define rson t[root << 1 | 1]
#define IO ios::sync_with_stdio(false), cin.tie(0)
#define ull unsigned long long
#define py puts("Yes")
#define pn puts("No")
#define pY puts("YES")
#define pN puts("NO")
#define re(i, a, b) for (int i = a; i <= b; ++i)
#define de(i, a, b) for (int i = a; i >= b; --i)
const double eps = 1e-8;
inline int sgn(const double &x) { return x < -eps ? -1 : x > eps; }
typedef long long ll;
const int inf = 0x3f3f3f3f;
const int MAXN = 1e5 + 5;
const ll mode = 192600817;
template <class T>
inline void cmin(T &a, T b) { ((a > b) && (a = b)); }
template <class T>
inline void cmax(T &a, T b) { ((a < b) && (a = b)); }
ll a[100], b[100], c[100], d[100], A[100];
int n, m, q;
ll dfs(int i, int x)
{
  A[i] = x;
  if (i == n)
  {
    ll cnt = 0;
    for (int k = 1; k <= q; ++k)
    {
      int ak = a[k];
      int bk = b[k];
      if (A[bk] - A[ak] == c[k])
      {
        cnt += d[k];
      }
    }
    return cnt;
  }
  ll ma = 0;
  for (int j = x; j <= m; ++j)
  {
    ma = max(dfs(i + 1, j), ma);
  }
  return ma;
}
int main()
{
  siii(n, m, q);
  re(i, 1, q)
  {
    sll(a[i], b[i]);
    sll(c[i], d[i]);
  }
  ll ans = 0;
  for (int i = 1; i <= m; ++i)
    ans = max(ans, dfs(1, i));
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3764
package main

import (
    "fmt"
    "math"
)

func main() {
    var A, B, X float64
    fmt.Scan(&A)
    fmt.Scan(&B)
    fmt.Scan(&X)
    var ans float64
    if X <= A * A * B / 2 {
        ans = math.Atan(A * B * B / (2 * X))
    } else {
        ans = math.Atan(2 * (A * A * B - X) / (A * A * A))
    }
    ans = ans * 180 / math.Pi
    fmt.Println(ans)
}

Measured memory_bytes: 512
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <tuple>
#include <stack>
#include <bitset>

#define MAX_N 100001
#define INF   1000000000000
#define p     (1000000000 + 7)
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
ll dp[MAX_N][13];

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

    string S;
    cin >> S;
    ll N = S.size();

    for (ll i = 0; i < MAX_N; i++)
      for (ll j = 0; j < 13; j++) 
	dp[i][j] = 0;


    if (S[0] == '?') {
      for(ll j = 0; j <= 9; j++) dp[0][j] = 1;
    }
    else dp[0][S[0] - '0'] = 1;

    
    for (ll i = 1; i < N; i++) {

      if (S[i] == '?') {

	for(ll j = 0; j < 13; j++) {
	  if (dp[i-1][j] != 0) {
	    for(ll k = 0; k <= 9; k++) {
	      dp[i][ (j*10 + k) % 13 ] += dp[i-1][j];
	      dp[i][ (j*10 + k) % 13 ] %= p;
	    }
	  }
	}

      }
      else {
	ll l = S[i] - '0';
	for(ll j = 0; j < 13; j++) {
	  if (dp[i-1][j] != 0) {
	    dp[i][ (j*10 + l) % 13 ] += dp[i-1][j];
	    dp[i][ (j*10 + l) % 13 ] %= p;
	  }
	}
      }
      
    }

    cout << dp[N-1][5] << endl;
    return 0;
}
    

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

using namespace std;

int main(){
    int a,b;
    char c[105][105];
    set<int> x,y;
    cin>>a>>b;
    set<int>::iterator ax;
    set<int>::iterator by;
    for(int i=0;i<a;i++){
        scanf("%s",c[i]);
    }
    for(int i=0;i<a;i++){
        for(int j=0;j<b;j++){
            if(c[i][j]=='#')
            {
                x.insert(i);
                y.insert(j);
            }
        }
    }

    for(ax=x.begin();ax!=x.end();ax++)
    {
        for(by=y.begin();by!=y.end();by++)
        {
            cout<<c[*ax][*by];
        }
        cout<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
d = 5
c = [86, 90, 69, 51, 2, 96, 71, 47, 88, 34, 45, 46, 89, 34, 31, 38, 97, 84, 41, 80, 14, 4, 50, 83, 7, 82]
s = [[19771, 12979, 18912, 10432, 10544, 12928, 13403, 3047, 10527, 9740, 8100, 92, 2856, 14730, 1396, 15905, 6534, 4650, 11469, 3628, 8433, 2994, 10899, 16396, 18355, 11424],
    [6674, 17707, 13855, 16407, 12232, 2886, 11908, 1705, 5000, 1537, 10440, 10711, 4917, 10770, 17272, 15364, 19277, 18094, 3929, 3705, 7169, 6159, 18683, 15410, 9092, 4570],
    [6878, 4239, 19925, 1799, 375, 9563, 3445, 5658, 19857, 11401, 6997, 6498, 19933, 3848, 2426, 2146, 19745, 16880, 17773, 18359, 3921, 14172, 16730, 11157, 5439, 256],
    [8633, 15862, 15303, 10749, 18499, 7792, 10317, 5901, 9395, 11433, 3514, 3959, 5202, 19850, 19469, 9790, 5653, 784, 18500, 10552, 17975, 16615, 7852, 197, 8471, 7452],
    [19855, 17918, 7990, 10572, 4333, 438, 9140, 9104, 12622, 4985, 12319, 4028, 19922, 12132, 16259, 17476, 2976, 547, 19195, 19830, 16285, 4806, 4471, 9457, 2864, 2192]]
d = int(input())
c = list(map(int,input().split()))
s = []
p = [1]*d
for i in range(d):
    s.append(list(map(int,input().split())))
x = [1]*26
for i in range(d):
    q = 1
    m = -1
    for j in range(26):
        n = s[i][j] + (d-i+x[j])*c[j]
        x[j] += 1
        if(m < n):
            m = n
            q = j
    x[q] *= 0
    p[i] = q+1
for i in range(d):
    print(p[i])

Measured memory_bytes: 68336
#include <iostream>
#include <iomanip>
#include <sstream>
#include <vector>
#include <string>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <functional>
#include <iterator>
#include <limits>
#include <numeric>
#include <utility>
#include <type_traits>
#include <cmath>
#include <cassert>
#include <cstdio>

using namespace std;
using namespace placeholders;

using LL = long long;
using ULL = unsigned long long;
using VI = vector< int >;
using VVI = vector< vector< int > >;
using VS = vector< string >;
using SS = stringstream;
using PII = pair< int, int >;
using VPII = vector< pair< int, int > >;
template < typename T = int > using VT = vector< T >;
template < typename T = int > using VVT = vector< vector< T > >;
template < typename T = int > using LIM = numeric_limits< T >;

template < typename T > inline istream& operator>>( istream &s, vector< T > &v ){ for ( T &t : v ) { s >> t; } return s; }
template < typename T > inline ostream& operator<<( ostream &s, const vector< T > &v ){ for ( int i = 0; i < int( v.size() ); ++i ){ s << ( " " + !i ) << v[i]; } return s; }
template < typename T > inline T fromString( const string &s ) { T res; istringstream iss( s ); iss >> res; return res; }
template < typename T > inline string toString( const T &a ) { ostringstream oss; oss << a; return oss.str(); }

#define NUMBERED( name, number ) NUMBERED2( name, number )
#define NUMBERED2( name, number ) name ## _ ## number
#define REP1( n ) REP2( NUMBERED( REP_COUNTER, __LINE__ ), n )
#define REP2( i, n ) REP3( i, 0, n )
#define REP3( i, m, n ) for ( int i = ( int )( m ); i < ( int )( n ); ++i )
#define GET_REP( a, b, c, F, ... ) F
#define REP( ... ) GET_REP( __VA_ARGS__, REP3, REP2, REP1 )( __VA_ARGS__ )
#define FOR( e, c ) for ( auto &&e : c )
#define ALL( c ) begin( c ), end( c )
#define AALL( a ) ( std::remove_all_extents< decltype( a ) >::type * )a, ( std::remove_all_extents< decltype( a ) >::type * )a + sizeof( a ) / sizeof( std::remove_all_extents< decltype( a ) >::type )
#define DRANGE( c, p ) ( c ).begin(), ( c ).begin() + ( p ), ( c ).end()

#define SZ( v ) ( (int)( v ).size() )
#define EXIST( c, e ) ( ( c ).find( e ) != ( c ).end() )

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

#define PB push_back
#define EM emplace
#define EB emplace_back
#define BI back_inserter

#define MP make_pair
#define fst first
#define snd second

#define DUMP( x ) cerr << #x << " = " << ( x ) << endl

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

	int H, W;
	cin >> H >> W;

	VVT< string > board( H, VS( W ) );
	cin >> board;

	REP( i, H )
	{
		REP( j, W )
		{
			if ( board[i][j] == "snuke" )
			{
				cout << char( 'A' + j ) << i + 1 << endl;
			}
		}
	}

	return 0;
}


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

int main(){
  string s;
  cin>>s;
  map<char,int> m;
  vector<char> lis;
  int n=0;
  lp(i,s.size()){
    if('a'<=s[i]&&s[i]<='z')n++;
  }
  lp(i,n){
    char c;
    int a;
    cin>>c>>a;
    m[c]=a;
    lis.push_back(c);
  }
  while(true){
    bool act=false;

    lp(i,s.size()-4){
      //cout<<i<<" "<<s<<endl;
      if(i>=(int)s.size()-4)break;
      if(s[i]=='['&&s[i+2]=='-'&&s[i+4]==']'){
	act=true;
      }
      else{
	continue;
      }
      char t1=s[i+1];
      char t2=s[i+3];
      string bef=s.substr(0,i);
      string af=s.substr(i+5,s.size()-(i+5));
      int a=m[t1];
      int b=m[t2];
      if(a==0){
	if(m[t2]==0){
	  cout<<"No"<<endl;
	  return 0;
	}
	m[t2]--;
	s=bef+t2;
	s=s+af;
      }
      else if(b==0){
	m[t1]--;
	s=bef+t1;
	s=s+af;
      }
      else{
	cout<<"No"<<endl;
	return 0;
      }
    }
    if(act)continue;
    break;
  }
  if(s.size()!=1){
    cout<<"No"<<endl;
    return 0;
  }
  lp(i,n){
    if(m[lis[i]]==0)continue;
    cout<<"No"<<endl;
    return 0;
  }
  cout<<"Yes"<<endl;
  return 0; 
}



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

const int INF = 1145141919;
const long long INFL = 1LL<<60;

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;
}

int main()
{
	int N, W;
	cin >> N >> W;
	int w[110], v[110];
	long long int dp[110000] = {};
	for (int i = 0; i < N; ++i)
	{
		cin >> w[i] >> v[i];
	}
	for (int i = 0; i < N; ++i)
	{
		for (int j = W; j >= 0; --j)
		{
			if((dp[j] != 0 || j == 0) && j + w[i] <= W)
			{
				chmax(dp[j+w[i]], dp[j] + v[i]);
			}
		}
	}
	long long int ans = 0;
	for (int i = 0; i <= W; ++i)
	{
		chmax(ans, dp[i]);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1152
from collections import deque
N=int(input())
if N==1:
    print("Yes")
    print(2)
    print(1,1)
    print(1,1)
    exit()

# 1569   127 10   2368   3479   458 10  
# 1234      156 7      2589      36810      47910
#2*3  3*4 4*5
size=None
for i in range(1,N):
    if i*(i+1)==N*2:
        size=i
        groups=i+1
if size is None:
    print("No")
    exit()

ans=[[] for _ in range(groups)]
first=deque(list(range(1,N+1)))

#second=deque(list(range(1,N+1)))

for i in range(groups):
    to_idx=i+1
    while len(ans[i])<size:
        x=first.popleft()
        ans[i].append(x)
        #print(to_idx)
        ans[to_idx].append(x)
        to_idx+=1

print("Yes")
print(len(ans))
for s in ans:
    print(len(s), *s)


Measured memory_bytes: 78592
#include <iostream>
#include <algorithm>
#include <string>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>
#include <map>
#include <iomanip>
#include <set>
#include <ctime>
#include <tuple>
#include <bitset>
#include <assert.h>
#include <deque>
using namespace std;

/*
using PAIR = pair<string, int>;
sort(sp.begin(), sp.end(), [](PAIR l, PAIR r){
        return l.first<r.first || (l.first==r.first && l.second > r.second);
        });
*/

typedef long long ll;

#define fi first
#define se second
#define rep(i, n) for (ll i = 0; i < n; i++)
#define debugA() cerr << "AAAAA" << endl
#define debug_() cerr << "-------------" << endl
#define debug(x) cerr << #x << ": " << x << endl
#define debug_vec(v)                   \
    for (int i = 0; i < v.size(); i++) \
    {                                  \
        cout << v[i] << " ";           \
    }                                  \
    cout << endl;

using Graph = vector<vector<int>>;

int main()
{
    int h1, m1, h2, m2, k;
    cin >> h1 >> m1 >> h2 >> m2 >> k;
    int ans = h2 * 60 + m2 - h1 * 60 - m1 - k;
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3588
#define _USE_MATH_DEFINES

#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cmath>
#include <bitset>
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef tuple<ll, ll, ll> tl3;



const int BIG_NUM = 1e9;
const ll INF = 1000000000000000000;
//const ll MOD = 1e9 + 7;
const ll MOD = 998244353;




int main() {
	string s;
	cin >> s;
	int ans = 0;
	int cnt = 0;
	for (int i = 0; i < 3; i++) {
		ans = max(ans, cnt);
		if (s[i] == 'R') {
			cnt++;
		}
		else {
			
			cnt = 0;
		}
	}
	ans = max(ans, cnt);
	cout << ans << endl;

}


Measured memory_bytes: 3628
ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

h,n = mi()
a = li()
a.sort()
if n >= h:
    print(0)
else:
    ans = 0
    for i in range(h-n):
        ans += a[i]
    print(ans)


Measured memory_bytes: 87372
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int a = sc.nextInt();
		int b = sc.nextInt();
		
		if(a * b % 2 == 0) {
			System.out.println("Even");
		}else {
			System.out.println("Odd");
		}
      
		sc.close();
	}
}

Measured memory_bytes: 21332
#include<iostream>
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<math.h>
#include<algorithm>
#include<iomanip>

using namespace std;

class Counting {
	unsigned long long p, n;
	vector<long long> invMemo, facMemo, facInvMemo;
public:
	Counting(unsigned long long nn, unsigned long long np) {
		p = np;
		n = nn;
		invMemo.resize(n + 1);
		facMemo.resize(n + 1);
		facInvMemo.resize(n + 1);
		facMemo[0] = 1;
		facMemo[1] = 1;
		facInvMemo[0] = 1;
		facInvMemo[1] = 1;
		invMemo[0] = 0;
		invMemo[1] = 1;
		for (unsigned long long i = 2; i <= n; i++) {
			invMemo[i] = p - (p / i)*invMemo[p%i] % p;
			facMemo[i] = (facMemo[i - 1] * i) % p;
			facInvMemo[i] = (facInvMemo[i - 1] * invMemo[i]) % p;
		}
	}
	unsigned long long fac(unsigned long long k) {
		return facMemo[k];
	}
	unsigned long long facInv(unsigned long long k) {
		return facInvMemo[k];
	}
	unsigned long long choose(unsigned long long n, unsigned long long k) {
		if (!(0 <= k && k <= n))
			return 0;
		return (((facMemo[n] * facInvMemo[k]) % p)*facMemo[n - k]) % p;
	}
	unsigned long long divide(unsigned long long a, unsigned long long b) {
		return (a * invMemo[b]) % p;
	}
	unsigned long long mod(unsigned long long a) {
		a %= p;
		if (a < 0) a += p;
		return a;
	}
	unsigned long long power(unsigned long long a, unsigned long long e) {
		unsigned long long ans = 1;
		for (; e > 0; e /= 2) {
			if (e % 2 != 0)
				ans = ans * a % p;
			a = a*a%p;
		}
		return ans;
	}
};

string s;
vector<long long> a;
long long k = 0;

int main() {
	cin >> s >> k;
	a.resize(s.size());
	for (int i = 0; i < s.size(); i++) {
		a[i] = 'z' - s[i] + 1;
		if (s[i] == 'a') {
			a[i] = 1145141919;
		}
	}
	for (int j = 0; j < s.size(); j++) {
		if (a[j] <= k) {
			k -= a[j];
			s[j] = 'a';
		}
	}
	s[s.size() - 1] += k%26;
	cout << s << endl;
	//cin >> s;
	return 0;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
int main()
  {int N; cin >> N;
  int A[N]; double x{}; for (int &a: A) cin >> a, x += a; x /= N;
  pair<double, int> m{1e9, -1}; for (int i{}; i < N; ++i) m = min(m, {abs(x - A[i]), i});
  cout << m.second;}

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

using namespace std;
int n;
int main()
{
    vector<int> a;
    cin>>n;
    for(int i=0;i!=n;++i)
    {
        int c; cin>>c;
        if(c<2)
        {
            if(c==0) {cin>>c; a.push_back(c);}
            else {cin>>c; cout<<a[c]<<endl;}
        }
        else a.pop_back();
    }
    return 0;
}


Measured memory_bytes: 3952
#include <stdio.h>

int main(void) {
	int n,x,i;
scanf("%d",&n);
if(n%1000==0){
printf("0");
}
else if(n>1000){
    for(i=2;;i++){
        x=1000*i;
        if(x>n){
            break;
        }
    }
    printf("%d",x-n);
}
 else if (n<1000){
    printf("%d",1000-n);
 }


	return 0;

}


Measured memory_bytes: 1728
use std::io::{stdin, Read};
use std::str::FromStr;

// https://qiita.com/tubo28/items/e6076e9040da57368845
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

#[allow(dead_code)]
fn main() {
    let n = read::<usize>();
    let x = read::<i64>();
    let mut g = (read::<i64>() - x).abs() as usize;
    for _ in 1..n {
        let di = (read::<i64>() - x).abs() as usize;
        g = gcd(g, di)
    }
    println!("{}", g);

    fn gcd(a: usize, b: usize) -> usize {
        if b == 0 {
            a
        } else {
            gcd(b, a % b)
        }
    }
}


Measured memory_bytes: 4352
#include<iostream>
#include<sstream>
#include<vector>
#include<algorithm>
#include<string>
#include<stdexcept>
#include<stdio.h>
#include<queue>
#include <cmath>
//for(int i=0;i<n;i++)
#define cinf(n,x) for(int i=0;i<n;i++) cin >> x[i];
#define pi pair<int,int> 
using namespace std;
using ll = long long;
 int main(){
    int r,d,x;
    cin >> r>>d>>x;
    for(int i=0;i<10;i++){
        int y=r*x-d;
        cout << y <<endl;
        x=y;
    }
 }

Measured memory_bytes: 256
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
using ll =  long long;
bool cmp(const pair<ll,ll>& a, const pair<ll,ll>& b)
{
    return a.first < b.first;
}

int main()
{

    ll n;

    cin>>n;
    vector<vector<ll>> dp(n + 1, vector<ll>(n + 1));
 vector<pair<ll, ll >> a(n) ;
    for(ll i = 0;i<n;i++){

       cin>> a[i].first;
        a[i].second  =  i;

    }
    sort(a.rbegin(),a.rend(),cmp);


ll res =0;
    for(ll i=0;i<n;i++){
        for(ll j=0;j<n;j++){
               ll pos =  i+j;
               if(pos==n){
                res = max(res,dp[i][j]);
                break;
               }
 dp[i + 1][j] = max(dp[i + 1][j], dp[i][j] + abs(a[pos].second - i) * a[pos].first);
            dp[i][j + 1] = max(dp[i][j + 1], dp[i][j] + abs(a[pos].second - (n - 1 - j)) * a[pos].first);

        }
    }
    cout<<res;

    return 0;
}


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

using namespace std;

typedef long long ll;

const ll INF = 1e18;

template <typename T>
class FenwickTree {
  int N;
  vector<T> ft;
public:
  FenwickTree(int N): N(N), ft(N) {}

  void update(int i, T val) {
    for (; i < N; i = (i | (i + 1))) {
      ft[i] += val;
    }
  }

  T query(int i) {
    T sum{};
    for (; i >= 0; i = (i & (i + 1)) - 1) {
      sum += ft[i];
    }
    return sum;
  }
};

struct Node {
  ll a = 0;

  void operator+=(Node& n) {
    a = max(a, n.a);
  }
};

int main() {
  ios::sync_with_stdio(false); cin.tie(NULL);
  int n; cin >> n;
  vector<ll> h(n), a(n);
  for (int i = 0; i < n; i++) cin >> h[i];
  for (int i = 0; i < n; i++) cin >> a[i];
  FenwickTree<Node> ft(n + 1);
  for (int i = 0; i < n; i++) {
    ft.update(h[i], {ft.query(h[i] - 1).a + a[i]});
  }
  cout << ft.query(n).a << endl;
  return 0;
}


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

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		
		// 入力
		long x = sc.nextLong();
		
		// 計算
		long result = 0;
		if(x == 2) result = 2;
		while(result == 0){
		    boolean flg = true;
		    for(int i = 2; i <= sqrt(x); i++){
		        if(x%i == 0){
		            flg = false;
		            break;
		        }
		    }
		    if(flg) result = x;
		    x++;
		}
		
		
		
		// 出力
		System.out.println(result);
	}
}


Measured memory_bytes: 21844