akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <cmath>
#include <limits>
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define rep1(i,n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
#define repr(i,n) for(int i=0, i##_len=(n); i<i##_len; --i)
#define REP(i,m,n) for(int i=int(m), i##_len=(n); i<i##_len; ++i)
#define VV(T) vector<vector<T>>
#define co(P) cout << P << endl
#define ci(P) cin >> P
#define pb push_back
using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi;;
typedef long long ll;
typedef double d;

int main(){
  d A,B,H,M;
  static const d pi = 3.141592653589793;
  d Hang, Mang, alpha, dist;
  ci(A >> B >> H >> M);
  Hang = 2*pi*(H/12+(M/60)/12);
  Mang = 2*pi*(M/60);
  if(Hang > Mang){
    alpha = Hang-Mang;
    dist = A*A+B*B-2*A*B*cos(alpha);
    dist = sqrt(dist);
  }
  else if(Hang < Mang){
    alpha = Mang-Hang;
    dist = A*A+B*B-2*A*B*cos(alpha);
    dist = sqrt(dist);
  }
  if(Hang == Mang){
    if(H>=6 && H < 12){
      if(M<30){
        dist = A + B;
      }
      if(M>=30){
        dist = A - B;
        if(dist < 0) dist = (-1)*dist;
      }
    }
    if(H<6){
      if(M>30){
        dist = A + B;
      }
      if(M<=30){
        dist = A - B;
        if(dist < 0) dist = (-1)*dist;
      }
    }
  }
  cout << fixed << setprecision(16);
  co(dist);
}

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

main(){

  ll n,m;
  cin>>n>>m;
  vector<ll> k(m),p(m);
  vector<set<ll>> s(m);
  rep(i,m){
    cin>>k[i];
    rep(j,k[i]){
      ll x;
      cin>>x;
      x--;
      s[i].insert(x);
    }
  }
  rep(i,m)cin>>p[i];

  ll ans=0;
  for(ll b=0;b<(1LL<<n);++b){
    bitset<16> bit(b);
    vector<ll> a(m);
    rep(k,12){
      if(bit[k]){
        rep(i,m){
          if(s[i].find(k)!=s[i].end())a[i]++;
        }
      }
    }
    rep(i,m)a[i]%=2;
    if(p==a)ans++;
  }
  cout<<(ans)<<endl;

}

Measured memory_bytes: 256
#*******************************************************************/
#* This program demonstrates the speedup for a Fenwick tree vs a   */
#* flat array for performing multiple prefix sums.  It generates a */
#* sequence of random numbers, then performs 1000 summations,      */
#* each of which starts and ends at random indices.                */
#*******************************************************************/
class FenwickTree
  attr_accessor :n, :array, :bit

  def initialize(n, array = nil)
    @n = n
    @bit = Array.new(@n+1, 0)
    if array.nil?
      @array = Array.new(@n,0)
    else
      @array = array.dup
    end
    for i in 0..n
      add(i,@array[i])
    end
  end

  def sum(idx)
    ans = 0
    idx += 1
    while not idx.zero?
      ans += @bit[idx]
      least = idx&-idx
      idx -= least
    end
    ans
  end

  def range(left, right)
    if left > right
      0
    else
      sum(right)-sum(left-1)
    end
  end

  def add(idx, x)
    idx += 1
    while idx <= @n
      @bit[idx] += x
      least = idx&-idx
      idx += least
    end
  end
end

lines = $stdin.read
array = lines.split("\n")
n,q = array[0].split(" ").map(&:to_i)
ft = FenwickTree.new(n, Array.new(n,0))

array[1..1+q].each do |s|
  com,x,y = s.split(" ").map(&:to_i)
  if com == 0
    ft.add(x-1,y)
  else
    puts ft.range(x-1,y-1)
  end
end



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

int main()
{
  int h,w;
  cin >> h >> w; 
  
  char buf[w+1];

  int map[h][w];
  for(int i=0;i<h;i++){
    cin >> buf;
    for(int j=0;j<w;j++){
      map[i][j]=buf[j]-'0';
    }
  }

  int dp[h][w];
  for(int i=0;i<h;i++){for(int j=0;j<w;j++){dp[i][j]=0;}}
  for(int i=1;i<w;i++){dp[0][i]=map[0][i]+dp[0][i-1];}  
  for(int i=1;i<h;i++){dp[i][0]=map[i][0]+dp[i-1][0];}

  for(int i=1;i<h;i++){
    for(int j=1;j<w;j++){
      dp[i][j]=min(dp[i-1][j]+map[i][j],dp[i][j-1]+map[i][j]);
    }
  }

  //cout << endl;
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      //cout << dp[i][j] << " ";
    }
    //cout << endl;
  }

  cout << dp[h-1][w-1] << endl;
}

  

Measured memory_bytes: 1184
package main

import (
	"fmt"
)

func main() {
	var a, b, c, d int
	fmt.Scanf("%d %d %d %d", &a, &b, &c, &d)

	for a > 0 && c > 0 {
		c -= b
		if c <= 0 {
			break
		}
		a -= d
	}

	if a <= 0 {
		fmt.Println("No")
	} else {
		fmt.Println("Yes")
	}
}


Measured memory_bytes: 1816
#include <vector>
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <limits.h>
#include <cmath>
#include <queue>
#include <map>
#include <iomanip>
#include <random>
#include <fstream>
#include <cassert>
#define rep(i, n) for (int i = 0; i < n; i++)
#define PI 3.14159265358979323846
#define MOD 1000000007
#define vi vector<int>
using namespace std;
using ll = long long;

// ----ここから下は以前競プロをやっていた時に使っていたものです----　

const int MAX = 1000000;

ll fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < MAX; i++){
    fac[i] = fac[i - 1] * i % MOD;
    inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
    finv[i] = finv[i - 1] * inv[i] % MOD;
  }
}

// 二項係数計算
long long COM(int n, int k){
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

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

template <class T> struct cord{
  T x,y;
};

template <class T> double dist(cord<T> a, cord<T> b){
  T dx=a.x-b.x;
  T dy=a.y-b.y;
  return sqrt(dx*dx+dy*dy);
}

struct s{
  int p,i,r;
};

//比較関数（降順）
bool cmpP(const s &a, const s &b){
  return a.p > b.p;
}

//比較関数（昇順）
bool cmpI(const s &a, const s &b){
  return a.i < b.i;
}

// ----本問について----
// 問題：Princess' Marriage
// 問題文URL：https://onlinejudge.u-aizu.ac.jp/problems/2019
// 所要時間：30分
// 学んだこと：
// ------------------

// ----ここから本問のソースコード----

// グローバル変数（入力）
int n,m,d[10010],p[10010];

int solve() {
  int answer=0;
  vector< pair<int,int> > pd(n);
  rep(i,n){
    cin >> pd[i].second >> pd[i].first;
  }
  sort(begin(pd),end(pd));
  reverse(begin(pd),end(pd)); // 降順ソート
  /*
  rep(i,n){
    cout << "(" << pd[i].first << ", " << pd[i].second << ")" << endl;
  }
  cout << "-------------------------" << endl;
  */
  int sum=0;
  int index=n;
  rep(i,n){
    sum += pd[i].second;
    if (sum > m){
      index=i;
      break;
    }
  }
  rep(i,index){
    pd[i].second = 0;
  }
  if (index != n){pd[index].second = sum - m;}
  rep(i,n){
    answer += pd[i].first * pd[i].second;
  }

  return answer;
}

int main()
{

  //cout << fixed << setprecision(10);
  while (cin >> n >> m && n > 0){
    cout << solve() << endl;
    //solve();
  }


  return 0;
}



Measured memory_bytes: 3160
def combination(n, x):
    cnt = 0
    for i in range(1, n+1):
        for j in range(1, n+1):
            for k in range(1, n+1):
                if k < j < i:
                    if i+j+k == x:
                        cnt += 1
    return cnt
        


while True:
    nx = input().split()
    n = int(nx[0])
    x = int(nx[1])

    if n == 0 and x == 0:
        break
    else:
        print(combination(n, x))



Measured memory_bytes: 5600
// template.cpp

// Defines.
//#define DEBUG
#define NUMBER_OF_DIGITS 6

// Includes.
#include <bits/stdc++.h>

#ifdef DEBUG
#include <chrono>
#endif

// Usings.
using namespace std;

// Main function.
int main()
{
#ifdef DEBUG
	chrono::system_clock::time_point start, end;
	
	start = chrono::system_clock::now();
#endif
	
	// settings.
	ios::sync_with_stdio(false);
	
	//cout << fixed;
	//cout << setprecision(NUMBER_OF_DIGITS);
	
	// logic.
	int n, m;
	cin >> n >> m;
	
	int s_bits[m];
	for (int i = 0; i < m; i++)
	{
		int number_of_switches;
		cin >> number_of_switches;
		
		int s_bit = 0;
		for (int j = 0; j < number_of_switches; j++)
		{
			int s;
			cin >> s;
			
			s_bit |= (1 << (s - 1));
		}
		
		s_bits[i] = s_bit;
	}
	
	int ps[m];
	for (int i = 0; i < m; i++)
	{
		cin >> ps[i];
	}
	
	int counter = 0;
	for (int i = 0; i < (1 << n); i++)
	{
		bool all_on = true;
		for (int j = 0; j < m; j++)
		{
			int s_bit = s_bits[j];
			int bit_and = s_bit & i;
			
			if ((__builtin_popcount(bit_and) % 2) != ps[j])
			{
				all_on = false;
				break;
			}
		}
		
		if (all_on == true)
		{
			counter++;
		}
	}
	
	cout << counter << endl;
	
#ifdef DEBUG
	end = chrono::system_clock::now();
	
	double elapsed = chrono::duration_cast<std::chrono::milliseconds>(end-start).count();
	cout << elapsed << "[ms]" << endl;
#endif
	
	return 0;
}


Measured memory_bytes: 256
extern crate core;

use std::io::{self, Read};

fn main() {
    let mut input = String::new();
    io::stdin().read_to_string(&mut input).unwrap();
    let output = run(input.trim().to_string());
    println!("{}", output);
}

fn run(input: String) -> String {
    let m = input.parse::<i32>().unwrap();
    (24 + 24 - m).to_string()
}

#[test]
fn test() {
    let tests = vec![("21", "27"), ("12", "36")];
    for (i, (input, output)) in tests.into_iter().enumerate() {
        println!("test:{}", i);
        assert_eq!(run(input.to_string()), output.to_string());
    }
}


Measured memory_bytes: 4352
#include <stdio.h>

int main()
{
	int n;
	int a[200000];

	scanf("%d", &n);
	int i;
	for(i = 0; i < n; ++i)
		scanf("%d", &a[i]);
	int result;
	int j;
	int counter = 0;

	for(i = 0, j = 1; i < n; ++i){
		if(a[i] == j){
			++counter;
			++j;
		}
	}
	result = n - counter;	
	if(result == n)
		printf("-1\n");
	else
		printf("%d\n", result);
	return 0;
}

Measured memory_bytes: 896
import math
N,M = (int(i) for i in input().split())

ans = 0

if abs(N-M) ==0:
  ans = math.factorial(N) * math.factorial(M) * 2
elif abs(N-M) == 1:
  ans = math.factorial(N) * math.factorial(M)
else:
  ans = 0

print(ans%((10**9)+7))


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

int main() {
	int N; cin >> N;
	int a[300010];
	for(int i=0; i<3*N; ++i) cin >> a[i];
	sort(a, a + 3*N,greater<int>());
	long S=0;
	for(int i=0; i<2*N; i += 2) S += a[i+1];
	cout << S << endl;
	return 0;
}


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

int main()
{
    string s;

    int alp[26] = {};

    while (cin >> s) {
        for (int i = 0; i < s.length(); i++) {
            if (s[i] < 'A') continue;
            if (s[i] < 'a') alp[s[i] - 'A']++;
            else alp[s[i] - 'a']++;
        }
    }

    for (int i = 0; i < 26; i++) {
        char c = 'a' + i;
        cout << c << " : " << alp[i] << endl;
    }

    return 0;
}

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

using namespace std;
typedef long long llong;

const int mod = 1e9 + 7;
int f[100002];
int r[100002];

int pw(int x, int p) {
    int r = 1;
    while (p) {
        if (p & 1) r = (llong)r * x % mod;
        x = (llong)x * x % mod;
        p >>= 1;
    }
    return r;
}

int nCk(int n, int k) {
    if (n < k || k < 0) return 0;
    return (llong)f[n] * r[n - k] % mod * r[k] % mod;
}

int n;
int pr[100001];
int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin >> n;
    f[0] = 1;
    for (int i = 1; i <= n + 1; ++i) f[i] = (llong)f[i - 1] * i % mod;
    r[n + 1] = pw(f[n + 1], mod - 2);
    for (int i = n + 1; i--; ) r[i] = r[i + 1] * (i + 1ll) % mod;
    int s, e;
    for (int i = 1; i <= n + 1; ++i) {
        int x;
        cin >> x;
        if (pr[x]) s = pr[x], e = i;
        pr[x] = i;
    }
    for (int i = 1; i <= n + 1; ++i) {
        int ans = nCk(n - 1, i);
        ans += nCk(n - 1, i - 2);
        ans %= mod;
        ans += nCk(n + 1 - (e - s + 1), i - 1);
        ans %= mod;
        ans += ((nCk(n - 1, i - 1) + mod - nCk(n + 1 - (e - s + 1), i - 1)) % mod << 1) % mod;
        ans %= mod;
        printf("%d\n", ans);
    }
    return 0;
}

Measured memory_bytes: 2432
from collections import deque
n = int(input())
A = [int(input()) for _ in range(n)]
# ans = []
#
# for _ in range(n):
#     tmp = A.popleft()
#     print(max(A))
#     A.append(tmp)

# 時間がかかるのはソートだけ。
sorted_A = sorted(A, reverse=True)
max_val = sorted_A[0]
second_val = sorted_A[1]

for i in range(n):
    # 索引は速いらしい
    if A[i] != max_val:
        print(max_val)
    else:
        print(second_val)


Measured memory_bytes: 14444
#include <iostream>
#include <map>

using namespace std;

void solve()
{
	int a[5];
	char temp;
	while(~scanf("%d,%d,%d,%d,%d%c", &a[0], &a[1], &a[2], &a[3], &a[4], &temp))
	{
		map<int, int> Map;
		for(int i = 0; i < 5; ++i)
		{
			Map[a[i]]++;
		}
		if(Map.size() == 2)
		{
			map<int, int>::iterator Ite = Map.begin();
			if(Ite->second == 1 || Ite->second == 4)
			{
				cout << "four card" << endl;
			}
			else if(Ite->second == 2 || Ite->second == 3)
			{
				cout << "full house" << endl;
			}
		}
		else if(Map.size() == 3)
		{
			for(map<int, int>::iterator Ite = Map.begin(); Ite != Map.end(); ++Ite)
			{
				if(Ite->second == 2)
				{
					cout << "two pair" << endl;
					break;
				}
				else if(Ite->second == 3)
				{
					cout << "three card" << endl;
					break;
				}
			}
		}
		else if(Map.size() == 4)
		{
			cout << "one pair" << endl;
		}
		else
		{
			map<int, int>::iterator Ite = Map.begin();
			map<int, int>::iterator IteNext = Map.begin();
			++IteNext;
			map<int, int>::iterator IteEnd = Map.end();
			IteEnd--;
			if(IteEnd->first - Ite->first == 4 || IteNext->first - Ite->first == 9)
			{
				cout << "straight" << endl;
			}
			else
			{
				cout << "null" << endl;
			}
		}
	}
}

int main()
{
	solve();
	return(0);
}

Measured memory_bytes: 0
l = [int(i) for i in input().split(" ")]
h = l[0]
w = l[1]
m = []

def trans(matrix):
    t_matrix = []
    h = len(matrix)
    w = len(matrix[0])
    for i in range(w):
        row = []
        for j in range(h):
            row.append(matrix[j][i])
        t_matrix.append(row)
    return t_matrix

def remove_dot(matrix):
    new_matrix = []
    for row in matrix:
        if "#" not in row:
            pass
        else:
            new_matrix.append(row)
    return new_matrix

for i in range(h):
    m.append(list(input()))
for i in range(2):
    m = remove_dot(m)
    m = trans(m)
for row in m:
    print("".join(row))


Measured memory_bytes: 3188
#include<bits/stdc++.h>
#define mod 1000000007;
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef long long int li;
using namespace std;
int main()
{
    fast_io;
  li n;
  cin>>n;
  string s;
  cin>>s;
  if(n<3200)
    cout<<"red";
  else
    cout<<s;
    return 0;
}

Measured memory_bytes: 256
while 1:
        try:
                P = map(float,raw_input().split())
        except EOFError:
                break
        x = (P[2]*P[4]-P[5]*P[1])/(P[0]*P[4]-P[3]*P[1])
        y = (P[2]*P[3]-P[5]*P[0])/(P[1]*P[3]-P[4]*P[0])
        x = x if x else 0
        y = y if y else 0
        print "{:.3f} {:.3f}".format(x,y)

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

using namespace std;

int main(){
    int K;
    string S;
    cin>>K>>S;
    if(S.size()<=K){
        cout<<S<<endl;
    }else
    {
        cout<<S.substr(0,K)+"..."<<endl;
    }

 return 0;   
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
typedef long long ll;
#define ALL(l)  (l).begin(),(l).end()
#define rep(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
using namespace std;

//const ll mod =  1000000007;
//const ll maxn = 1000000000;

//---------------------------------------------------------------------------------------------------
using vi = vector<int>; // intの1次元の型に vi という別名をつける
using vll = vector<ll>; // intの1次元の型に vi という別名をつける
using vvll = vector<vll>; // intの2次元の型に vvi という別名をつける
using vs = vector<string>; // stringの1次元の型に vs という別名をつける
using pll = pair<ll, ll>; // これ以降 pii という型名はpair<ll, ll> と同じ意味で使える
//---------------------------------------------------------------------------------------------------

int main() {
   int n,a,b;
   cin>>n;
   vi k(n),p(n),q(n);
   
   rep(i,n)k.at(i)=i+1;
   rep(i,n)cin>>p.at(i);
   rep(i,n)cin>>q.at(i);
   int i=0;
   do {
       i++;
       if(k==p)a=i;
       if(k==q)b=i;
       
  } while (next_permutation(ALL(k)));
  cout<<abs(a-b)<<endl;

}



Measured memory_bytes: 3540
#include <stdio.h>

void main() {
    int a, b, c, d;
    int t_hp, a_hp;

    scanf("%d %d %d %d", &a, &b, &c, &d);

    a_hp = c;
    t_hp = a;

    while(1){
        //Takahashi attack
        a_hp -= b;
        if(a_hp <= 0){
            printf("Yes\n");break;
        }
        //Aoki attack
        t_hp -= d;
        if(t_hp <= 0){
            printf("No\n");break;
        }
    }
}

Measured memory_bytes: 1664
n = int(input())
a = sorted(list(map(int, input().split())))
ans, count, val = 0, 1, 0

for i in range(len(a)-1):
    if a[i] == a[i+1]:
        count += 1
    else:
        ans += 1
        val += count-1
        count = 1
val += count-1
ans += 1

if val%2 != 0:
    ans -= 1
print(ans)
        



Measured memory_bytes: 20704
#include<bits/stdc++.h>
using namespace std;
 
int prev[200000],next[200000];
bool ok[200000];
int N,M,Q;
 
 
int main(){
    cin>>N>>M>>Q;
 
    for(int i=0;i<N;i++){
        prev[i]=(i-1+N)%N;
        next[i]=(i+1)%N;
    }
 
    int cur=0;
    while(M--){
        int a;
        cin>>a;
 
        if(a&1)while(a--)cur=prev[cur];
 
        else while(a--)cur=next[cur];
 
        ok[cur]=true;
        next[prev[cur]]=next[cur];
        prev[next[cur]]=prev[cur];
 
        cur=next[cur];
    }
 
    while(Q--){
        int q;
        cin>>q;
        cout<<1-ok[q]<<endl;
    }
}

Measured memory_bytes: 2916
/**
DufauX-XuafuD
**/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define FastIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define reset(x) memset(x,-1,sizeof(x))
#define CheckBit(a,b) (a&(1ll<<b))
#define SetBit(a,b) a=(a|(1ll<<b))
#define UnSetBit(a,b) a=(a&(~(1ll<<b)))
#define maxx 10000006
#define PI 2*acos(0.0)
const long long INF = 2000000000000000000LL;	// 2e18
const int inf = 0x3f3f3f3f;	// 1061109567
const long double EPS = 1e-9;
//bitset<maxx/2>vis;
//bitset<maxx>pr;
//int mobi[maxx+10];
//vector<ll>prime;
//void sieve(){
//    ll x=maxx/2, y=sqrt(maxx)/2;
//    for(ll i=1;i<=y;i++){
//        if(vis[i]==0){
//            for(ll j=(i*(i+1)*2);j<x;j+=(2*i)+1)
//                vis[j]=1;
//        }
//    }
//    prime.push_back(2);
//    for(ll i=3;i<maxx;i+=2)
//        if(vis[i/2]==0)
//        prime.push_back(i);
//}
//void generate_mobius()
//{
//    for(int i=0;i<maxx;i++)mobi[i]=1;
//    for(int i=2;i<maxx;i++){
//        if(!pr[i]){
//            mobi[i]*=-1;
//            for(int j=i+i;j<maxx;j+=i){
//                pr[j]=1;
//                mobi[j]*=(j%(i*i)?-1:0);
//            }
//        }
//    }
//}
//bool isprime(ll a)
//{
//    if(a==1)return false;
//    if(a==2)return true;
//    if(a%2==0)return false;
//    for(ll i=0;i<prime.size() && prime[i]*prime[i]<=a;i++)
//        if(a%prime[i]==0)return false;
//    return true;
//}
/* Calculate ( a*b ) %c */
inline ll mulmod(ll a, ll b, ll c) {
    ll ret = 0 , cur = a % c ;
    while(b) { if(b%2) ret=(ret+cur)%c; cur=(cur<<1)%c; b=b>>1; }
    return ret%c;
}
//Calculate (b^p)%m || modular inverse: b^-1 = bigmod(b, m-2, m)
inline ll bigmod(ll b, ll p, ll m){
    ll ret = 1, cur = b % m;
    while(p) { if(p&1) ret=(ret*cur)%m; cur=(cur*cur)%m; p=p>>1; }
    return ret;
}
inline ll modulo(ll a,ll b,ll c) { //Same as big mod, use for numbers over 1e10
    ll ret = 1 , cur = a%c ;
    while(b) { if(b%2) ret=mulmod(ret,cur,c); cur=mulmod(cur,cur,c); b=b>>1; }
    return ret%c ;
}
inline ll power(ll b, ll p){
    ll ret = 1, cur = b;
    while(p) { if(p&1) ret=(ret*cur); cur=(cur*cur); p=p>>1; }
    return ret;
}
ll lcm(ll a,ll b)
{
    return (a/__gcd(a,b))*b;
}
ll gcd(ll a,ll b)
{
    return __gcd(a,b);
}
void Dufaux()
{
    ll n;
    cin>>n;
    ll ans=n*800;
    ans-=((n/15)*200);
    cout<<ans<<endl;
}
int main()
{
    FastIO;
	///sieve();
	///generate_mobius();
	int test=1;
	while(test--){
        Dufaux();
	}
	return 0;
}






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

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

typedef long long ll;
using namespace std;
int mod = 1000000007;

int main(void){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int H, W; cin >> H >> W;
    string S[H];
    int grid[H+2][W+2]; //#が1
    rep(i, H+2) rep(j, W+2) grid[i][j] = 1;
    rep(i, H){
        cin >> S[i];
        rep(j, W){
            if(S[i][j] == '.') grid[i+1][j+1] = 0;
            else grid[i+1][j+1] = 1;
        }
    }
    bool ok = true;
    for(int i = 1; i <= H; i++){
        for(int j = 1; j <= W; j++){
            if(grid[i][j]){
                if(grid[i-1][j] == 0 && grid[i+1][j] == 0 && grid[i][j-1] == 0 && grid[i][j+1] == 0) ok = false; 
            }
        }
    }
    if(ok) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h> // int64_t

#define max(a,b) ((a) > (b) ? (a) : (b))
#define min(a,b) ((a) > (b) ? (b) : (a))
#define NUM_MAX 3000
#define MIN_INF (int64_t)0xf0f0f0f0f0f0f0f0
#define MAX_INF (int64_t)0x1010101010101010
#define BUF_SIZE (NUM_MAX*12+50)

// size: specify sizeof(str)
int get_str(char *str, int size) {
    if(!fgets(str, size, stdin)) return -1;
    return 0;
}

int get_int(void) {
  int num;
#ifdef BUF_SIZE
  char line[BUF_SIZE];
  if(!fgets(line, BUF_SIZE, stdin)) return 0;
  sscanf(line, "%d", &num);
#else
#error
#endif
  return num;
}

int get_int2(int *a1, int *a2) {
#ifdef BUF_SIZE
  char line[BUF_SIZE];
  if(!fgets(line, BUF_SIZE, stdin)) return -1;
  sscanf(line, "%d %d", a1, a2);
#else
#error
#endif
  return 0;
}

int get_int3(int *a1, int *a2, int *a3) {
#ifdef BUF_SIZE
  char line[BUF_SIZE];
  if(!fgets(line, BUF_SIZE, stdin)) return -1;
  sscanf(line, "%d %d %d", a1, a2, a3);
#else
#error
#endif
  return 0;
}

int get_int4(int *a1, int *a2, int *a3, int *a4) {
#ifdef BUF_SIZE
  char line[BUF_SIZE];
  if(!fgets(line, BUF_SIZE, stdin)) return -1;
  sscanf(line, "%d %d %d %d", a1, a2, a3, a4);
#else
#error
#endif
  return 0;
}

int get_int5(int *a1, int *a2, int *a3, int *a4, int *a5) {
#ifdef BUF_SIZE
  char line[BUF_SIZE];
  if(!fgets(line, BUF_SIZE, stdin)) return -1;
  sscanf(line, "%d %d %d %d %d", a1, a2, a3, a4, a5);
#else
#error
#endif
  return 0;
}

// <arr[0]> <arr[1]> .. <arr[size-1]>
int fget_array(int64_t *arr, int size) {
#ifdef BUF_SIZE
    char line[BUF_SIZE];
    char *tmpbuf = line;
    int i;
    if(!fgets(line, BUF_SIZE, stdin)) return -1;
    for(i = 0; i < size; i++) {
        char *tmp = strtok(tmpbuf, " ");
        arr[i] = strtoll(tmp, NULL, 10);
        tmpbuf = NULL;
    }
#else
#error
#endif
    return 0;
}

int main(void) {
    int64_t arr[NUM_MAX];
    // dp[size][start]
    static int64_t dp[NUM_MAX+1][NUM_MAX+1];
    int num = get_int();
    fget_array(arr, num);
    int size, start;
    for(size=1; size <= num; size++) {
        int taros_turn = (num-size)%2 == 0;
        for(start = 0; start <= num-size; start++) {
            int end = start+size-1;
            int64_t res;
            if(taros_turn) {
                res = MIN_INF;
                res = max(res, dp[size-1][start] + arr[end]);
                res = max(res, dp[size-1][start+1] + arr[start]);
            } else {
                res = MAX_INF;
                res = min(res, dp[size-1][start] - arr[end]);
                res = min(res, dp[size-1][start+1] - arr[start]);
            }
            dp[size][start] = res;
#ifdef DEBUG
            printf("[taro? %d][%d, %d] (size: %d) -> %lld\n", taros_turn, start, end, size, dp[size][start]);
#endif
        }
    }
    printf("%lld\n", dp[num][0]);
    return 0;
}

Measured memory_bytes: 69888
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

// increment
#define rep_n(_1, _2, _3, NAME, ...) NAME
#define rep_2(i, n) for (int(i) = 0; (i) < (int)(n); ++(i))
#define rep_3(i, initial, n) for (int(i) = (int)(initial); (i) < (int)(n); ++(i))
#define rep(...) rep_n(__VA_ARGS__, rep_3, rep_2, rep_1)(__VA_ARGS__)
// decrement
#define rep_r_n(_1, _2, _3, NAME, ...) NAME
#define rep_r_2(i, n) for (int(i) = (int)(n); (i) > 0; (i)--)
#define rep_r_3(i, initial, n) for (int(i) = (int)(initial); (i) > (int)(n); (i)--)
#define rep_r(...) rep_r_n(__VA_ARGS__, rep_r_3, rep_r_2)(__VA_ARGS__)
// define type definition
using namespace std;
typedef long long ll;
using mpint = boost::multiprecision::cpp_int; // 多倍長整数（任意精度）
typedef pair<int, int> P;

// define construct variable
const double EPS = numeric_limits<double>::epsilon();
// 10^9 + 7
const ll MOD = ll(1e9)+7;
const ll INF = ll(1e10);
const string ALPHABET = "abcdefghijklmnopqrstuvwxyz";
const double PI = acos(-1);

// define methods
// 最大公約数
ll gcd(const ll a, const ll b) { return b ? gcd(b, a % b) : a; }
// 最小公倍数
ll lcm(const ll a, const ll b) { return a / gcd(a, b) * b; }
// char -> int
int ctoi(char c) { return (int)(c - '0'); }
// 素因数分解
vector< pair<ll, ll> > prime_factorize(ll n) {
  vector< pair<ll, ll> > p;
  for (ll i = 2; i * i <= n; i++) {
    if ((n % i) != 0) continue;
    p.push_back(make_pair(i, 0));
    while ((n % i) == 0) {
      n /= i;
      p[i].second += 1;
    }
    p.push_back(make_pair(n, 0));
  }

  if (n != 1) p.push_back(make_pair(n, 1));
  return p;
}
// 組み合わせの整合性を保つ（後ほど解析する）
ll modinv(ll a) {
	ll b = MOD, u = 1, v = 0;
	while (b) {
		ll t = a / b;
		a -= t * b;
		swap(a, b);
		u -= t * v;
		swap(u, v);
	}
	u %= MOD;
	if (u < 0) { u += MOD; }
	return u;
}
// 順列
ll permutation(const ll n, const ll m) {
	ll result = 1;
	for (ll i = n; i > n - m; i--) { result = (result * i) % MOD; }
	return result;
}

// 繰り返し n 乗法
ll repeat_square(const ll n, const ll x) {
	if (x == 0) return 1;
	ll res = repeat_square(n, x/2);
	res = res * res % MOD;
	if ((x % 2) == 1) res = res * n % MOD;
  return res;
}
// 組み合わせ nCm
ll combination(ll n, ll m) {
	ll p = permutation(n, m);
	ll div = 1;
	for (ll i = 2; i <= m; i++) {
		div = (div * i) % MOD;
	}
	return (p * modinv(div)) % MOD;
}

int main() {
	int N;
	cin >> N;
	vector<ll> X(N), L(N);
	vector< pair<ll, ll> > p(N);
	rep(i, N) {
		ll x, l;
		cin >> x >> l;

		X[i] = x;
		L[i] = l;
		p[i] = make_pair(x+l, x-l);
	}

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

	int result = 0;
	ll left = -1000000000;

	rep(i, N) {
		if (left <= p[i].second) {
			result += 1;
			left = p[i].first;
		}
	}

	cout << result << endl;
  return 0;
}


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

using namespace std;

#define fcout(d) cout << fixed << setprecision(d)
#define rep(i,n) for(int (i) = 0; (i) < (n); ++(i))
#define rep1(i,n) for(int (i) = 1; (i) <= (n); ++(i))
#define repU(i,bottom,ceiling) for(auto (i) = (bottom); (i) <= (ceiling); ++(i))
#define repD(i,ceiling,bottom) for(auto (i) = (ceiling); (i) >= (bottom); --(i))
#define repS(n) for(int (s) = 0; (s) < 1 << (n); ++(s))
#define repV(i,v) for(auto (i) = begin(v); (i) < end(v); ++(i))
#define all(v)  begin(v),end(v)
#define clr(v) fill(all(v),0)
#define l_bnd lower_bound
#define u_bnd upper_bound
#define puf push_front
#define pub push_back
#define pof pop_front
#define pob pop_back
#define mkp make_pair
#define mkt make_tuple
#define fir first
#define sec second
#define divceil(n,d) ((n)/(d) + ((n)%(d) > 0))
#define parity(a,b) (((a) & 1LL)^((b) & 1LL)^1LL)

typedef long long ll;
typedef unsigned long long ull;
typedef double db;

const pair<int,int> DIR[] = { {1,0},{0,1},{-1,0},{0,-1},{1,1},{-1,1},{-1,-1},{1,-1} };
const int INF_32 = -1 + (1 << 30);
const ll INF_64 = -1 + (1LL << 62);
const int MOD = 1e9 + 7;

template<class T> T gcd(T a, T b){ if(a % b){ return gcd(b, a % b); }else{ return b; } }

template<class T> T lcm(T a, T b){ return a / gcd(a, b) * b; }

ll Pow(ll n, ll m, int mod = MOD){
	ll res = 1,pow = n % mod;
	while(m) {
		if(m & 1LL) res = (res * pow) % mod;
		pow = (pow * pow) % mod;
		m >>= 1;
	}
	return res;
}

void Fact_table(ll *fact, int range, int mod = MOD){
	fact[0] = 1;
	rep1(i,range) fact[i] = fact[i - 1] * i % mod;
}

ll Comb(int n, int m, ll *fact, int mod = MOD){
	if(n < m || m < 0) return 0;
	ll rev = Pow(fact[m] * fact[n - m] % mod, mod - 2, mod);
	return rev * fact[n] % mod;
}

bool Prime_judge(int n){
	if(n <= 1 || !(n % 2)) return 0;
	for(int d = 3; d * d <= n; d += 2) if(!(n % d)) return 0;
	return 1;
}

void Prime_table(bool *is_prime, int n){
	fill(is_prime + 1, is_prime + n + 1, 1);
	repU(i,2,n/2) is_prime[i * 2] = 0;
	is_prime[0] = is_prime[1] = 0;
	int p = 3;
	while(p * p <= n){
		for(int t = p * 3; t <= n; t += p * 2) is_prime[t] = 0;
		p += 2;
		while(!is_prime[p]) p += 2;
	}
}

int main(){
	int N; cin>>N;
	ll fact[1000001],cur,last = 0;
	ll ans = 0;
	Fact_table(fact,N);
	rep1(i,N - 1){
		cur = fact[i] * fact[N - i - 1] % MOD * Comb(i - 1, N - i - 1, fact) % MOD;
		ans += (cur - last) * i % MOD;
		ans %= MOD;
		if(ans < 0) ans += MOD;
		last = cur;
	}
	cout<<ans<<endl;
	return 0;
}





Measured memory_bytes: 8064
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace __gnu_pbds;
using namespace std;

typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
typedef pair <ll, ll> pll;
typedef pair <int, int> pii;

typedef tree <ll, null_type, less <ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
// order_of_key(val): returns the number of values less than val
// find_by_order(k): returns an iterator to the kth largest element (0-based)

#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(a) a.begin(), a.end()
#define sz(a) (ll)(a.size())
#define endl "\n"

template <class Ch, class Tr, class Container>
basic_ostream <Ch, Tr> & operator << (basic_ostream <Ch, Tr> & os, Container const& x) 
{
    os << "{ ";
    for(auto& y : x) 
    {
        os << y << " ";
    }
    return os << "}";
}

template <class X, class Y>
ostream & operator << (ostream & os, pair <X, Y> const& p) 
{
    return os << "[" << p.ff << ", " << p.ss << "]";
}

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

    return gcd(b, a%b);
}

ll modexp(ll a, ll b, ll c)
{   
    a%=c;

    ll ans = 1;

    while(b)
    {
        if(b&1)
        {
            ans = (ans*a)%c;
        }

        a = (a*a)%c;
        b >>= 1;
    }

    return ans;
}

const ll L = 1e5+5;

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

    map <string, ll> m;

    m["SUN"] = 0;
    m["MON"] = 1;
    m["TUE"] = 2;
    m["WED"] = 3;
    m["THU"] = 4;
    m["FRI"] = 5;
    m["SAT"] = 6;

    string s;
    cin >> s;

    cout << 7 - m[s] << endl;

    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

/**
 * Main
 */
public class Main {

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

        int A = sc.nextInt();
        int B = sc.nextInt();
        int H = sc.nextInt();
        int M = sc.nextInt();
        sc.close();

        double positionAx = A*Math.sin(((double)H+(double)M/60)/12*2*Math.PI);
        double positionAy = A*Math.cos(((double)H+(double)M/60)/12*2*Math.PI);

        double positionBx = B*Math.sin(((double)M/60)*2*Math.PI);
        double positionBy = B*Math.cos(((double)M/60)*2*Math.PI);


        double ans = Math.sqrt(Math.pow((positionAx-positionBx),2) + Math.pow((positionAy-positionBy), 2));

        System.out.println(ans);
    }
}

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

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef pair<LL, LL> PLL;

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

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

#define FF first
#define SS second
template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}

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

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

  LL N, K, X, Y; cin >> N >> K >> X >> Y;
  LL ans = 0;
  for(int i=1;i<=N;++i)
	if(i <= K) ans += X;
	else ans += Y;
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
using System;

namespace _094_CalculationofArea
{
	class Program
	{
		static void Main ( string[] args )
		{
			const decimal tsubo = 3.305785m;

			int[] edge = Array.ConvertAll (Console.ReadLine ().Split (' '), int.Parse);

			Console.WriteLine (edge[0] * edge[1] / tsubo);
		}
	}
}

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

int main(){
  int n; cin >> n;
  vector<int> A(n), ans(n);
  for(int i=0; i<n; i++){
    cin >> A[i];
  }
  for(int i=0; i<n; i++){
    ans[A[i]-1] = i+1;
  }
  for(int i=0; i<n; i++){
    cout << ans[i] << " ";
  }
  return 0;
}

Measured memory_bytes: 1536
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include <cmath>
#include <limits>
#include<set>
#include <iomanip>
#include <queue>
#include <map>
#include <string>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long long ll;
const long long INF=200000000000000;
const double inf=pow(10,10);
double pi=3.141592653589793;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const ll MOD = 1000000007;
void init(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout<<fixed;
}

ll getdigit(ll n){
	string s=to_string(n);
	return s.size();
}
	
int main(){
	init();
	string s1,s2,s3;
	cin>>s1>>s2>>s3;
	string ans;
	ans+=s1[0]-32;
	ans+=s2[0]-32;
	ans+=s3[0]-32;
	cout<<ans<<endl;
}


Measured memory_bytes: 256
n = int(input())
s = input()

result = 0
c = [0]*3
for i in range(1000):
    count = 0
    c[0] = str(i // 100)
    c[1] = str((i % 100) // 10)
    c[2] = str(i % 10)
    for j in range(n):
        if(c[count] == s[j]):
            count += 1
        if(count == 3):
            result += 1
            break

print(result)

Measured memory_bytes: 41308
io = STDIN
s=io.gets.chomp
sum=0
$ar=s.split(//).join("0").split(//).map{|c|c=="0" ? "" : c}
#  1   2   3
#    *   *    <--cnt
$ans = 0
$cnt=s.size.-1
def calc(arr,pos)
  if pos > $cnt*2-1
    $ans += eval(arr.join)
  else
    calc(arr.clone,pos+2)
    arr[pos]="+"
    calc(arr.clone,pos+2)
  end
end
calc($ar.clone,1)
p $ans

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

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

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<math.h>
#include<bitset>
#include <numeric>
using namespace std;
using ll=long long;
using ld=long double;
using pint=pair<int,int>;
using pll=pair<ll,ll>;
#define LONG_INF 9223372036854775807
#define INF 1000000000LL
#define EPS 1e-10
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define dump(a) rep(d,a.size()){cout<<a[d];if(d!=a.size()-1)cout<<" ";else cout<<endl;}
#define all(v) v.begin(),v.end()
#define pb push_back


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

    int N, K;
    cin >> N >> K;
    int A[N];
    rep(i, N) A[i] = 0;

    rep(i, K){
        int d, a;
        cin >> d;
        rep(j, d){
            cin >> a;
            A[a-1] = 1;
        }
    }

    int ret=0;
    rep(i, N){
        if(A[i]==0) ret ++;
    }
    cout << ret << endl;

    return 0;
}

Measured memory_bytes: 3640
import numpy as np
# dfsで全探索
n, m, x = map(int, input().split())
c = []
a = np.zeros((n, m))
for i in range(n):
    ll = list(map(int, input().split()))
    c.append(ll[0])
    a[i] += np.array(ll[1:])
    

ans = float("INF")
# 0: Not Buy 1: Buy
s = []

def dfs(s):
    global ans
    if len(s) == n:
        r = np.zeros(m)
        ra = 0
        for j, k in enumerate(s):
            if k == 0:
                continue
            r += np.array(a[j])
            ra += c[j]
        if min(r) >= x:
            ans = min(ans, ra)
        return
    b = s.copy()
    nb = s.copy()
    b.append(0)
    nb.append(1)
    dfs(b)
    dfs(nb)

dfs([])
if ans == float("INF"):
    print(-1)
else:
    print(ans)

Measured memory_bytes: 27160
# include <iostream>
# include <cstdio>
# include <cstring>

using namespace std;
 
string a;
int len, ans;

int main()
{
	cin >> a;
	
	len = a.length();
	
	for(int i = 0; i < len - 1; i ++)
	{
		if(a[i] != a[i + 1])
		{
			ans ++;
		}
	}
	
	printf("%d\n", ans);
			
	return 0;
} 

Measured memory_bytes: 512
using System;
using System.Linq;

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

        var count = 0;
        for (var i = 1; i < Math.Sqrt(n); i++)
        {
            for (var j = i; j * i < n; j++)
            {
                if (i == j)
                {
                    count += 1;
                }
                else
                {
                    count += 2;
                }
            }
        }

        Console.WriteLine(count);
    }
}

Measured memory_bytes: 27524
#include <bits/stdc++.h>
using namespace std;
int a,b,c;

int main (){
	cin >> a >> b >> c;
	if(a==b&&a!=c) cout << c << endl;
	else if(a==c&&a!=b)	cout << b << endl;
	else if (b==c&&b!=a) cout << a << endl;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 3e5 + 10;
int n, m, a[N];
int main() {
    cin >> n >> m;
    multiset<int> s;
    for(int i = 0, x; i < n; i++) {
        cin >> x;
        s.insert(x);
    }
    while(m--) {
        auto it = s.end();
        it--;
        int t = *it;
        s.erase(it);
        s.insert(t / 2);
    }
    ll ans = 0;
    for(int x : s) {
        ans += x;
    }
    cout << ans << endl;
    return 0;
}

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

int main() {
	int n,ban = 0;
	while(true){
		cin >> n;
		ban += 1;
		if(n == 0){
		break;
		}
		cout << "Case " << ban << ":" << " " << n << endl;
	}
	return 0;
}

Measured memory_bytes: 1160
import java.util.Scanner;

class Main {

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int H = scan.nextInt();
        int W = scan.nextInt();
        while (H != 0 || W != 0) {
            for (int x = 1; x <= H; x++) {
                for (int y = 1; y <= W; y++) {
                    if (x==1 || x==H || y==1 || y==W){
                        System.out.print("#");
                    } else {
                        System.out.print(".");
                    }
                }
                    System.out.println("");
                }   System.out.println("");
                
                H = scan.nextInt();
                W = scan.nextInt();

            }
        }
    }

    



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

int main () {
  char a,b;
  cin>>a>>b;
  if(a=='H'){
    cout<<b<<endl;
  }
  else if(a=='D'){
    if(b=='H'){
      cout<<'D'<<endl;
    }
    else{
      cout<<'H'<<endl;
    }
  }
  return 0;
}

Measured memory_bytes: 256
public class Main {
	public static void main(String[] args) {
		java.util.Scanner s = new java.util.Scanner(System.in);
		Integer c[][] = new Integer[3][3];
		int max = 0;
		for (int i = 0; i < 3; i++) {
			for (int j = 0; j < 3; j++) {
				int pos = c[i][j] = s.nextInt();
				max = Math.max(max, pos);
			}
		}

		System.out.println(Main.calc(c, max) ? "Yes" : "No");
	}

	public static boolean calc(Integer c[][], int max) {
		for (int a1 = 0; a1 <= max && a1 <= 100; a1++) {
			int b1 = c[0][0] - a1;
			if (0 > b1 || b1 > 100) {
				continue;
			}
			for (int a2 = 0; a2 <= max && a2 <= 100; a2++) {
				int b2 = c[1][1] - a2;
				if (0 > b2 || b2 > 100) {
					continue;
				}
				for (int a3 = 0; a3 <= max && a3 <= 100; a3++) {
					int b3 = c[2][2] - a3;
					if (0 > b3 || b3 > 100) {
						continue;
					}
					if (c[0][1] == a1 + b2 && c[0][2] == a1 + b3 && c[1][0] == a2 + b1 && c[2][0] == a3 + b1
							&& c[2][1] == a3 + b2 && c[1][2] == a2 + b3) {
						return true;
					}
				}
			}
		}
		return false;
	}

}

Measured memory_bytes: 24532
//#include <bits/stdc++.h>
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <climits>
#include <iomanip>

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define ROF(i, j, k) for(int i = (int)(j); i >= (int)(k); --i)
#define FORLL(i, n, m) for(long long i = n; i < (long long)(m); i++)
#define SORT(v, n) sort(v, v+n)
#define REVERSE(v) reverse((v).begin(), (v).end())

using namespace std;
using ll = long long;
const ll MOD=1000000007LL;
typedef pair<int, int> P;

ll ADD(ll x, ll y) { return (x+y) % MOD; }
ll SUB(ll x, ll y) { return (x-y+MOD) % MOD; }
ll MUL(ll x, ll y) { return x*y % MOD; }
ll POW(ll x, ll e) { ll v=1; for(; e; x=MUL(x,x), e>>=1) if (e&1) v = MUL(v,x); return v; }
ll DIV(ll x, ll y) { /*assert(y%MOD!=0);*/ return MUL(x, POW(y, MOD-2)); }

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

ll a[100010], b[100010];

//解説AC
// aa += (b[i] - a[i])/2 * 2; で削ぎ落としてる?

int
main(void){  
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  ll n;
  cin >> n;
  ll diff = 0;

  REP(i,n) cin >> a[i];
  REP(i,n) cin >> b[i];

  ll aa = 0, bb = 0;
  REP(i,n){
    if(a[i] > b[i]) bb += a[i] - b[i];
    else aa += (b[i] - a[i])/2 * 2;
  }
  
  if(aa < bb*2) cout << "No";
  else cout << "Yes";
  cout << endl;
  
  return 0;
}


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

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

#define pb push_back
#define rep(i, n) for(int i = 0; i < (n); i++)
#define FOR(i, a, n) for(int i = a; i < (n); i++)
#define mod (ll)(1e9+7)
#define INF 1e9
#define int ll

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

ll n, ma, mb;
ll a[50], b[50], c[50];
ll dp[50][500][500];
signed main() {
  cin >> n >> ma >> mb;
  rep(i, n) cin >> a[i] >> b[i] >> c[i];
  rep(i, 50) rep(j, 500) rep(k, 500) dp[i][j][k] = INF;
  dp[0][0][0] = 0;

  rep(i, n) {
    rep(j, 500) {
      rep(k, 500) {
        if (dp[i][j][k] == INF) continue;
        dp[i + 1][j + a[i]][k + b[i]] = min(dp[i + 1][j + a[i]][k + b[i]], dp[i][j][k] + c[i]);
        dp[i + 1][j][k] = min(dp[i + 1][j][k], dp[i][j][k]);
      }
    }
  }

  ll ans = INF;
  FOR(i, 1, 50) {
    ll A = ma * i, B = mb * i;
    if (A > 490 || B > 490) break;
    ans = min(ans, dp[n][A][B]);
  }
  if (ans == INF) cout << -1 << endl;
  else cout << ans << endl;


	return 0;
}

Measured memory_bytes: 97920
#include <bits/stdc++.h>
#define rep(i,n,m) for(int i=n;i<(int)(m);i++)
#define rrep(i,n,m) for(int i=((int)(n)-1);i>=m;i--)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
using namespace std;
template<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}
template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
int main(){
    ll n;
    cin>>n;
    
    rep(x,1,3501){
        rep(y,1,3510){
            if(4*x*y-n*x-n*y==0) continue;
            if((ll)n*x*y%(4*x*y-n*x-n*y)==0){
                ll z=(ll)n*x*y/(4*x*y-n*x-n*y);
                if(z<1) continue;
                cout<<x<<" "<<y<<" "<<z<<endl;
                return 0;
            }
        }
    }
}


Measured memory_bytes: 384
n,k = map(int,input().split())


########関数部分##############
def Base_10_to_n(X, n):
    if (int(X/n)):
        return Base_10_to_n(int(X/n), n)+str(X%n)
    return str(X%n)
############################
 
 
#####関数をつかってみる．#####
######今回は二進数に変換######
ans = Base_10_to_n(n, k)
print( len(ans) )

Measured memory_bytes: 3060
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <vector>
#include <map>
#include <list>
#include <stack>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <queue>
#define mkp make_pair
#define pr(num) cout << num << "\n"
#define max(a, b) ((a)>(b) ? (a):(b))
#define min(a, b) ((a)<(b) ? (a):(b))
#define INF 1000000000000000000
#define MOD 1000000007LL
#define MAX 100010
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef map<ll, ll> Map;

ll N, A, B;
ll a[44], b[44], c[44];
ll dp[44][444][444];

int main(void) {
    ll i, j, k;
    cin >> N >> A >> B;
    
    for(i=0; i<N; i++) {
        cin >> a[i] >> b[i] >> c[i];
    }
    
    for(i=0; i<=N; i++) {
        for(j=0; j<404; j++) {
            for(k=0; k<404; k++) {
                dp[i][j][k]=INF;
            }
        }
    }
    
    dp[0][0][0]=0;
    for(i=0; i<N; i++) {
        for(j=0; j+a[i]<404; j++) {
            for(k=0; k+b[i]<404; k++) {
                dp[i+1][j][k]=min(dp[i+1][j][k], dp[i][j][k]);
                dp[i+1][j+a[i]][k+b[i]]=min(dp[i][j+a[i]][k+b[i]], dp[i][j][k]+c[i]);
            }
        }
    }
    
    ll ans=INF;
    for(i=1; i*max(A, B)<404; i++) {
        ans=min(ans, dp[N][i*A][i*B]);
    }
    
    if(ans==INF) pr(-1);
    else pr(ans);
    
}


Measured memory_bytes: 63616
def main():
    n = int(input())
    a = [0] + list(map(int, input().split()))

    b = [0] * (n + 1)
    for i in range(1, n+1)[::-1]:
        cnt = 0
        j = i
        while j <= n:
            if b[j] == 1:
                cnt += 1
            j += i
        if cnt % 2 != a[i]:
            b[i] = 1
    num = sum(b)
    print(num)
    if num != 0:
        print(' '.join([str(i) for i, bb in enumerate(b) if bb == 1]))


main()


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

const int M = 1000005;

int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  vector<int> cnt(M);
  for(int x : a){
    if(cnt[x] != 0){
      cnt[x] = 2;
      continue;
    }
    for(int i = x; i < M; i += x) cnt[i]++;
  }
  int ans = 0;
  for(int x : a){
    if(cnt[x] == 1) ans++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 7912
#include<bits/stdc++.h>
#define vll vector<ll>
#define vi vector<int>
#define vpll vector<pair<ll,ll>>
#define pii pair<int,int>
#define REP(i,a) for(int (i)=0; (i)<(a); (i)++)
#define RREP(i,a) for(int (i)=a-1; (i)>=(0); (i)--)
#define REP2(i,a,b) for(int (i)=(a); (i)<(b); (i)++)
#define MOD 1000000007
#define ALL(v) v.begin(), v.end()
#define m0(x) memset(x,0,sizeof(x))
typedef long long ll;

using namespace std;

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int A,B,C;
  cin >> A>> B>> C;
  int D = A+B+C;
  if(D>=22) cout << "bust";
  else cout << "win";

  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int min(int a,int b){
  if(a>b) return b;
  return a;
}

int main(void){
  int i,n,ans=1e9;
  scanf("%d",&n);
  char s[n];
  int w[n];
  int e[n];
  w[0] = 0;
  e[n-1] = 0;
  scanf("%s",s);
  if(s[0]=='W') w[0]=1;
  for(i=1;i<n;i++){
    if(s[i]=='W') w[i]=w[i-1]+1;
    else w[i]=w[i-1];
    //printf("%d ",w[i]);
  }
  //printf("\n");
  if(s[n-1]=='E') e[n-1]=1;
  for(i=n-2;i>-1;i--){
    if(s[i]=='E') e[i]=e[i+1]+1;
    else e[i]=e[i+1];
    //printf("%d\n",e[i]);
  }
  //for(i=0;i<n;i++) printf("%d %d\n",w[i],e[i]);
  for(i=0;i<n;i++){
    ans=min(ans,w[i]+e[i]-1);
    //printf("%d %d %d %d\n",i,w[i],e[i],ans);
  }
  printf("%d\n",ans);
  return 0;
}

Measured memory_bytes: 2816