akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
using namespace std;
int n,m,p,sx[400],sy[400];
const int dx[]={0,0,1,1, 1,1,0,1, 1, 0,-1,-1,-1}
  ,dy[]=  {0,1,0,1,-1,0,1,1,-1,-1,-1, 0,1}
  ,dz[]=  {1,0,0,0, 0,1,1,1, 1, 1, 1, 1,1};
// int dx[]={0,1,1,0,-1,1,1,0,-1,-1,-1, 0, 1},
//         dy[]={0,0,1,1, 1,0,1,1, 1, 0,-1,-1,-1},
//         dz[]={1,0,0,0, 0,1,1,1, 1, 1, 1, 1, 1};
int game(){
  int borad[9][9][9]={0},s[2]={1,2};
  for(int i=0;i<p;i++){
    int x,y,z=1;
    x=sx[i];y=sy[i];
    while(borad[x][y][z])z++;
    borad[x][y][z]=s[i&1];
    for(int j=0;j<13;j++){
      int r=1;
      for(int k=1;
	  borad[x+k*dx[j]][y+k*dy[j]][z+k*dz[j]]==s[i&1];
	  k++)r++;

      for(int k=1;
	  borad[x-k*dx[j]][y-k*dy[j]][z-k*dz[j]]==s[i&1];
	  k++)r++;
      if(r>=m)return i+1;
    }
  }
  return 0;
}

int main(){
  while(cin>>n>>m>>p,n){
    for(int i=0;i<p;i++)cin>>sx[i]>>sy[i];
    int ans=game();
    if(!ans){
      cout << "Draw" << endl;
    }else{
      if(ans%2)cout << "Black ";
      else cout << "White ";
      cout << ans << endl;
    }
  }
  return 0;
}
  

Measured memory_bytes: 1168
#include<bits/stdc++.h>
using namespace std;
int main(){
	string s;
	cin>>s;
	int p=-1;
	for(int i=0;i<s.length();i++)
		if(s[i]=='C'){p=i;break;}
	if(p==-1) {cout<<"No";return 0;}
	for(int i=p+1;i<s.length();i++)
		if(s[i]=='F') {cout<<"Yes";return 0;}
	cout<<"No";
}

Measured memory_bytes: 256
/*************************************************************************
    > File Name: c.cpp
    > Author: Amano Sei
    > Mail: amano_sei@outlook.com 
    > Created Time: 2019年12月22日 星期日 21时11分19秒
 ************************************************************************/

#include <cstdio>

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

int main(){
    long long a, b;
    scanf("%lld%lld", &a, &b);
    printf("%lld\n", a*b/gcd(a,b));
    return 0;
}



Measured memory_bytes: 128
#import re
import sys
input = sys.stdin.readline
#import heapq
#import bisect
#from collections import deque
#import math

def main():
    n = int(input())
    ans = 0
    for i in range(n):
        if (i+1)%3 == 0 or (i+1)%5 == 0:
            continue
        else:
            ans += i+1 
    print(ans)

    
if __name__ == '__main__':
    main()


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

using namespace std;

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

  int n, m;
  cin >> n >> m;
  vector<bool> ac(n);
  vector<int> cnt(n);
  int ok = 0, wa = 0;
  while (m--) {
    int x;
    string s;
    cin >> x >> s;
    --x;
    if (s == "WA") {
      if (!ac[x]) {
        ++cnt[x];
      }
    } else {
      if (!ac[x]) {
        ++ok;
      }
      ac[x] = true;
    }
  }
  cout << ok;
  wa = 0;
  for (int i = 0; i < n; ++i) {
    if (ac[i]) {
      wa += cnt[i];
    }
  }
  cout << ' ' << wa;

  return 0;
}

Measured memory_bytes: 640
m=int(input())
flag=True
for i in range(100000):
    n=(m+i**5)**0.2
    if round(n)**5-i**5==m:
        print(int(n),i)
        break
    if flag:
        n=(m-i**5)**0.2
        if type(n)==complex:
            flag=False
        elif round(n)**5+i**5==m:
            print(int(n),-i)
            break

Measured memory_bytes: 62760
#include <stdio.h>
#include <math.h>

double round_d(double x) {
    if ( x >= 0.0 ) {
        return floor(x + 0.5);
    } else {
        return -1.0 * floor(fabs(x) + 0.5);
    }
}

int main(){
double num1,num2,num3,num4,num5,num6,x=0.0,y=0.0;
while(scanf("%lf %lf %lf %lf %lf %lf",&num1,&num2,&num3,&num4,&num5,&num6)!=EOF){
x=(num2*num6-num3*num5)/(num2*num4-num1*num5);
x=round_d(x*1000.0)/1000.0;
y=(num1*num6-num3*num4)/(num1*num5-num2*num4);
y=round_d(y*1000.0)/1000.0;
printf("%.3f %.3f\n",x,y);
}
return 0;
}

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

#define REP(i, n) for(int (i)=0;(i)<(n);++(i))
#define MOD 1000000007
#define MAXNUM 55555

using namespace std;

typedef long long ll;

int main()
{
    int N;
    cin >> N;
    vector<int> prime;
    for (int i = 2; i <= MAXNUM; ++i)
    {
        bool isPrime = true;
        for(int j = 2; j * j <= i; ++j)
        {
            if (i % j == 0)
            {
                isPrime = false;
                break;
            }
        }
        if (isPrime) prime.push_back(i);
    }
    int modAns = 1;
    int cntN = 0;
    for(auto itr = prime.begin(); itr != prime.end(); ++itr)
    {
        if (*itr % 5 == modAns)
        {
            cntN++;
            cout << *itr << " ";
        }
        if (cntN == N) break;
    }
}


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

using namespace std;


void solve() {
    int n,m;
    cin >> n >> m;
    vector<vector<int>> g(n);
    for (int _ = 0; _ < m; _++) {
        int x,y;
        cin >> x >> y;
        --x;--y;
        g[x].push_back(y);
        g[y].push_back(x);
    }
    vector<int> d(n,-1), pa(n);
    queue<int> q; q.push(d[0]=0);
    while (!q.empty()) {
        auto u = q.front(); q.pop();
        for (int v:g[u])if(d[v]==-1){
            pa[v]=u;
            d[v]=d[u]+1;
            q.push(v);
        }
    }
    if (*min_element(d.begin(), d.end()) == -1) {
        cout << "No";
    } else {
        cout << "Yes\n";
        for (int i = 1; i < n; i++) {
            cout << pa[i]+1 << '\n';
        }
    }
}

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


Measured memory_bytes: 10592
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
using namespace std;
#define int long long
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define all(a) a.begin(),a.end()
#define rall(c) (c).rbegin(),(c).rend()
#define mp make_pair
#define endl '\n'
typedef long long ll;
typedef pair<ll,ll> pll;
typedef long double ld;
const ll inf=1e9+7;
const ll mod=1e9+7;
signed main(){
    ll n;cin>>n;
    map<ll,ll>ma;
    ll ans=0;
    rep(i,n){
        ll a;cin>>a;
        ans+=ma[a-i];
        ma[-i-a]++;
        //cout<<i<<' '<<ans<<' '<<a-i<<endl;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 26292
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ll                long long int
#define ld                long double
#define pb                push_back
#define mk                make_pair
#define in(i,a,n)         for(ll i=0;i<n;++i) cin>>a[i];
#define out(i,a,n)        for(ll i=0;i<n;++i) cout<<a[i]<<" ";
#define sz                size()
#define all(c)            c.begin(), c.end()
#define rall(c)           c.rbegin(), c.rend()
#define loop(i,a,b)       for(ll i=a;i<b;i++)
#define rloop(i,a,b)      for(ll i=a;i>b;i--)
#define T                 int t;scanf("%lld",&t);while(t--)
#define F                 first
#define S                 second
#define deb(x) cout << #x << " " << x << endl
#define inf INT_MAX
const ll N = 200010;
const ll MOD = 998244353;
ll mod(ll n) {
    return (n % MOD + MOD) % MOD;
}
 

 
 
int main(){
//T{
  
    ld a, b, h, m;
    cin >> a >> b >> h >> m;
    ld p = (abs((h+(m/60.0))*5*6 - m*6))*(3.141592653589793238462/180);
    ld dist = a*a + b*b - 2*a*b*cos(p); 
    cout << setprecision(10) << sqrt(dist);
//}

}

Measured memory_bytes: 4088
X, N = map(int,input().split())
p = list(map(int,input().split()))

if p == None:
    print(X)
else:
    for j in range(0,200):
        if (X-j) not in p:
            print(X-j)
            break
        elif (X+j) not in p:
            print(X+j)
            break


Measured memory_bytes: 9180
#include <bits/stdc++.h>
using namespace std;
long gcd(long a,long b)
{
if (b == 0) 
        return a; 
    return gcd(b, a % b);  
}
int main()
{
    long t;
    t=1;
    // cin>>t;
    while(t--)
    {
        long n,i,j,x,y,flag=1,a=0,b,ans,count,z;
        string s;
        cin>>n;
        for(i=1;i<=n;i++)
        {
            for(j=1;j<=n;j++)
            {
                for(long k=1;k<=n;k++)
                {
                    if(i<=j && i<=k)
                    {
                        if(j>=k)
                        {
                            x=i;
                            y=j;
                            z=k;
                        }
                        else
                        {
                            x=i;
                            y=k;
                            z=j; 
                        }
                    }
                    if(j<=i && j<=k)
                    {
                        if(i<=k)
                        {
                            x=j;
                            y=i;
                            z=k;
                        }
                        else
                        {
                            x=j;
                            y=k;
                            z=i; 
                        }
                    }
                    if(k<=i && k<=j)
                    {
                        if(i>=j)
                        {
                            x=k;
                            y=j;
                            z=i;
                        }
                        else
                        {
                            x=k;
                            y=i;
                            z=j; 
                        }
                    }
                    
                    a+=gcd(gcd(x,y),z);
                }
            }
        }
        cout<<a;
        
        
    }
    
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main()
{
    int l,r;
    cin>>l>>r;
    if((l==0&&r>=2019)||(r/2019>(l-1)/2019))
        cout<<0;
    else
    {
        int ans=2019;
        for(int i=l;i<r;++i)
            for(int j=i+1;j<=r;++j)
                ans=min((ll)ans,(ll)i*j%2019);
        cout<<ans;
    }
    return 0;
}



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

using namespace std;
const int INF = 1000000000;

int main(){
	ios_base::sync_with_stdio(false);
	while(true){
		int n, m, l, k, a, h;
		cin >> n >> m >> l >> k >> a >> h;
		if(n == 0){ break; }
		vector<int> f(n);
		for(int i = 0; i < l; ++i){
			int x;
			cin >> x;
			f[x] = 1;
		}
		f[a] = f[h] = 1;
		vector< vector<int> > mat(n, vector<int>(n, INF));
		for(int i = 0; i < n; ++i){ mat[i][i] = 0; }
		for(int i = 0; i < k; ++i){
			int a, b, c;
			cin >> a >> b >> c;
			mat[a][b] = mat[b][a] = c;
		}
		for(int x = 0; x < n; ++x){
			for(int i = 0; i < n; ++i){
				for(int j = 0; j < n; ++j){
					mat[i][j] = min(mat[i][j], mat[i][x] + mat[x][j]);
				}
			}
		}
		for(int i = 0; i < n; ++i){
			for(int j = 0; j < n; ++j){
				if(f[i] == 0 || f[j] == 0){ mat[i][j] = INF; }
				if(mat[i][j] > m){ mat[i][j] = INF; }
			}
		}
		for(int x = 0; x < n; ++x){
			for(int i = 0; i < n; ++i){
				for(int j = 0; j < n; ++j){
					mat[i][j] = min(mat[i][j], mat[i][x] + mat[x][j]);
				}
			}
		}
		if(mat[a][h] >= INF){
			cout << "Help!" << endl;
		}else{
			int answer = mat[a][h] + max(0, mat[a][h] - m);
			cout << answer << endl;
		}
	}
	return 0;
}

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

A = list(map(int, input().split()))
S = [-A[i] for i in range(N)]

for i in range(N):
    A[i] += i
    S[i] += i
D = {}
for i in range(N):
    if A[i] in D:
        D[A[i]][0] += 1
    else:
        D[A[i]] = [1, 0]
    if S[i] in D:
        D[S[i]][1] += 1
    else:
        D[S[i]] = [0, 1]
cnt = 0
for i in D:
    cnt += D[i][0] * D[i][1]
print(cnt)

Measured memory_bytes: 85612
#include<stdio.h>
#define R_UP(a,b) (((a)+(b)-1)/(b))
int main()
{
	int n, k;
	scanf("%d %d", &n, &k);
	int l1;
	for (int i = 0; i < n; i++)
	{
		int temp;
		scanf("%d", &temp);
		if (temp == 1)l1 = i;
	}
	int l2 = n - l1 - 1;
	int m = l1 - l1 / (k - 1) * (k - 1);
	printf("%d\n", l1 / (k - 1) + R_UP(m + l2, k - 1));
}

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

using namespace std;

int main() {
	long long n, ans = 1;
	cin >> n;
	long long arr[n];
	for(long long i = 0; i < n; ++i){
        cin >> arr[i];
	}
	sort(arr, arr + n);
	if(n == 1){
        cout << 1;
	}else if(n % 2 == 0){
        if(arr[0] == 0){
            cout << 0;
            return 0;
        }else{
            for(long long i = 0; i < n; i += 2){
                if(arr[i] != arr[i + 1]){
                    cout << 0;
                    return 0;
                }
            }
            for(long long i = 0; i < n / 2; ++i){
                ans <<= 1;
                ans %= 1000000007;
            }
        }
        cout << ans;
	}else{
        if(arr[0] != 0 || arr[1] == 0){
            cout << 0;
            return 0;
        }else{
            for(long long i = 1; i < n; i += 2){
                if(arr[i] != arr[i + 1]){
                    cout << 0;
                    return 0;
                }
            }
            for(long long i = 0; i < n / 2; ++i){
                ans <<= 1;
                ans %= 1000000007;
            }
            cout << ans;
        }
	}

	return 0;

}


Measured memory_bytes: 1024
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.run();
    }
    
    // 変数一覧
    double l;
    double a;

    public void run() {
        // 入力情報取得
        Scanner sc = new Scanner(System.in);
        l = sc.nextDouble();
        sc.close();

        // 解答処理
        solve();
    }
    
    private void solve() {
        a = l / 3.0;
        System.out.println(Math.pow(a, 3));
    }
}

Measured memory_bytes: 25172
s=input()

yy=int(s[:2])
mm=int(s[2:])

if yy <= 12 and mm <= 12 and yy != 0 and mm != 0:
    print('AMBIGUOUS')
elif mm <= 12 and mm != 0:
    print('YYMM')
elif yy <= 12 and yy != 0:
    print('MMYY')
else:
    print('NA')

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

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define MOD 1000000007LL

#define rep(i, n) for(ll (i) = 0LL;(i) < (ll)(n);(i)++)
#define rep2(i, s, e) for(ll (i) = (ll)(s);(i) < (ll)(e);(i)++)
#define repi(i, n) for(ll (i) = 0LL;(i) <= (ll)(n);(i)++)
#define repi2(i, s, e) for(ll (i) = (ll)(s);(i) <= (ll)(e);(i)++)
#define per(i, n) for(ll (i) = (ll)(n) - 1LL;(i) >= 0LL;(i)--)
#define per2(i, s, e) for(ll (i) = (ll)(s) - 1LL;(i) >= (ll)(e);(i)--)
#define peri(i, n) for(ll (i) = (ll)(n);(i) >= 0LL;(i)--)
#define peri2(i, s, e) for(ll (i) = (ll)(s);(i) >= (ll)(e);(i)--)
#define iter(i, it) for(auto &(i): (it))

template<typename T, typename U> ostream& operator<<(ostream &s, const pair<T, U> m) {
    cout << "(" << m.first << ", " << m.second << ")";
    return s;
}
template<typename T, typename U> ostream& operator<<(ostream &s, const map<T, U> m) {
    ll c = 0;
    cout << "{ ";
    iter(i, m) cout << i << (c++ == m.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const vector<T> &v) {
    cout << "{ ";
    rep(i, v.size()) cout << v[i] << (i == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const list<T> &v) {
    ll c = 0;
    cout << "{ ";
    iter(i, v) cout << i << (c++ == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}

int main(void) {
    string O, E;
    cin >> O >> E;
    reverse(O.begin(), O.end());
    reverse(E.begin(), E.end());
    while(true) {
        if(O.empty() && E.empty()) break;
        if(!O.empty()) cout << O.back(), O.pop_back();
        if(!E.empty()) cout << E.back(), E.pop_back();
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 3636
#include <stdio.h>

int main(){
  int i1[28]={};
  int i2[30] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30};
   
  for(int i = 0; i < 28; i++) scanf("%d",&i1[i]);

  for(int i:i1) for(int j:i2) if(i == j) i2[j-1] = 0;

  for(int i:i2) if(i) printf("%d\n",i);
}

Measured memory_bytes: 2760
n,W = map(int,input().split())
wt =[];val=[]

dp = [[0 for i in range(W+1)] for j in range(n)]
for _ in range(n):
  wi , vi= map(int,input().split())
  wt.append(wi)
  val.append(vi)

for i in range(W+1):
  if i>=wt[0]:
    dp[0][i]=val[0]   
  else:
    dp[0][i]=0
    
    
    
#print(dp)  
for i in range(1,n):
  wi = wt[i]
  vi = val[i]
  for w in range(1,W+1):
    if wi <= w:
      dp[i][w] = max(vi + dp[i-1][w-wi] , dp[i-1][w] )
    else:
      dp[i][w] = dp[i-1][w]

print(dp[n-1][W])        
        
        


Measured memory_bytes: 171284
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define loop(i,a,b) for (int i=a; i<b; ++i)
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll H,W;
    ll mod=1e9+7;
    cin >> H >> W;
    vector < vector<char> > input(H+1, vector<char> (W+1));
    loop(i,1,H+1) loop(j,1, W+1) cin >> input[i][j];
    vector < vector <ll> > ways(H+1, vector<ll> (W+1, 0));
    loop(i,0,H+1) ways[i][0]=0;
    loop(i,0,W+1) ways[0][i]=0;
    ways[1][1]=1;
    loop(i,1,H+1)
    {
        loop(j,1, W+1)
        {
            if (i==1 && j==1) continue;
            if (input[i][j] != '#') {
                ways[i][j] = (ways[i-1][j] + ways[i][j-1])%mod;
            }
        }
    }
    cout << ways[H][W] << "\n";
    return 0;
}

Measured memory_bytes: 9216
S=list(input())

res='Yes'
N=len(S)

def ispalindrome(s):
    h = len(s) // 2
    if (len(s)==2) & (h==1):
        if s[0]==s[1]:
            return 1
        else: return 0
    else:
        for a, b in zip(s[:h], reversed(s[h+1:])):
            if a != b: return 0
        return 1
    
if ispalindrome(S)==0:
    res='No'
else:
    for i in range(N):
        s1=S[0:(N-1)//2]
        s2=S[(N+2)//2:N]
        if (ispalindrome(s1)==0):
            res='No'
        if (ispalindrome(s2)==0):
            res='No'
print(res)

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

namespace Ccs
{


    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());

            var data = new int[n, 3];

            for (int i = 0; i < n; ++i)
            {
                string[] abc_s = Console.ReadLine().Split(' ');
                for (int j = 0; j < 3; ++j)
                    data[i, j] = int.Parse(abc_s[j]);

            }

            var tab = new int[n, 3];
            for (int i = 0; i < 3; ++i)
                tab[0, i] = data[0, i];

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

                    int t = 0;
                    for (int k = 0; k < 3; ++k)
                    {
                        if (k == j)
                            continue;

                        t = Math.Max(tab[i-1, k], t);
                    }
                    t += data[i, j];
                    tab[i,j] = t;
                }
            /*
            for (int i = 0; i < n; ++i)
            {
                for(int j = 0;j<3;++j)
                    Console.Write(tab[i,j] + " ");
                Console.Write("\n");
            }
            */
            int ans = 0;
            for (int i = 0; i < 3; ++i)
                ans = Math.Max(ans, tab[n - 1, i]);

            Console.WriteLine(ans);

        }
    }
}


Measured memory_bytes: 17344
#include<bits/stdc++.h>
#define lg long long int
#define loop(i,s,e) for(lg i=s;i<=e;i++)
#define iloop(i,s,e) for(lg i=e;i>=s;i--)
#define pb push_back
#define mp make_pair
#define mod 1000000007


using namespace std;

lg min(lg a,lg b)
{return a<b?a:b;}
lg max(lg a,lg b)
{return a>b?a:b;}
lg lcm(lg a ,lg b)
{
    return (a*b)/__gcd(a,b);
}
lg n,m,k,ans;
int main()
{
    cin>>n>>k;
    vector<lg>p(n,0);
    for(lg i=0;i<n;i++)
        cin>>p[i];

    sort(p.begin(),p.end());
    ans=0;
    for(lg i=0;i<k;i++)
        ans+=p[i];
    cout<<ans<<endl;
}


Measured memory_bytes: 3612
/*
	submission # - User: herp_sy
	https://atcoder.jp/contests/
*/

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <stdbool.h>

#define _CRT_SECURE_NO_WARNINGS
#define TLong long long
#define TBMod 1000000007

int main(int argc, char const *argv[])
{
	int h,w;
	char a[103][103] = { 0 };
	bool delV[100],delH[100];

	scanf("%d %d",&h,&w);
	for(int i = 0; i < h; ++i) scanf("%s", &a[i][0]);
 
 
	for (int i = 0; i < h; ++i) {
		delV[i] = true;
		for (int j = 0; j < w; ++j) {
			if (a[i][j] == '#') {
				delV[i] = false;
				break;
			}
		}
	}
 
	for (int i = 0; i < w; ++i) {
		delH[i] = true;
		for (int j = 0; j < h; ++j) {
			if (a[j][i] == '#') {
				delH[i] = false;
				break;
			}
		}
	}
	for (int i = 0; i < h; ++i) {
		if(delV[i]) continue;
		for (int j = 0; j < w; ++j) {
			if(!delH[j]) printf("%c", a[i][j]);
		}
		puts("");
	}
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
typedef long long int lint;

#define PI acos(-1)
#define INF64 1LL << 60
#define INF32 1 << 29
#define all(a) (a).begin(), (a).end()
#define INV ((long long int)1000000007)

using namespace std;

void execute()
{
	int A, B, C;
	cin >> A >> B >> C;

	if (C < A || B < C)
		cout << "No" << endl;
	else
		cout << "Yes" << endl;

	return;
}

int main()
{
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	execute();

	int stop;
	cin >> stop;

	return 0;
}

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

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int a, b, c;
    cin >> a >> b >> c;
    if (a + b + c >= 22) cout << "bust\n";
    else cout << "win\n";
    return 0;
}

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

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef vector<ll> vll;
typedef vector<ld> vld;
typedef vector<pll> vpl;

#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define REP1(i,n) for(int i=1;i<((int)n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define yes cout<<"Yes"<<endl
#define YES cout<<"YES"<<endl
#define no cout<<"No"<<endl
#define NO cout<<"NO"<<endl
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int MOD = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

ll gcd(ll a, ll b){
  if(b==0)
    return a;
  if(a<b)
    return gcd(b,a);

  return gcd(b,a%b);
}

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

  ll k;
  cin>>k;

  ll sum=0;
  for(ll a=1; a<=k; a++){
    for(ll b=1; b<=k; b++){
      for(ll c=1; c<=k; c++){
        sum+=gcd(a,gcd(b,c));
      }
    }
  }

  cout<<sum<<endl;

}



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

#define int long long int
#define ps push_back
#define mod 1000000007
#define fi first
#define so second
#define pii pair<int,int>
#define TT int tt;cin>>tt;for(int cc=1;cc<=tt;cc++)

signed main()
{
    double r;
    cin>>r;
    double f = 2.0 * 22.0 * r;
    f/=7.0;
    cout<<fixed<<f<<setprecision(10);
}


Measured memory_bytes: 3788
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int X = sc.nextInt();
    int[] x = new int[n];
    int[] y = new int[n];
    for(int i = 0; i < n; i++) {
      x[i] = sc.nextInt();
      y[i] = Math.abs(x[i] - X);
    }
    int d = 0;
    if(n == 1) {
      d = y[0];
    } else {
      d = gcd(y[0], y[1]);
      for(int i = 2; i < n; i++) {
        d = gcd(d, y[i]);
      }
    }
    System.out.println(d);
  }

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

Measured memory_bytes: 58628
import java.util.*;

public class Main {
    void run() {
        Scanner sc = new Scanner(System.in);
        int k = sc.nextInt();
        int[] arr = new int[]{1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

        System.out.println(arr[k- 1]);

    }

    void debug(Object... os) {
        System.err.println(Arrays.deepToString(os));
    }

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


Measured memory_bytes: 23124
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,M;
  cin >> N;
  int Max=0;
  vector<int> count(N);
  vector<string> Blue(N);
  
  for(int i=0;i<N;i++)
    cin>>Blue.at(i);
  cin >> M;
  vector<string> Red(M);
  for(int i=0;i<M;i++)
    cin>>Red.at(i);
  
  for(int i=0;i<N;i++){
    for(int j=0;j<N;j++){
      if(Blue.at(i)==Blue.at(j))
        count.at(i)++;
    }
    for(int k=0;k<M;k++){
      if(Blue.at(i)==Red.at(k))
        count.at(i)--;
    }
    if(count.at(i)>Max)
      Max=count.at(i);
  }
  cout<<Max<<endl;
}

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

#define ll long long

int main() {
  int N;
  cin >> N;
  vector<int> C(N), S(N), F(N);
  for (int i = 1; i < N; i++) {
    cin >> C[i] >> S[i] >> F[i];
  }
  
  // i駅スタートで求める
  for (int i = 1; i <= N-1; i++) {
    //初期値は i駅目のスタート
    int ans = 0;
    for (int k = i; k <= N-1; k++) {
      //k駅について
      //今の時刻がS[k]以下なら次の出発はS[k]
      //そうでないなら，ans + F[k] - (ans % F[k]) が次の出発時刻
      if (ans <= S[k]) {
        ans = S[k];
      } else {
        if (ans % F[k]) {
        ans += F[k] - (ans % F[k]);
        }
      }
      // 移動時間
      ans += C[k];
    }
    
    cout << ans << endl;
  }
  
  cout << 0 << endl;

}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((ll)(x).size())
#define len(x) ((ll)(x).length())

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // ifstream in("input.txt");
    // cin.rdbuf(in.rdbuf());
    ll h, w;
    cin >> h >> w;
    if ((h == 1) || (w == 1)) {
        cout << 1 << endl;
        return 0;
    }
    ll ans = h / 2 * w;
    if (h % 2 == 1) ans += (w + 1) / 2;
    cout << ans << endl;
    return 0;
}


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

using namespace std;
typedef long long ll;

#define MOD (long long)(1e9+7)
#define INF (1LL<<60)
#define rep(i,n) for(ll i = 0; i < (n); i++)
#define rep1(i,n) for(ll i = 1; i <= (n); i++)

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


// 最大公約数
ll gcd(ll a, ll b)
{
  if(b == 0) return a;
  return gcd(b, a % b);
}

// mod m におけるa の逆元
ll modinv(ll a, ll m) {
  ll b = m, u = 1, v = 0;
  while (b) {
    ll t = a / b;
    a -= t * b; swap(a, b);
    u -= t * v; swap(u, v);
  }
  u %= m;
  if (u < 0) u += m;
  return u;
}

// 素因数分解
vector<pair<ll, ll>> prim;
void pf(ll n)
{
  ll s = sqrt(n);
  ll r = 0;
  for(ll i = 2; i <= s; i++) {
    if((n % i) == 0) {
      r = 0;
      do {
	r++;
	n = n / i;
      } while((n % i) == 0);
      prim.push_back({i, r});
    }
  }
  if(n > s) {
    prim.push_back({n, 1});
  }
}

void solve()
{
  ll N; cin >> N;
  // ll N, K; cin >> N >> K;
  // ll x, y, z; cin >> x >> y >> z;
  // ll a, b, c; cin >> a >> b >> c;
  string s; cin >> s;
  // vector<ll> a(N); rep(i, N) cin >> a[i];
  
  ll ans = 0;
  // bool ok = false;
  ll rcnt = 0;
  ll wcnt = 0;
  rep(i, N) {
    if(s[i] == 'R') {
      rcnt ++;
    } else {
      wcnt ++;
    }
  }
  ll rwcnt = 0;
  rep(i, rcnt) {
    if(s[i] == 'W') rwcnt ++;
  }
  ll wrcnt = 0;
  rep(i, wcnt) {
    if(s[N - 1 - i] == 'R') wrcnt ++;
  }

  cerr << "rw:" << rwcnt << "  wr:" << wrcnt << endl;



  ans = rwcnt;
  cout << ans << endl;
  // cout << (ok?"Yes":"No") << endl;
}


int main(void)
{
  // ll t; cin >> t; rep(i, t)
  solve();
}


Measured memory_bytes: 3840
from collections import Counter

n = int(input())
xs = [int(c) for c in input().split()]

mod = (10 ** 9) + 7

c = Counter(xs)

for k, v in c.items():
    if v == 2:
        dup = k

dup_idx = [i for i, v in enumerate(xs) if v == dup]

facts = [1]
for i in range(1, n + 3):
    facts.append(facts[-1] * i % mod)

def inv(x):
    return pow(x, mod - 2, mod)

def comb(p, q):
    if (not 0 <= q <= p) or p < 0:
        return 0
    return facts[p] * inv(facts[q]) % mod * inv(facts[p - q]) % mod

tl = n + 1
for l in range(1, n + 2):
    use_no = comb(tl - 2, l)
    use_both = comb(tl - 2, l - 2)
    use_one = comb(tl - 2, l - 1) * 2 - comb(min(dup_idx) + (tl - 1 - max(dup_idx)), l - 1)
    print((use_no + use_both + use_one) % mod)
    # print(use_no,use_both ,use_one)

Measured memory_bytes: 70888
#include <bits/stdc++.h>
using namespace std;
 
int main()
{
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i=0; i<n; i++)
    cin >> a.at(i);
  
  int tmp = 0;
  int cnt = 0;
  bool flag = true;
  while (flag) {
    tmp = a.at(tmp) - 1;
    cnt++;
    if (cnt == n || tmp == 1) flag = false;
  }
  
  if (tmp == 1) cout << cnt << endl;
  else cout << -1 << endl;
}

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

int mod = 1'000'000'007;

int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    vector<bool> check(n + 1, false);
    vector<int> b(n + 1);

    int turn;
    for (int i = 0; i < n + 1; i++) {
        cin >> a[i];
        if (check[a[i]]) {
            turn = (n - i) + b[a[i]];
            continue;
        }
        check[a[i]] = true;
        b[a[i]] = i;
    }

    vector<long long> inv(n + 2, 0);
    inv[1] = 1;
    for (int i = 2; i < n + 2; i++){
        inv[i] = (mod - mod/i) * inv[mod % i] % mod;
    }

    vector<long long> cmb(n+2, 1);
    for (int i = 1; i < n + 2; i++){
        cmb[i] = (cmb[i - 1] * (n - i + 2) % mod) * inv[i] % mod;
    }

    vector<long long> cmb2(turn + 1, 1);
    for (int i = 1; i < turn + 1; i++){
        cmb2[i] = (cmb2[i - 1] * (turn - i + 1) % mod) * inv[i] % mod;
    }

    for (int i = 1; i < n + 2; i++) {
        if (i - 1 <= turn) cout << (mod + cmb[i] - cmb2[i - 1]) % mod << endl;
        else cout << cmb[i] << endl;
    }
}

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

int main() {
    
    string s;
    cin >> s;
    if (s == "A") {
        cout << "T" << '\n';
    }
    else if (s == "T") {
        cout << "A" << '\n';
    }
    else if (s == "G") {
        cout << "C" << '\n';
    }
    else {
        cout << "G" << '\n';
    }
}


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

typedef unsigned long long ull;
typedef long long ll;

#define rep(i,x) for(int i=0;i<x;i++)

int main()
{
  ll h,w,n,a;
  vector<ll> t;
  vector<vector<ll>> r;

  cin >> h >> w;

  cin >> n;
  rep(i,n)
  {
    cin >> a;
    t.push_back(a);
  }

  r.resize(h);
  rep(i,h)
    r[i].resize(w);
  ll x = 0, y = 0, v = 1;
  rep(i,n)
  {
    rep(j,t[i])
    {
      r[y][x] = i+1;
      if(x+v >= w || x+v < 0)
      {
        v*=-1;
        y++;
      }
      else
        x+=v;
    }
  }

  rep(i,h)
  {
    rep(j,w)
      cout << r[i][j] << " ";
    cout << endl;
  }

  return 0;
}

Measured memory_bytes: 512
#include<iostream>
#include<string>
#include<string.h>
#include<algorithm>
#include<stdio.h>
#include<cmath>
#include<vector>
#include<utility>
#include<stack>
#include<queue>

#define FOR(i, a, b) for(int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for(int i=(a);i>=(b);i--)
#define MOD 1000000007

using namespace std;

int main(void) {
	int a, b;
	int c;
	while(cin>>a>>b) {
		c = a + b;
		FOR(i, 1, 100) {
			c /= 10;
			if (c == 0) {
				cout << i << endl;
				break;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 3056
#include <iostream>
#include <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <utility>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <numeric>

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;
typedef vector<s32> vs32;
typedef vector<u32> vu32;
typedef vector<s64> vs64;
typedef vector<u64> vu64;

const double PI=3.14159265358979323846;

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

#define rep(i, N) for(int i = 0; i < N; ++i)

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL

#define IN(l, r, x) ((l) <= (x) && (x) < (r))


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

    int n;
    cin >> n;

    int cnt[10][10];
    // rep (i, 10) rep (j, 10) cnt[i][j] = 0;
    memset(cnt, 0, sizeof(cnt));
    rep (i, n + 1)
    {
        int u = i;
        while (u >= 10) u /= 10;
        ++cnt[u][i % 10];
    }

    int ans = 0;
    for (int i = 1; i < 10; ++i)
    {
        for (int j = 1; j < 10; ++j)
        {
            ans += cnt[i][j] * cnt[j][i];
        }
    }

    cout << ans << "\n";
    return 0;
}



Measured memory_bytes: 3648
import java.util.*;
import java.io.*;

public class Main {
    public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
	long a = sc.nextLong();
	double b = sc.nextDouble();
	long c = (long)Math.round(b * 100);
	long d = a * c;
	System.out.println(d / 100);
    }
}

Measured memory_bytes: 36932
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (ll i = 0; i < (int)(n); i++)
#define repR(i, n) for(ll i = n; i >= 0; i--)
#define For(i, m, n) for(ll i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()

using namespace std;

ll gcd(ll a, ll b){
    ll r = a % b;
    while(r!=0){
        a = b;
        b = r;
        r = a % b;
    }
    return b;
}

ll lcm(ll x, ll y)
{
    if(x == 0 || y == 0) {
        return -1;
    }
    
    return (x * y / gcd(x, y));
}

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

ll nCr(ll n, ll r) {
    if ( r * 2 > n ) r = n - r;
    ll dividend = 1;
    ll divisor  = 1;
    for ( ll i = 1; i <= r; ++i ) {
        dividend *= (n-i+1);
        divisor  *= i;
    }
    return dividend / divisor;
}

bool compare_by_b(pair<int, int> a, pair<int, int> b) {
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
}

ll mod = 1e9+7;

int main(){
    ll n;
    cin >> n;
    vector<ll> a(n);
    vector<ll> b(n);
    vector<ll> c(n-1);
    
    rep(i, n){
        cin >> a[i];
    }
    rep(i, n){
        cin >> b[i];
    }
    rep(i, n-1){
        cin >> c[i];
    }
    
    ll result = 0;
    ll before_ryouri = -1;
    rep(i, n){
        ll ryouri = a[i];
        result += b[ryouri-1];
        
        //cout << b[ryouri-1] << endl;
        if(ryouri - before_ryouri == 1){
            result += c[before_ryouri-1];
        }
        
        before_ryouri = ryouri;
    }
    
    cout << result << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    char c;
    while(cin>>c)
    {
        if(c=='a'||c=='e'||c=='i'||c=='o'||c=='u')
            printf("vowel\n");
        else printf("consonant\n");
    }
    return 0;
}


Measured memory_bytes: 764
s = input()
K = int(input())
substring = set()
alphabet = 'abcdefghijklmnopqrstuvwxyz'
for alp in alphabet:
    st = s[:]
    if len(substring) >= 5:
        break
    i = st.find(alp)
    while i > -1:
        for j in range(5):
            substring.add(st[i:i+j+1])
        st = st[i+1:]
        i = st.find(alp)
print(sorted(substring)[K-1])

Measured memory_bytes: 42092
ans_list = []

sosuu_list = [1 for i in range(10 ** 6)]
sosuu_list[0] = 0
sosuu_list[1] = 0
i = 2
while i < len(sosuu_list):
    d = i
    originali = i
    #print(sosuu_list[:10])
    #print(i)
    if sosuu_list[i]:
        #print(i)
        i += d
        while True:
            if i >= len(sosuu_list):
                break
            sosuu_list[i] = 0
            i += d

    i = originali + 1

#print(sosuu_list[:30])

while True:
    a, d, n = map(int, input().split())
    if a == 0 and d == 0 and n == 0:
        break
    cnt = 0
    while cnt < n:
        if sosuu_list[a]:
            #print(a)
            cnt += 1
        if cnt >= n:
            break
        a += d

    ans_list.append(a)

for i in ans_list:
    print(i)


Measured memory_bytes: 13524
#include <iostream>
#include <vector>
#include <array>
#include <list>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <tuple>
#include <memory>
#include <cmath>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <numeric>
#include <climits>
#include <cfloat>
#include <cassert>
#include <random>

int main() {
	int h, w; std::cin >> h >> w;
	std::vector<std::vector<int>> a_numbers(h, std::vector<int>(w)), b_numbers(h, std::vector<int>(w));
	std::vector<std::vector<std::vector<bool>>> possible_diff(h, std::vector<std::vector<bool>>(w, std::vector<bool>(80 * 161 + 1, false)));
	for (auto& a_line : a_numbers) for (auto& a : a_line) std::cin >> a;
	for (auto& b_line : b_numbers) for (auto& b : b_line) std::cin >> b;
	possible_diff[0][0][std::abs(a_numbers[0][0] - b_numbers[0][0])] = true;
	for (auto i = 0; i < h; ++i) for (auto j = 0; j < w; ++j) if (i != h - 1 || j != w - 1) {
		for (auto current = 0; current <= (i + j + 1) * 80; ++current) if (possible_diff[i][j][current]) {
			if (i + 1 < h) {
				const auto diff = std::abs(a_numbers[i + 1][j] - b_numbers[i + 1][j]);
				possible_diff[i + 1][j][current + diff] = true;
				possible_diff[i + 1][j][std::abs(current - diff)] = true;
			}
			if (j + 1 < w) {
				const auto diff = std::abs(a_numbers[i][j + 1] - b_numbers[i][j + 1]);
				possible_diff[i][j + 1][current + diff] = true;
				possible_diff[i][j + 1][std::abs(current - diff)] = true;
			}
		}
	}
	for (auto current = 0; current < possible_diff.back().back().size(); ++current) if (possible_diff.back().back()[current]) {
		std::cout << current << std::endl;
		return 0;
	}
}

Measured memory_bytes: 12672
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <thread>
#include <chrono>
#include <queue>

using namespace std;

int f(int p){
	int sum = 0;
	int digit = 0;

	while(p){
		digit = p % 10;
		sum += digit;
		p = p/10;
	}
	return sum;
}

int main(void){
	int n;
	cin >> n;
	if(n%f(n) == 0){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<deque>
#include<algorithm>
using namespace std;
int N,K,S;
int X[3][2000];
struct UF{
	int N;
	vector<int>p,sz;
	UF(int n):N(n),p(n),sz(n,1){
		for(int i=0;i<N;i++)p[i]=i;
	}
	int find(int u)
	{
		if(p[u]==u)return u;
		else return p[u]=find(p[u]);
	}
	bool unite(int u,int v)
	{
		u=find(u),v=find(v);
		if(u==v)return false;
		if(sz[u]<sz[v])
		{
			p[u]=v;
			sz[v]+=sz[u];
		}
		else
		{
			p[v]=u;
			sz[u]+=sz[v];
		}
		return true;
	}
};
vector<long>A;
bool dfs(int u,int p,int out,vector<vector<pair<int,long> > >&G)
{
	if(u==out)
	{
		return true;
	}
	bool ret=false;
	for(pair<int,long>&q:G[u])
	{
		if(q.first!=p)
		{
			A.push_back(q.second);
			ret|=dfs(q.first,u,out,G);
		}
	}
	return ret;
}
main()
{
	while(cin>>N>>K>>S,N)
	{
		for(int i=0;i<N;i++)
		{
			for(int j=0;j<3;j++)cin>>X[j][i];
		}
		vector<pair<pair<int,int>,long> >E;
		UF uf(N);
		vector<vector<pair<int,long> > >G(N);
		for(int i=0;i<N;i++)for(int j=i+1;j<N;j++)
		{
			int d[3];
			bool flag=true;
			for(int k=0;k<3;k++)
			{
				d[k]=S-abs(X[k][i]-X[k][j]);
				if(d[k]<=0)flag=false;
			}
			if(flag)
			{
				long t=d[0]*d[1]+d[1]*d[2]+d[2]*d[0];
				t*=2;
				E.push_back(make_pair(make_pair(i,j),t));
				uf.unite(i,j);
				G[i].push_back(make_pair(j,t));
				G[j].push_back(make_pair(i,t));
			}
		}
		long ans=-1;
		vector<bool>vis(N,false);
		for(int i=0;i<N;i++)
		{
			int u=uf.find(i);
			if(uf.sz[u]<K)vis[u]=true;
			if(vis[u])continue;
			A.clear();
			vis[u]=true;
			bool flag=false;
			for(pair<int,long>&q:G[u])
			{
				A.push_back(q.second);
				if(dfs(q.first,u,u,G))
				{
					flag=true;
					break;
				}
				reverse(A.begin(),A.end());
			}
			if(flag)
			{
				int n=A.size();
				for(int i=0;i<n;i++)A.push_back(A[i]);
			}
			int get=flag&&uf.sz[u]==K?K:K-1;
			vector<long>sum(A.size()+1,0);
			for(int i=0;i<A.size();i++)sum[i+1]=sum[i]+A[i];
			for(int i=get;i<=A.size();i++)ans=max(ans,sum[i]-sum[i-get]);
		}
		if(ans<0)cout<<-1<<endl;
		else cout<<6LL*S*S*K-ans<<endl;
	}
}


Measured memory_bytes: 3260
#include <iostream>
#include <limits.h>
#include <algorithm>
#include <math.h>
#include <vector>
#include <map>
#include <string>
using namespace std;
typedef long long ll;

int main(void){
    ll n, m, a[100010], s[100010];
    cin >> n >> m;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        a[i] %= m;
        if (i == 0) s[i] = a[i];
        else s[i] = (a[i] + s[i - 1]) % m;
    }
    
    /*
    for (int i = 0 ;i < n; i++) cout << a[i] << " ";
    cout << endl;
    for (int i = 0 ;i < n; i++) cout << s[i] << " ";
    cout << endl;*/
    
    sort(s, s + n);
    
    ll ans = 0, cons = 1;
    for (int i = 0; i < n; i++) {
        if (i == n - 1) {
            if (cons > 1) ans += cons * (cons - 1) / 2;
            if (s[i] == 0) ans += cons;
        }
        else if (s[i] == s[i + 1]) cons++;
        else {
            if (cons > 1) ans += cons * (cons - 1) / 2;
            if (s[i] == 0) ans += cons;
            cons = 1;
        }
    }
    
    cout << ans << endl;
    
    
}


Measured memory_bytes: 1792
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<cassert>
#include<vector>
#include<fstream>
#include<string>
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
#include<queue>
#include<map>
#include<set>
#include<bitset>
#include<cmath>
#include<typeinfo>

using namespace std;
#define REP(i,m,n) for(int i=m;i<n;++i)
#define REPll(i,m,n) for(ll i=m;i<n;++i)
#define INF 10000000000000000
#define MOD 1000000007
#define ll long long
#define mp make_pair
#define all(v) v.begin(),v.end()

vector<int>v(20, 0), p{ 2,3,5,7,11,13,17,19,23,29,31,37,41,43,47 };

int cal(int a) {
	int ans = 0;
	REP(i, 0, 15) {
		if (v[i] >= a) {
			ans++;
		}
	}
	return ans;
}

int main() {
	int n;
	cin >> n;
	REP(i, 0, n) {
		int tmp = i + 1;
		REP(j, 0, 15) {
			while (tmp%p[j] == 0) {
				tmp /= p[j];
				v[j]++;
			}
		}
	}
	int ans = 0;
	REP(i, 0, 15) {
		if (v[i] >= 74) {
			ans++;
		}
	}
	int a, b;
	a = cal(24);
	b = cal(2);
	ans += a*(b - 1);
	a = cal(14);
	b = cal(4);
	ans += a*(b - 1);
	a = cal(4);
	b = cal(2);
	ans += a*(a - 1)*(b - 2) / 2;
	cout << ans << endl;
	return 0;
}

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

int A[100000];

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

	map<int, int> m;
	int N, T;
	cin >> N >> T;

	int min_a = 1e9 + 10;
	int max_d = 0;
	for(int i = 0; i < N; i++) {
		cin >> A[i];
		min_a = min(min_a, A[i]);
		max_d = max(max_d, A[i] - min_a);
	}
	int ans = 0;
	for(int i = 0; i < N; i++) {
		m[A[i]]++;
		if(m.count(A[i] - max_d)) {
			ans++;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 5376
export class Main {
  static main(input: string): string {
    const tmp: string[] = input.split("\n");
    const [a, b, c, d]: number[] = tmp.shift().split(" ").map(int => parseInt(int));
    let t = a;
    let s = c;
    while (t > 0 && s > 0) {
      s -= b;
      t -= d;
    }
    return `${s <= 0 ? "Yes" : "No"}`;
  }
}
console.log(Main.main(require("fs").readFileSync("/dev/stdin", "utf8")));


Measured memory_bytes: 29640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;


int main(){
    ll N, D, X, ans = 0;
    cin >> N >> D >> X;
    ll A[N];
    for(int i = 0; i < N; i++) cin >> A[i];

    ans += X;
    for(int i = 0; i < N; i++) ans += 1 + (D - 1)  / A[i];

    cout << ans << endl;

}

Measured memory_bytes: 256
import java.util.*;
import java.lang.*;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		int A = sc.nextInt();
		int B = sc.nextInt();
		B = 2*B;
		if( A>B ){
			System.out.println(A-B);
		}else{
			System.out.println(0);
		}
	}
}


Measured memory_bytes: 22996
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int X = sc.nextInt();
    int A = sc.nextInt();
    int B = sc.nextInt();

    X -= A;
    X = X % B;
    System.out.println(X);
  }
}


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

using namespace std;

typedef long long llong;
typedef unsigned long long ullong;
#define inf 1ll<<60
#define pqueue priority_queue
#define mp make_pair
#define pb push_back
#define fn fill_n
#define int llong
#define be(x) x.begin(), x.end()
typedef pair<int, int> P;

int N;
int ABC[3];
vector<int> l;

int solve(int state, int many){
	if(many == N){
		vector<int> abc[3];
		for(int i = 0; state > 0; i++, state /= 4){
			if(state%4)
				abc[state%4-1].pb(i);
		}
		for(int i = 0; i < 3; i++)
			if(abc[i].size() == 0)
				return inf;

		int sum = 0;
		for(int i = 0; i < 3; i++){
			int res = 0, len = 0;
			for(int j = 0; j < abc[i].size(); j++)
				len += l[abc[i][j]];
			res += abs(ABC[i] - len);
			res += (abc[i].size() - 1) * 10;
			sum += res;
		}
		return sum;
	}

	int ret = inf;
	for(int i = 0; i < 4; i++)
		ret = min(ret, solve(state*4 + i, many+1));

	return ret;
}

signed main(){

	cin >> N >> ABC[0] >> ABC[1] >> ABC[2];
	l.resize(N);
	for(int i = 0; i < N; i++)
		cin >> l[i];

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

	return 0;
}

Measured memory_bytes: 256
// 03 02
#include<bits/stdc++.h>
#define fast ios::sync_with_stdio(false);cin.tie(NULL)
using namespace std;
#define int long long
#define MOD 1000000007
typedef vector<int> vi;
typedef pair<int,int> pi;
#define inf 1e18
#define For(i,a,b) for (int i = a; i < b; i++)
#define Rep(i,a,b) for (int i = a; i <= b; i++)
#define ps(x,y) fixed << setprecision(y) << x 
#define pb push_back 
#define mp make_pair 

vector<string> ans;
 
int32_t main()
{
    fast;
    int n, l; cin >> n >> l;
    For(i, 0, n) {
        string s; cin >> s;
        ans.pb(s);
    }
    sort(ans.begin(), ans.end());
    for(auto x : ans) cout << x;
    
    
    
    return 0;
}

Measured memory_bytes: 3652
# -*- coding: utf-8 -*-
from itertools import accumulate
from collections import defaultdict

n, m = map(int, input().split())
ary = [int(_) for _ in input().split()]

sum_ary = list(accumulate(ary, lambda x, y: x + y))
mod_ary = [s % m for s in sum_ary]
mod_table = defaultdict(int)
for mod in mod_ary:
    mod_table[mod] += 1
mod_table[0] += 1

print(sum([mod * (mod - 1) // 2 for mod in mod_table.values()]))


Measured memory_bytes: 19544
S = input()
s = list(S)
s_len = len(s)
s_1 = s_len-1
t = int(s_1/2)
x = 0
y = 0
z = 0

for i in range(0,t):
    if s[i] == s[s_1-i]:
        x += 1
if x == t and t%2 == 1:
    k = int((t-1)/2)
    for i in range(0,k):
        if s[i] == s[t-i-1]:
            y += 1
        if s[t+1+i] == s[s_1-i]:
            z += 1
    if y == k and z == k:
        print('Yes')
    else:
        print('No')
elif x == t and t%2 == 0:
    k = int(t/2)
    for i in range(0,k):
        if s[i] == s[t-i-1]:
            y += 1
        if s[t+1+i] == s[s_1-i]:
            z += 1
    if y == k and z == k:
        print('Yes')
    else:
        print('No')
else:
    print('No')

Measured memory_bytes: 3064
s = input()
for i in range(int(input())):
    cmds = input().split()
    cmd = cmds[0]
    a = int(cmds[1])
    b = int(cmds[2])
    if 'replace' == cmd:
        s = s[:a] + cmds[3] + s[b+1:]
    elif 'reverse' == cmd:
        s = s[:a] + s[a:b+1][::-1] + s[b+1:]
    elif 'print' == cmd:
        print(s[a:b+1])

Measured memory_bytes: 7728