akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
const long long mod = pow(10, 9) + 7;
const long long INF = 1LL << 60;
template <class T> bool chmin(T& a, T b){if (a > b) {a = b; return true;} return false;}
template <class T> bool chmax(T& a, T b){if (a < b) {a = b; return true;} return false;}
int divCeil(int A, int B) {return (A + (B - 1)) / B;}
long long divCeil(long long A, int B) {return (A + (B - 1)) / B;}
long long divCeil(int A, long long B) {return (A + (B - 1)) / B;}
long long divCeil(long long A, long long B) {return (A + (B - 1)) / B;}

int main()
{
  string S, T;
  cin >> S >> T;
  int N = S.size();
  
  string abc = "abcdefghijklmnopqrstuvwxyz";
  vector<vector<int>> V(abc.size());
  vector<vector<int>> W(abc.size());
  for (int i = 0; i < N; i++)
  {
    char c0 = S.at(i);
    char c1 = T.at(i);
    for (int j = 0; j < abc.size(); j++)
    {
      if (abc.at(j) == c0) V.at(j).push_back(i);
      if (abc.at(j) == c1) W.at(j).push_back(i);
    }
  }
  
  string ans = "Yes";
  for (int i = 0; i < abc.size(); i++)
  {
    if (ans == "No") break;
    for (int j = 1; j < V.at(i).size(); j++)
    {
      if (T.at(V.at(i).at(j - 1)) != T.at(V.at(i).at(j)))
      {
        ans = "No";
        break;
      }
    }
  }
  
  for (int i = 0; i < abc.size(); i++)
  {
    if (ans == "No") break;
    for (int j = 1; j < W.at(i).size(); j++)
    {
      if (S.at(W.at(i).at(j - 1)) != S.at(W.at(i).at(j)))
      {
        ans = "No";
        break;
      }
    }
  }
  
  /*for (int i = 0; i < abc.size(); i++)
  {
    for (int j = 0; j < V.at(i).size(); j++)
    {
      cout << V.at(i).at(j) << " ";
    }
    cout << ", ";
    for (int j = 0; j < W.at(i).size(); j++)
    {
      cout << W.at(i).at(j) << " ";
    }
    cout << endl;
  }*/
  
  cout << ans << endl;
}

Measured memory_bytes: 3080
#input of int(split by space)
def get_i()
  return gets.chomp.split(" ").map(&:to_i)
end
#input of float(split by space)
def get_f()
  return gets.chomp.split(" ").map(&:to_f)
end
#input of string(split by space)
def get()
  return gets.chomp.split(" ")
end
#input of string(split per one character)
def get_nsp()
  return gets.chomp.split("")
end
#yes or no decision
def yn_judge(bool,y="Yes",n="No")
  return bool ? y : n 
end
#create of array
def array(size1,init=nil,size2=-1)
  if size2==-1
    return Array.new(size1){init}
  else
    return Array.new(size2){Array.new(size1){init}}
  end
end

def max(a,b)
    return a>b ? a : b
end

def min(a,b)
    return a>b ? b : a
end

INF=Float::INFINITY

H,W=get_i
s=array(H)
H.times do|i|
    s[i]=get_nsp
end
Dir_=[[1,0],[0,1],[-1,0],[0,-1]]
ans=true
H.times do|i|
    W.times do|j|
      next unless s[i][j]=="#"
      flag=false
      Dir_.each do|x,y|
        nx=j+x
        ny=i+y
        next unless nx.between?(0,W-1) and ny.between?(0,H-1) and s[ny][nx]=="#"
        flag=true
      end
      unless flag
          ans=false
          break
      end
    end
end

puts yn_judge(ans)

Measured memory_bytes: 2300
IDENTIFICATION DIVISION.
PROGRAM-ID. 165B.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 INP        PIC X(20).
01 X          PIC 9(18).
01 Y          PIC 9(18).
01 LEN        PIC 9(02).
01 I          PIC 9(04). 
01 OUT        PIC Z(3)9.
*>
PROCEDURE DIVISION.
  ACCEPT INP.
  UNSTRING INP DELIMITED BY ' '
      INTO INP COUNT LEN.
*>
  IF (LEN <= 18)
    MOVE 0   TO OUT
    MOVE INP TO X
    MOVE 100 TO Y
    MOVE 1   TO I
    PERFORM VARYING I FROM 0 BY 1 UNTIL I > 3759 OR Y >= X
      COMPUTE Y = Y + Y * 0.01
    END-PERFORM
    MOVE I TO OUT
  ELSE
    MOVE 3760 TO OUT
  END-IF.
*>
  DISPLAY FUNCTION TRIM(OUT).
  STOP RUN.


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

int main(){
	string S;
	cin >> S;
	if(S[0]!= S[1] && S[1]!= S[2] && S[2]!= S[0] ){
		cout << "Yes"<<endl;
	}else{
		cout << "No" << endl;
	}
	return 0;
}

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

using namespace std;

int main(){
    int H=0;
    string S;
    cin >> S;
    int c =0;
    vector<char> str;
    for(char ch:S)
    {
        c++;
        str.emplace_back(ch);
    }
    for(int i=0;i<c/2;i++)
    {
        if(str[i] != str[c-1-i])
        {
            H++;
        }
    }
    cout << H << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n-1); i >= 0; i--)
#define all(v) (v).begin(),(v).end()
template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template <class T> T lcm(T a, T b) { return a/gcd(a,b)*b; }
typedef pair<int, int> P;
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;
const ll MOD = 1e9+7;

ll mod_pow(ll n, ll p, ll mod=MOD) {
    if(p==0) return 1;
    ll res = mod_pow(n*n%mod, p/2, mod);
    if(p%2==1) res = res * n % mod;
    return res;
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
	int n, k;
	cin >> n >> k;
    vector<ll> d(k+1);
    for (int i = 1; i <= k; i++) {
        d[i] = mod_pow(k/i, n, MOD);
    }
    for (int i = k; i > 0; i--) {
        for (int j = 2*i; j <= k; j+=i) {
            d[i] -= d[j];
            d[i] %= MOD;
        }        
    }
    ll ans = 0;
    for (int i = 1; i <= k; i++) {
        ans += d[i] * i;
        ans %= MOD;
    }
	cout << ans << "\n";
	return 0;
}


Measured memory_bytes: 3992
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
     
def main():
    x, y = LI()
    diff = abs(abs(x) - abs(y))
    if x == 0:
        if y < 0:
            diff = -y + 1
        else:
            diff = y - x
        print(diff)
        return
    if y == 0:
        if x <= 0:
            diff = -x
        else:
            diff = x + 1
        print(diff)
        return

    if abs(x) < abs(y):
        if x < 0 and y < 0:
            diff += 2
        elif x > 0 and y > 0:
            diff += 0
        else:
            diff += 1
    else:
        if x < 0 and y < 0:
            diff += 0
        elif x > 0 and y > 0:
            diff += 2
        else:
            diff += 1
    print(diff)

main()



Measured memory_bytes: 83568
#include <bits/stdc++.h>
#define FI first
#define SE second
#define EPS 1e-9
#define ALL(a) a.begin(),a.end()
#define SZ(a) int((a).size())
#define MS(s, n) memset(s, n, sizeof(s))
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define FORE(i,a,b) for (int i = (a); i >= (b); i--)
#define FORALL(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define WHATIS(x) cout << #x << " is " << x << endl;
#define ERROR(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
//__builtin_ffs(x) return 1 + index of least significant 1-bit of x
//__builtin_clz(x) return number of leading zeros of x
//__builtin_ctz(x) return number of trailing zeros of x

using namespace std;
using ll = long long;
using ld = double;
typedef pair<int, int> II;
typedef pair<ll, II> III;
typedef complex<ld> cd;
typedef vector<cd> vcd;

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cout << *it << " = " << a << endl;
    err(++it, args...);
}

const ll MODBASE = 1000000007LL;
const int MAXN = 300010;
const int MAXM = 110;
const int MAXK = 510;

int n, k;
string s;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(nullptr);
    cin >> n >> k >> s;
    s[k-1] = s[k-1] + 32;
    cout << s;
    return 0;
}

Measured memory_bytes: 256
import sys

X, Y = map(int, input().split(" "))

for t in range(X + 1):
    for c in range(X + 1):
        if X < t + c:
            break

        if Y == ((t * 4) + (c * 2)) and X == (t + c):
            print("Yes")
            sys.exit()
            
print("No")

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

long long gcd(long long a, long long b) {
  if(a < b) return gcd(b, a);
  long long r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}

long long lcm(long long a,long long b){
  return a/gcd(a,b)*b;
} 
 
int main(){
  int N;
  cin>>N;
  long long a[N];
  long long templcm=1;
  for (int i=0;i<N;i++){
    cin>>a[i];
    templcm=lcm(templcm,a[i]);
  }
 
  cout<<setprecision(20)<<templcm<<endl;
  
  return 0;
}

Measured memory_bytes: 256
import Control.Applicative ((<$>))
import Control.Monad (replicateM)

main :: IO ()
main = do
    d <- readDice <$> getLine
    n <- readLn
    ps <- replicateM n $ do
        [t,s] <- words <$> getLine
        return (t,s)
    mapM_ (putStrLn . solve d) ps

solve :: Dice -> (String,String) -> String
solve d (t',s') = east $ matchS s' $ matchT t' d

matchT :: String -> Dice -> Dice
matchT t' d@(Dice t s e w n b)
    | t' == t = d
    | t' == s = goN d
    | t' == e = goW d
    | t' == w = goE d
    | t' == n = goS d
    | t' == b = goN $ goN d

matchS :: String -> Dice -> Dice
matchS s' d@(Dice t s e w n b)
    | s' == s = d
    | s' == e = rot . rot . rot $ d
    | s' == w = rot d
    | s' == n = rot . rot $ d

goE :: Dice -> Dice
goE (Dice t s e w n b) = Dice w s t b n e
goN :: Dice -> Dice
goN (Dice t s e w n b) = Dice s b e w t n
goS :: Dice -> Dice
goS (Dice t s e w n b) = Dice n t e w b s
goW :: Dice -> Dice
goW (Dice t s e w n b) = Dice e s b t n w

rot :: Dice -> Dice
rot (Dice t s e w n b) = Dice t w s n e b

data Dice = Dice
    { top :: String
    , south :: String
    , east :: String
    , west :: String
    , north :: String
    , bottom :: String
    }

readDice :: String -> Dice
readDice str = Dice t s e w n b
    where (t:s:e:w:n:b:_) = words str

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

int main(void)
{
	ios_base::sync_with_stdio(false);    
	cin.tie(NULL);
	cout.tie(NULL);
	
	int n,m;
	cin>>n>>m;
	
	vector<ll> h(n+1);
	for(int i=1;i<=n;i++)
		cin>>h[i];
	
	vector<int> adj[n+1];
	ll a,b;
	
	for(int i=0;i<m;i++)
	{
		cin>>a>>b;
		adj[a].push_back(b);
		adj[b].push_back(a);
	}
	
	ll count=0;
	
	for(int i=1;i<=n;i++)
	{
		bool ctr=1;
		for(int j=0;j<adj[i].size();j++)
		{
			if(h[adj[i][j]]>=h[i])
			{
				ctr=0;
				break;
			}
		}
		if(ctr)
			count++;
	}
	
	cout<<count<<"\n";
	
	return 0;
}

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

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

using namespace std;

int main(){
	int n; scanf("%d",&n);
	vector<int> a(n); rep(i,n) scanf("%d",&a[i]);

	sort(a.begin(),a.end());

	int cnt=0;
	rep(i,n) if(i>0 && a[i-1]==a[i]) cnt++;
	printf("%d\n",n-(cnt+1)/2*2);

	return 0;
}


Measured memory_bytes: 640
s = input()

# 先にeraser,erase を消さないとdreameraserでaserだけ残る
sub_s = s.replace('eraser', '')
sub_s = sub_s.replace('erase', '')
sub_s = sub_s.replace('dreamer', '')
sub_s = sub_s.replace('dream', '')

if len(sub_s) == 0:
    print('YES')
else:
    print('NO')


Measured memory_bytes: 3188
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<array>
#include<map>
#include<iomanip>
#include<assert.h>
#include<bitset>
#include<stack>
using namespace std;
typedef long long int llint;
typedef long double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
/*
cout<<setprecision(20)
cin.tie(0);
ios::sync_with_stdio(false);
*/
const llint mod=1e9+7;
const llint big=2.19e15+1;
const long double pai=3.141592653589793238462643383279502884197;
const long double eps=1e-15;
template <class T,class U>void mineq(T& a,U b){if(a>b){a=b;}}
template <class T,class U>void maxeq(T& a,U b){if(a<b){a=b;}}
llint gcd(llint a,llint b){if(a%b==0){return b;}else return gcd(b,a%b);}
//llint lcm(llint a,llint b){return a/gcd(a,b)*b;}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
template<class T> void REV(T& ve){reverse(ve.begin(),ve.end());}
template<class T>llint LBI(vector<T>&ar,T in){return lower_bound(ar.begin(),ar.end(),in)-ar.begin();}
template<class T>llint UBI(vector<T>&ar,T in){return upper_bound(ar.begin(),ar.end(),in)-ar.begin();}
int main(void){
	int a,b;cin>>a>>b;
	cout<<(a+b==15?'+':(a*b==15?'*':'x'))<<endl;
	return 0;
}

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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define RFOR(i,n,m) for(int i=(int)(n); i>=(int)(m); i--)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

#define ld long double
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

/* Some Libraries */

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

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s; cin>>s;
    rep(i,s.size()){
        cout<<'x';
    }cout<<endl;
    return 0;
}


Measured memory_bytes: 384
#include<stdio.h>
#include<algorithm>
#include<functional>
using namespace std;
int main(void)
{
	long long int a,s[65001],d[65000],f,g,h,z;
	int i,j;
	while(1){
		scanf("%lld",&a);
		if(a==0) break;
		f=0;
		for(i=0;i<a;i++){
			scanf("%lld",&s[i]);
			f+=s[i];
		}
		g=f;
		f*=a;
		z=a;
		for(i=0;i<a-1;i++) scanf("%lld",&d[i]);
		sort(d,d+a-1,greater<int>());
		for(i=0;i<a-1;i++){
			g+=d[i];
			z--;
			if(g*z>=f) f=g*z;
			else break;
		}
		printf("%lld\n",f);
	}
	return 0;
}

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

#define mx 500005
#define ll long long


int ar[mx];
int n,m,k,ii;

ll tot=1000;

void stockBuySell(int m)
{
    // Prices must be given for at least two days
    if (m == 1)
        return;

    // Traverse through given price array
    int i = 1;
    while (i < m) {

        // Find Local Minima
        // Note that the limit is (n-2) as we are
        // comparing present element to the next element
        while ((i < m) && (ar[i + 1] <= ar[i]))
            i++;

        // If we reached the end, break
        // as no further solution possible
        if (i == m)
            break;

        // Store the index of minima
        int buy = i++;

        // Find Local Maxima
        // Note that the limit is (n-1) as we are
        // comparing to previous element
        while ((i <= m) && (ar[i] >= ar[i - 1]))
            i++;

        // Store the index of maxima
        int sell = i - 1;
        ll ex=tot/ar[buy];
        ll val=tot-ex*ar[buy];
        ll lav=ex*ar[sell];
        tot=lav+val;

//        cout << "Buy on day: " << buy
//             << "\t Sell on day: " << sell << endl;
    }
}

void solve()
{
   scanf("%d",&n);
   for(int i=1;i<=n;i++)scanf("%d",&ar[i]);
   stockBuySell(n);
   printf("%lld\n",tot);
}

int main()
{
   //freopen("in.txt","r",stdin);
   //freopen("out.txt","w",stdout);
   int t=1;
  // scanf("%d",&t);
   while(t--)solve();
   return 0;
}


Measured memory_bytes: 3832
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <stdio.h>
#include <time.h>
#include <numeric>
#define int long long
#define endl '\n'
#define INF 1000000000000000000
#define EPS 1e-10
#define PI 3.141592653589793238
#define all(a) a.begin(),a.end()
#define rep(i, n) for (int i = 0; i < (n); i++)
#define pb push_back
#define double long double
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<P, ll> PP;
typedef complex<double> com;
template<class T, class S> bool chmax(T &a, const S &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T, class S> bool chmin(T &a, const S &b) { if (a > b) { a = b; return 1; } return 0; }


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

	int h, w, d;
	cin >> h >> w >> d;
	for (int i = 3; i < 1000; i += 2) while (d%i == 0) d /= i;
	d *= 2;
	rep(i, h) {
		rep(j, w) {
			if ((i + j) % d < d / 2 && ((i - j) % d + d) % d < d / 2) cout << 'R';
			else if ((i + j) % d < d / 2 && ((i - j) % d + d) % d >= d / 2) cout << 'Y';
			else if ((i + j) % d >= d / 2 && ((i - j) % d + d) % d < d / 2) cout << 'G';
			else cout << 'B';
		}
		cout << endl;
	}
}

Measured memory_bytes: 512
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

var sc = bufio.NewScanner(os.Stdin)

func ini() {
	var buf = make([]byte, 10000)
	sc.Buffer(buf, 1000000)
}

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func main() {
	ini()
	line1 := nextLine()
	NK := strings.Split(line1, " ")
	N, _ := strconv.Atoi(NK[0])
	K, _ := strconv.Atoi(NK[1])
	S := nextLine()
	l := make([]int, 0)
	if string(S[0]) == "0" {
		l = append(l, 0)
	}
	for i := 0; i < N; {
		j := i
		for j < N && S[j] == S[i] {
			j++
		}
		l = append(l, j-i)
		i = j
	}
	if string(S[N-1]) == "0" {
		l = append(l, 0)
	}

	sums := make([]int, len(l)+1)
	for i := 0; i < len(l); i++ {
		sums[i+1] = sums[i] + l[i]
	}
	ans := 0
	for left := 0; left < len(sums); left += 2 {
		right := left + 2*K + 1
		if right >= len(sums) {
			right = len(sums) - 1
		}
		ans = max(ans, sums[right]-sums[left])
	}
	fmt.Println(ans)
}


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

using namespace std;

#define LL           long long
#define ULL          long long unsigned
#define LD           long double
#define FOR(i,n)     for(int i=0;i<n;i++)
#define FLR(i,n)     for(LL i=0;i<n;i++)
#define RFOR(i,n)    for(int i=n-1;i>=0;i--)
#define RFLR(i,n)    for(LL i=n-1;i>=0;i--)
#define rep(i,a,b)   for(int i=a;i<=b;i++)
#define repl(i,a,b)  for(LL i=a;i<=b;i++)
#define fast         ios_base::sync_with_stdio(0);cin.tie(0);
#define all(a)       a.begin(),a.end()
#define ABS(x)       ((x)<0?-(x):(x))
#define NL           "\n"
#define pb           push_back
#define pi           acos(-1.0)
#define prec(n)      fixed << setprecision(n)
int main()
{
    fast;
    LL ans=0,n,i,j,k,x,knt;
    string s;
    map<string,LL>mp;
    cin>>n;
    FOR(i,n){
        cin>>s;
        sort(all(s));
        mp[s]++;
        knt=mp[s];
        if(mp[s]>1){
            ans+=(knt*(knt-1)-(knt-1)*(knt-2))/2;
        }
    }
    cout<<ans;

}



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

int main(){
  int m,f,r;
  while(cin>>m>>f>>r,m+f+r != -3){
    int sum = m + f;
    if(m == -1 || f == -1){
      cout<<"F"<<endl;
    }else if(sum >= 80){
      cout<<"A"<<endl;
    }else if(sum >= 65){
      cout<<"B"<<endl;
    }else if(sum >= 50){
      cout<<"C"<<endl;
    }else if(sum >= 30){
      if( r >= 50 ) cout<<"C"<<endl;
      else cout<<"D"<<endl;
    }else{
      cout<<"F"<<endl;
    }
    
  }
  return 0;
}

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

#define int long long
typedef pair<int, int> P;
#define mod 1000000007
#define INF (1LL<<60)
 
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define repi(itr, ds) for (auto itr = ds.begin(); itr != ds.end(); itr++)
#define YES puts("YES")
#define Yes puts("Yes")
#define NO  puts("NO")
#define No  puts("No")
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
 
const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
 
 
#if 1
//-------------
// DUMPマクロ
// https://www.creativ.xyz/dump-cpp-652/
 
// vector
template <typename T>
istream& operator>>(istream& is, vector<T>& vec) {
    for (T& x : vec) is >> x;
    return is;
}
// pair
template <typename T, typename U>
ostream& operator<<(ostream& os, pair<T, U>& pair_var) {
    os << "(" << pair_var.first << ", " << pair_var.second << ")";
    return os;
}
// vector
template <typename T>
ostream& operator<<(ostream& os, const vector<T>& vec) {
    os << "{";
    for (int i = 0; i < vec.size(); i++) {
        os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
    }
    os << "}";
    return os;
}
// map
template <typename T, typename U>
ostream& operator<<(ostream& os, map<T, U>& map_var) {
    os << "{";
    repi(itr, map_var) {
        os << *itr;
        itr++;
        if (itr != map_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
// set
template <typename T>
ostream& operator<<(ostream& os, set<T>& set_var) {
    os << "{";
    repi(itr, set_var) {
        os << *itr;
        itr++;
        if (itr != set_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
 
#define DUMPOUT cerr
 
void dump_func() {
    DUMPOUT << endl;
}
template <class Head, class... Tail>
void dump_func(Head&& head, Tail&& ... tail) {
    DUMPOUT << head;
    if (sizeof...(Tail) > 0) {
        DUMPOUT << ", ";
    }
    dump_func(std::move(tail)...);
}
#ifdef DEBUG
#define DEB
#define dump(...)                                                              \
    DUMPOUT << "  " << string(#__VA_ARGS__) << ": "                            \
            << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]"        \
            << endl                                                            \
            << "    ",                                                         \
        dump_func(__VA_ARGS__)
#else
#define DEB if (false)
#define dump(...)
#endif
#endif

int func(int a, int b, int c, int d){
    return abs(a-c) + abs(b-d);
}

signed main() {

    int N, M;
    cin >> N >> M;
    vector<int> a(N), b(N), c(M), d(M);
    
    rep(i,N) cin >> a[i] >> b[i];
    rep(i,M) cin >> c[i] >> d[i];
    
    rep(i,N){
        int dist=INF;
        int idx;
        rep(j,M){
            int e = func(a[i],b[i],c[j],d[j]);
            dump(i,j,e);
            if(e<dist){
                dist=e;
                idx=j+1;
                dump(e,idx);
            }
        }
        cout << idx << endl;
    }
    
    
    return 0;
}


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

int main(){
  int h[10];
  int i;
  for(i=0;i<10;i++){
    scanf("%d",&h[i]);
  }

  sort(h, h+10);

  printf("%d\n%d\n%d\n",h[9],h[8],h[7]);
  return 0;
}

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

char c[13];
int H[10000000];
int num;



/*????????????????????£?¨?*/

int ghash(void);
int gchar(char);
void insert(void);
void find(void);



/*main??¢??°*/
int main(){
  char str[7];
  int i;


  /*????????????*/
  scanf("%d",&num);

  for(i=0;i<num;i++){
    scanf("%s %s",str,c);

    if(strcmp("insert",str)==0){
      insert();
    }
    if(strcmp("find",str)==0){
      find();
    }
  }

  return 0;
}



void insert(){
  H[ghash()] = 1;
}


void find(){
  if(H[ghash()]==1)
    puts("yes");
  else puts("no");
}


/*???????????\??¢??°*/
int ghash(void){
  int hash1=0,i,p=1;

  for(i=0;i<strlen(c);i++){
    hash1 += p*(gchar(c[i]));
    p *= 5;
  }
  return hash1;
}



int gchar(char c){

  if(c=='A')return 1;
  else if(c=='C')return 2;
  else if(c=='G')return 3;
  else return 4;

}

Measured memory_bytes: 38620
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;
typedef long long LL;
int n;
LL A,B,C;

int main()
{
    scanf("%d",&n);
    scanf("%lld%lld",&A,&B);
    for(int i=3;i<=n;i++)
    {
        LL a;
        scanf("%lld",&a);
        C ^= a;
    }
    
    LL D = (A + B - C) >> 1;
    if((A+B-C)&1||D<0||D>A||D&C)
    {
        printf("-1\n");
        return 0;
    }
    LL a = D;
    for(int i=60;i>=0;i--)
        if(C>>i&1 && (a|1ll << i)<=A)
        {
            a|=1ll<<i;
        }
    if(a==0)
    {
        printf("-1\n");
        return 0;
    }
    printf("%lld\n",A-a);
    return 0;
}

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


int buttons(int A, int B) {
  if (A > B) return 2*A-1;
  else if (A < B) return 2*B-1;
  else return 2*A;
}

int main() {
  ios::sync_with_stdio(false);
  int A, B;
  
  cin >> A >> B;
  cout << buttons(A, B);
}



Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#define p 1000000007
using namespace std;
long long n,m,a[10000001],f[10000001],inv[10000001],cnt,ans;

void line(int x){
	for(int i=2;i<=x;i++)ans*=i,ans%=p;
}

int main(){
	cin>>n;
	for(int i=1;i<=n;i++)cin>>a[i];
	inv[1]=1;
	for(int i=2;i<n;i++){
		inv[i]=(p-p/i)*inv[p%i]%p;
	}
	for(int i=1;i<n;i++){ 
		f[i]=((1*inv[i]%p*(1+f[i-1]))%p+((i-1)*inv[i]%p*f[i-1])%p)%p;
	}
	for(int i=2;i<=n;i++){
		ans=(ans+(f[i-1]*(a[i]-a[i-1])%p)%p)%p;
	}
	line(n-1);
	cout<<ans%p;
}

Measured memory_bytes: 5120
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr int INF = (1<<30)-1;

bool solve() {
    int N, M;
    int H[1505] = {};
    int W[1505] = {};
    vector<int> cnt1(1550000, 0);
    vector<int> cnt2(1550000, 0);
    cin >> N >> M;
    if (N == 0) return (false);

    for (int i = 1; i <= N; i++) {
        cin >> H[i];
        H[i] += H[i - 1];
    }
    for (int i = 1; i <= M; i++) {
        cin >> W[i];
        W[i] += W[i - 1];
    }
    for (int i = 0; i <= N; i++) {
        for (int j = i + 1; j <= N; j++) {
            cnt1[H[j] - H[i]]++;
        }
    }
    for (int i = 0; i <= M; i++) {
        for (int j = i + 1; j <= M; j++) {
            cnt2[W[j] - W[i]]++;
        }
    }
    
    ll sum = 0; 
    for (int i = 0; i < 1550000; i++) {
        sum += cnt1[i] * cnt2[i];
    }

    cout << sum << endl;
    return (true);    
}
int main() {
    while (solve());
    return (0);
}


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

using namespace std;

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

  string n;
  cin >> n;
  int64_t sum = 0;
  for (char c : n) {
    sum += (c - '0');
  }
  string ans = "Yes";
  if (sum % 9 != 0) {
    ans = "No";
  }

  cout << ans << '\n';

  return 0;
}


Measured memory_bytes: 3804
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long n,i;
    bool a=false;
    cin>>n;
    for(i=1;i<=n;i++)
    {
        if(i*100<=n&&i*105>=n)
        {
            a=true;
            break;
        }
    }
    cout<<(a?"1":"0")<<endl;
}


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

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for(int64 i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-10;

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

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value!=0>::type
fill_v(U &u,const V... v){u=U(v...);}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_v(U &u,const V... v){
  for(auto &e:u) fill_v<T>(e,v...);
}

int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int64 N;
	cin >> N;
	vector<int64> H(N);
	REP(i, N) cin >> H[i];
	int64 res = 0, now = 0;
	for (int64 i = N-2; i >= 0; i--) {
	    if (H[i+1] <= H[i]) {
	        now++;
	    } else {
	        now = 0;
	    }
	    res = max(res, now);
	}
	cout << res << endl;
}


Measured memory_bytes: 1024
import java.util.*
import java.lang.*

fun main(args: Array<String>) {
    val N = readLine()!!.toInt()

    var map = HashMap<String,Int>()
    var max = 1
    var strmap = HashMap<Int,ArrayList<String>>()

    strmap[1] = ArrayList()

    for(i in 0 until N){
        val str = readLine()!!.toString()
        if(map.containsKey(str)){
            map[str] = map[str]!! + 1
            if(!strmap.containsKey(map[str])){
                strmap[map[str]!!] = ArrayList()
            }
            strmap[map[str]]!!.add(str)

            max = Math.max(max,map[str]!!)
        }else{
            map[str] = 1
            strmap[1]!!.add(str)
        }
    }

    TreeSet(strmap[max]!!).forEach { 
        println(it)
    }

}

Measured memory_bytes: 91696
process_list = []
STDIN.each_line {|line|
  res = line.split " "
  process_list.push res
}

result_time = 0
a = process_list.shift
process_count = a[0].to_i
quantum_time = a[1].to_i
while process_list.length != 0
  process = process_list.shift
  consume_time = process[1].to_i
  if consume_time <= quantum_time
    result_time = result_time + consume_time
    print process[0], " ", result_time, "\n"
    next
  end

  result_time = result_time + quantum_time
  process[1] = (consume_time - quantum_time).to_s
  process_list.push process
end


Measured memory_bytes: 14400
l, r = map(int, input().split())
ll = l % 2019
rr = r % 2019
minn = 2019
if r - l > 2019:
    rr += 2019
for i in range(ll, rr):
    for j in range(ll + i - ll + 1, rr + 1):
        if minn > i * j % 2019:
            minn = i * j % 2019
print(minn)


Measured memory_bytes: 2940
#include <iostream>
#include <vector>
#include <unordered_map>
using namespace std;
typedef long long int LLI;

string solve(vector <int> & start, unordered_map <int,int> & services, int & n )
{
    for(int i = 0; i < start.size(); i++)
        if( services[ start[i] ] == n )
            return "POSSIBLE";
    return "IMPOSSIBLE";
}
int main()
{
    int n, m, a, b;
    bool check = false;
    cin >> n >> m;
    unordered_map <int, int> services;
    vector <int> start;
    for(int i = 0; i < m; i++)
    {
        cin >> a >> b;
        if( a == 1 ){
            start.push_back(b);
            if( b == n )
                check = true;
        }else
            services[a] = b;
    }
    
    if( check == true )
        cout << "POSSIBLE";
    else
        cout << solve(start,services,n);
}

Measured memory_bytes: 11596
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

use std::cmp;

fn main() {
    input! {
        n: i32, m: i32, x: i32,
        xs: [i32; m],
    }

    let (lhs, rhs): (Vec<i32>, Vec<i32>) = xs.into_iter().partition(|&n| n <= x);
    println!("{}", cmp::min(lhs.len(), rhs.len()));
}

Measured memory_bytes: 4352
#include <iostream>
int main(){
    using namespace std;
    int r,c,i,j,x,sum,ans;
    ans = 0;
    cin >> r >> c;
    int a[r][c];
    for(i=0;i<r;i++){
        for(j=0;j<c;j++){
            cin >> x;
            a[i][j] = x;
        }
    }
    for(i=0;i<r;i++){
        sum = 0;
        for(j=0;j<c;j++){
            cout << a[i][j] << " ";
            sum = sum + a[i][j];
        }
        cout << sum << endl;
    }
    for(j=0;j<c;j++){
        sum = 0;
        for(i=0;i<r;i++){
            sum = sum + a[i][j];
        }
        cout << sum << " ";
        ans = ans + sum;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3112
#include <iostream>
#include <vector>
#include <unordered_map>
#include <map>
#include <algorithm>
#include <set>
#include <unordered_set>
#include <deque>
#include <cmath>
#include <stack>
#include <queue>
#include <string>
#include <locale>
#include <iomanip>

#define nl '\n';

using namespace std;

int a;

int main(){

    vector<int> v;

    for(int i = 0; i < 3; i++){
        cin >> a;
        v.push_back(a);
    }

    sort(v.begin(), v.end());

    cout << v[0] + v[1];

 



}

//g++ -std=c++14 comp.cpp -o b; ./b.exe
//g++ -std=c++14 comp.cpp && ./a.out

// char** arr = new char*[r];
// for(long long i = 0; i < r; i++) arr[i] = new char[c];

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

#define MAX 1002
using namespace std;

int main(void){
	while( true ){
		int n;
		int maxSize = 0;
		int line[MAX];
		int sqsz[2][MAX] = {{0,},};

		cin >> n;
		
		if( n == 0 ) break;

		for(int i = 0; i < n; i++){
			string s;
			cin >> s;
			for(unsigned int j = 0; j < s.length(); j++){
				if( s[j] == '.' ){
					line[j+1] = 1;
					if( i == 0 ) sqsz[1][j + 1] = 1;
				}else{
					line[j+1] = 0;
					sqsz[1][j + 1] = 0;
				}
			}
			if(i > 0){
				for(int j = 0; j < n; j++){
					if( line[j + 1] ){
						sqsz[1][j+1] = min(sqsz[0][j+1], min(sqsz[0][j], sqsz[1][j])) + 1;
						maxSize = max( maxSize, sqsz[1][j+1] );
					}
				}
			}
			for(int j = 0; j < n+2; j++) sqsz[0][j] = sqsz[1][j];
		}
		cout << maxSize << '\n';
	}
	return 0;
}

Measured memory_bytes: 932
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a, b, c, d, ans;
  cin >> a >> b >> c >> d;
  ans = (a + b) - (c + d);
  
  string result;
  
  if (ans < 0) {
    result = "Right";
  }
  else if (ans == 0){
    result = "Balanced";
  }
  else {
    result = "Left";
  }
  
  cout << result << endl;
}

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

using namespace std;

typedef long long ll;
typedef pair<int,int> P;

string s;
int a[11];
int b[11];

int main()
{
	cin>>s;

	ll ans=0;

	int len=s.length();

	for(int i=0;i<(1<<(len-1));i++){
		int k=i;
		for(int j=len-2;j>=0;j--){
			if(k/(1<<j)==1){
				b[j]=1;
				k-=1<<j;
			}
			else b[j]=0;
		}
		ll kj=0;
		ll sum=0;
		for(int j=0;j<len-1;j++){
			int sj=s[j]-'0';

			if(b[j]==1){
				sum+=kj*10+sj;
				kj=0;
			}
			else{
				kj=kj*10+sj;
			}
		}
		sum+=kj*10+(int)(s[len-1]-'0');
		ans+=sum;
	}
	cout<<ans<<endl;
	
	return 0;
}

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

// ????°??????¨??? O(F |E| |V|)
struct MinCostFlow
{
    typedef pair<int, int> P;   // first -> minDist, second -> v
    struct Edge
    {
        int to, cap, cost, rev;
    };
    const int V;
    vector<vector<Edge>> G;
    vector<int> dist, prevv, preve;
    MinCostFlow(int v) : V(v), G(v), dist(v), prevv(v), preve(v){}
    void add_edge(int from, int to, int cap, int cost) {
        G[from].push_back({to, cap, cost, (int)G[to].size()});
        G[to].push_back({from, 0, -cost, (int)G[from].size()-1});
    }
    // minCostFlow s -> t
    // noexist flow return -1
    int min_cost_flow(int s, int t, int f) {
        int res = 0;
        while(f > 0) {
            for(int i = 0; i < V; ++i) dist[i] = INF;
            dist[s] = 0;
            bool update = true;
            while(update) {
                update = false;
                for(int v = 0; v < V; ++v) {
                    if(dist[v] == INF) continue;
                    for(int i = 0; i < G[v].size(); ++i) {
                        Edge& e = G[v][i];
                        if(e.cap > 0 && dist[e.to] > dist[v] + e.cost) {
                            dist[e.to] = dist[v] + e.cost;
                            prevv[e.to] = v;
                            preve[e.to] = i;
                            update = true;
                        }
                    }
                }
            }
            if(dist[t] == INF) return -1;
            int d = f;
            for(int v = t; v != s; v = prevv[v]) {
                d = min(d, G[prevv[v]][preve[v]].cap);
            }
            f -= d;
            res += d * dist[t];
            for(int v = t; v != s; v = prevv[v]) {
                Edge& e = G[prevv[v]][preve[v]];
                e.cap -= d;
                G[v][e.rev].cap += d;
            }
        }
        return res;
    } 
};


int main(){
    int V, E, F;
    cin >> V >> E >> F;
    MinCostFlow f(V);
    rep(i, E) {
        int a, b, c, d;
        cin >> a >> b >> c >> d;
        f.add_edge(a, b, c, d);
    }
    cout << f.min_cost_flow(0, V-1, F) << endl;
    return 0;
}

Measured memory_bytes: 3160
#include <algorithm>
#include <bitset>
#include <cfloat>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits.h>
#include <list>
#include <map>
#include <math.h>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<=n;i++)
#define int long long
#define ll long long
#define eps LDBL_EPSILON
#define mod 1000000007
#define double long double
#define INF LLONG_MAX/10
#define P pair<int,int>
#define prique priority_queue
using namespace std;
signed main() {
	int n;
	cin >> n;
	int ans = 0;
	REP(i, n) {
		if ((int)log10(i) % 2 == 0)ans++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 512
#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>
#include<string>

using namespace std;


typedef pair<long long , int> P;

bool pairCompare(const P& firstElof, const P& secondElof){
  return firstElof.first < secondElof.first;
}

int main(){
  int n , m;
  vector< P > v;
  long long a[100000];
  int b[100000];
  cin >> n >> m;
  for(int i = 0; i < n ; i++){
    cin >> a[i] >> b[i];
    v.push_back(P(a[i], b[i]));
  }
  sort(v.begin(), v.end(), pairCompare);
  long long cost = 0;
  long long temp = 0;
  for(int i = 0; i < n ; i++){
    if(temp == m) break;
    if(temp + v[i].second <= m){
      temp += v[i].second;
      cost += v[i].first * v[i].second;
    }
    else{
      cost += v[i].first * (m - temp);
      temp = m;
    }
  }
  cout << cost << endl;
}


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

long long int n;

int main(){
  cin >> n;
  long long int sum = 0;
  long long int max = 0;
  long long int cnt = 1;
  while(sum < n){
    sum += cnt;
    cnt++;
  }
  long long int omit = sum - n;
  cerr << omit << endl;
  for(long long int i = 1; i < cnt; i++){
    if(i == omit){
      continue;
    }
    cout << i << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
main(){
  int n,k;
  cin>>n>>k;
  int ans=0;
  for(int i=0;i<n;++i){
    int a;
    cin>>a;
    ans+=min(2*a,2*abs(a-k));
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
a, b, h, m = gets.split.map(&:to_f)
pi = Math.atan2(1, 1)*4
aa = (h * 60 + m) / (60 * 12)
ba = m / 60
d = (aa - ba).abs * 2 * pi
puts Math.sqrt(a * a + b * b - 2 * a * b * Math.cos(d))

Measured memory_bytes: 14792
from time import time
from random import random

limit_secs = 2
start_time = time()

D = int(input())
c = list(map(int, input().split()))
s = [list(map(int, input().split())) for _ in range(D)]

def calc_score():
    score = 0
    S = 0
    last = [-1] * 26
    for d in range(D):
        S += s[d][t[d]]
        last[t[d]] = d
        for i in range(26):
            S -= c[i] * (d - last[i])
        score += max(10 ** 6 + S, 0)
    return score

def calc_satisfaction():
    S = 0
    last = [-1] * 26
    for d in range(D):
        S += s[d][t[d]]
        last[t[d]] = d
        for i in range(26):
            S -= c[i] * (d - last[i])
    return S

def solution():
    return [i % 26 for i in range(D)]

t = solution()
#S = calc_satisfaction()
score = calc_score()
while time() - start_time < limit_secs * 0.9:
    d = int(random() * D)
    q = int(random() * 26)
    old = t[d]
    t[d] = q
    #new_S = calc_satisfaction()
    new_score = calc_score()
    #if new_S < S:
    if new_score < score:
        t[d] = old
    else:
        #S = new_S
        score = new_score
print('\n'.join(str(e + 1) for e in t))


Measured memory_bytes: 85096
#include<iostream>
#include<stdio.h>
#include<vector>
#include<ctype.h>
#include<string>
#include<cmath>
#include<string.h>
#include<sstream>
#include<limits.h>
using namespace std;

int gcd(int a,int b){
    return b ? gcd(b,a%b):a;
}

int lcm(int a,int b){
    return a/gcd(a,b)*b;
}

// bool isPrime(int x){
//     int i;
//     if(x<2)return 0;

// }


int X,K=0;
int rad=0;
int main(){
    cin>>X;
    while(1){
        K++;
        rad+=X;
        if(rad%360==0){
            cout<<K<<endl;
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 3632
from collections import deque


N = int(input())
b = deque()

for i in range(N):
    a = input().split()
    
    if a[0] == 'insert':
        b.appendleft(a[1])
        
    elif a[0] == 'delete':
        try:
            b.remove(a[1])
        except ValueError:
            pass
            
    elif a[0] == 'deleteFirst':
        b.popleft()
        
    else:
        b.pop()
        

print(*b)


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

int main()
{
    int a, b, c, d, e, k;
    cin >> a >> b >> c >> d >> e >> k;

    if (e - a > k) cout << ":(" << endl;
    else cout << "Yay!" << endl;
    return 0;
}

Measured memory_bytes: 764
n,m=map(int,input().split())
k=[0]*m
s=[0]*m
for i in range(m):
  tmp = list(map(int,input().split()))
  k[i] = tmp[0]
  s[i] = tmp[1:]
p=list(map(int,input().split()))

res=0
for bit in range(2**n):
  for i in range(m):
    cnt=0
    for sw in s[i]:
      if (bit >> (sw-1) & 1):
        cnt += 1
    if cnt % 2 != p[i]:
      break
  else:
    res+=1
print(res)

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

class Cube {
public:
  int f[6];
  Cube(void){}
  void roll_z(void) {
    roll(1,2,4,3);
  } 
  void roll_y(void) {
    roll(0,2,5,3);
  }
  void roll_x(void) {
    roll(0,1,5,4);
  }
  void roll(int i,int j,int k,int l) {
    int t = f[i];
    f[i] = f[j];
    f[j] = f[k];
    f[k] = f[l];
    f[l] = t;
  }
};

bool eq(Cube c1,Cube c2) {
  for (int i=0; i<6; i++) {
    if (c1.f[i]!=c2.f[i]) {
      return false;
    }
  }
  return true;
}

bool equal(Cube c1,Cube c2) {
  for (int i=0; i<6; i++) {
    for (int j=0; j<4; j++) {
      if (eq(c1,c2)) {
        return true;
      }
      c1.roll_z();
    }
    if (i%2==0) {
      c1.roll_y();
    } else {
      c1.roll_x();
    }
  }
  return false;
}

Cube C[100]; int n;

bool check(void) {
  for (int i=0; i<n-1; i++)
    for (int j=i+1; j<n; j++) {
      if (equal(C[i],C[j])) {
        return false;
      }
    }
  return true;
}

int main(void) {
  cin >> n;
  for (int j=0; j<n; j++) {
    for (int i=0; i<6; i++) {
      cin >> C[j].f[i];
    }
  }
  if (check()) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 3080
#include <iostream>
#include <cmath>
#include<iomanip>
using namespace std;

int main()
{
	int n;
	while (cin >> n, n){
		int sum = 0;
		int s[1001] = { 0 };
		for (int i = 0; i < n; i++){
			cin >> s[i];
			sum += s[i];
		}
		double ave = (double)sum / (double)n;
		double b = 0;
		for (int i = 0; i < n; i++){
			b += (s[i] - ave) * (s[i] - ave);
		}
		cout << fixed << setprecision(8);
		cout << sqrt(b / n) << endl;
	}
	return 0;
}

Measured memory_bytes: 1240
#include<stdio.h>
#include<string.h>
#define M 1500000
#define N (-1)
#define L 14

char H[M][L];

int getChar(char ch){
  if ( ch == 'A') return 1;
  else if ( ch == 'C') return 2;
  else if ( ch == 'G') return 3;
  else if ( ch == 'T') return 4;
}

long long getKey(char str[]){
  long long sum = 0, p = 1, i;
  for ( i = 0; i < strlen(str); i++ ){
    sum += p*(getChar(str[i]));
    p *= 5;
  }
  return sum;
}

int h1(int key){ return key%M;}
int h2(int key){ return 1+(key%(M-1));}

int find(char str[])
{
  long long i,k,h;

  k = getKey(str);

  for(i=0 ;; i++){
    h = (h1(k)+i*h2(k))%M;
    if(strcmp(H[h],str) == 0)
      return 1;
    else if(strlen(H[h]) == 0)
      return 0;
  }
  return 0;
}

int insert(char str[])
{
  long long i,k,h;

  k = getKey(str);

  for(i=0 ;; i++){
    h = (h1(k)+i*h2(k))%M;
    if(strcmp(H[h],str) == 0)
      return 1;
    else if(strlen(H[h]) == 0 ){
      strcpy(H[h],str);
      return 0;
    }
  }
  return 0;
}

int main(){
  int i, n, h;
  char str[L],com[9];
  for (i=0; i<M; i++)
    H[i][0] = '\0';

  scanf("%d",&n);

  for(i=0; i<n; i++){
    scanf("%s %s",com,str);
    if(com[0] == 'i'){
      insert(str);
    }
    else{
      if(find(str)){
        printf("yes\n");
      }
      else{
        printf("no\n");
      }
    }
  }
  return 0;
}


Measured memory_bytes: 22300