akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll= long long;
using vi= vector<int>;
using vvi= vector<vi>;
using vd= vector<double>;
using vvd= vector<vd>;
using vc= vector<char>;
#define rep(i,x,n) for(int i=x; i<n; i++)
#define all(x) x.begin(), x.end()

int main(){
  string s,t;
  cin >> s >> t;
  cout << t << s << endl;
}


Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		List<Integer> list = new ArrayList<Integer>();
		list.add(sc.nextInt());// a
		list.add(sc.nextInt());// b
		list.add(sc.nextInt());// c

		Collections.sort(list);

		System.out.println(list.get(0) + list.get(1));

		sc.close();
	}
}

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

using namespace std;
using ll = long long;

int n, m, Q;
int d[510][510];

int main(){
    scanf("%d %d %d", &n, &m, &Q);
    for(int i = 0; i < m; ++i){
        int l, r;
        cin >> l >> r;
        ++d[l][r];
    }
    for(int i = 0; i < n; ++i){
        for(int j = 0; j < n; ++j){
            d[i+1][j+1] += d[i][j+1]+d[i+1][j]-d[i][j];
        }
    }
    for(int i = 0; i < Q; ++i){
        int p, q;
        cin >> p >> q;
        printf("%d\n", d[q][q]-d[q][p-1]-d[p-1][q]+d[p-1][p-1]);
    }
    return 0;
}


Measured memory_bytes: 1920
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <algorithm>
#include <stdint.h>
#include <queue>
#include <bitset>
#include <iomanip>
#include <set>
#include <map>

using namespace std;

#define PI (3.14159265358979323846)
#define INF (2147483647)
#define INF_LL (9223372036854775807)
#define DIV_NUM (1000000007)

// 配列初期化テンプレ
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T& val) {
	std::fill((T*)array, (T*)(array + N), val);
}


#define MAX_NUM (200000)
int ballcount[MAX_NUM+1];
long long combination[MAX_NUM + 1];

int main() {

	int N;
	cin >> N;
	vector<int> input;

	int max_num = 0;
	for (int i = 0; i < N; i++) {
		int tmp;
		cin >> tmp;
		input.push_back(tmp);
		ballcount[tmp]++;
		max_num = max(max_num, tmp);
	}

	long long total_combi_full = 0;
	for (int i = 1; i < max_num + 1; i++) {
		if (ballcount[i] < 2) continue;
		combination[i] = (long long)(ballcount[i]) * (long long)(ballcount[i] - 1) / 2;
		total_combi_full += combination[i];
	}

	for (int i = 0; i < N; i++) {
		int target = input[i];
		if (ballcount[target] < 2) {
			cout << total_combi_full << endl;
		}
		else {
			long long correct_combi = (long long)(ballcount[target] - 1) * (long long)(ballcount[target] - 2) / 2;
			long long ans = total_combi_full - combination[target] + correct_combi;
			cout << ans << endl;
		}
	}

	return 0;
}



Measured memory_bytes: 4852
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
#include<string>


long long  INF=1000000000000000000;
long long mod=1000000007;
using namespace std;


int main(){

long long N,K;
cin>>N>>K;

int A[N];
for(int i=0;i<N;i++){
cin>>A[i];
}
int after[N]={};
int before[N]={};
for(int i=0;i<N;i++){
    for(int k=i+1;k<N;k++){
        if(A[i]>A[k]){
            after[i]++;
        }
    }
}

for(int i=0;i<N;i++){
    for(int k=0;k<i;k++){
        if(A[i]>A[k]){
            before[i]++;
        }
    }
}

long long ans=0;
int l;
for(int i=0;i<N;i++){
    l=after[i]+before[i];
    
    long long t=(K*(K-1)/2)%mod;
    t=(t*l)%mod;
    long long y=after[i]*K;
    y%=mod;
    ans+=y+t;
    ans%=mod;
}


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

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

int main(){
    long a,b;
    cin >> a >> b;
    long k;
    k = abs(a+b);
    if (k%2==0){
        cout << k/2 << endl;
    } 
    else {
        cout << "IMPOSSIBLE" << endl;
        }
}




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

int main()
{
	int N, K;
	cin >> N >> K;
	if (K > (N - 1) * (N - 2) / 2) {
		cout << -1 << endl;
		return 0;
	}
	vector<vector<int>> G(N);
	for (int i = 1; i < N; i++) G[0].push_back(i);
	for (int i = 1; i < N; i++) {
		int v = min(N - i - 1, K);
		for (int j = i + 1 + v; j < N; j++) {
			G[i].push_back(j);
		}
		K -= v;
	}
	vector<pair<int, int>> es;
	for (int i = 0; i < N; i++) {
		for (auto to : G[i]) {
			es.emplace_back(i, to);
		}
	}
	cout << es.size() << endl;
	for (auto e : es) {
		cout << e.first + 1 << ' ' << e.second + 1 << endl;
	}
	return 0;
}


Measured memory_bytes: 384
import Control.Arrow
import qualified Data.ByteString.Char8 as BC
import Data.List
import Data.Function (on)
import Data.Char (toLower)

-- not efficient at all, but the input is not very long.
-- let's try something mad.
stat :: BC.ByteString -> (BC.ByteString,BC.ByteString)
stat = ((head . maximumBy (compare `on` length))
        &&&
        (head . maximumBy (compare `on` (BC.length . head)))
       ) .  group . sort . BC.words . BC.map toLower

main = BC.getLine >>= (\(x,y) -> BC.putStrLn . BC.unwords $ [x,y]) . stat

Measured memory_bytes: 3524
l,r=gets.split.map &:to_i
a=r-l>=2019?[*0...2019]:l%2019<r%2019?[*l%2019..r%2019]:[*0..r%2019,*l%2019...2019]
p a.combination(2).map{|i,j|i*j%2019}.min

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

public class Main {

    public static void main(String args[]) {

        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        Integer[] l = new Integer[n];
        for (int i = 0; i < n; i++) {
            l[i] = Integer.parseInt(sc.next());
        }

        Arrays.sort(l);
        int result = 0;
        for (int i = 0; i < n - 2; i++) {
            for (int j = i + 1; j < n - 1; j++) {
                for (int k = j + 1; k < n; k++) {
                    if (l[k] < l[i] + l[j]) {
                        result++;
                    }
                }
            }
        }

        System.out.println(result);
    }
}

Measured memory_bytes: 25052
#include<bits/stdc++.h>
using namespace std;int64_t p[1<<20],N,i,c,b,n[1<<20],d[1<<20];main(){for(cin>>N;i<N;)cin>>c>>b,c+=1e9,p[i++]=(c<<32)+c+b;sort(p,p+N);for(b=d[N]=1;c=i--;b=d[i]=(b+d[n[i]=c])%998244353)for(;c<N&p[c]<p[i]<<32;c=n[c]);cout<<*d;}

Measured memory_bytes: 5888
#include <cstdio>
#include <climits>
#include <cassert>
#include <cmath>
#include <iostream>
#include <string>
#include <algorithm>
#include <numeric>
#include <functional>
#include <tuple>
#include <list>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <vector>

#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
#define FOR(x,xs) for(auto &x: xs)

using namespace std;
typedef long long ll;
typedef pair<int,int> PI;
typedef pair<ll,ll> PL;
typedef vector<int> VI;
typedef vector<ll> VL;

bool solve(const VL &ds, const VL &ts) {
  int i = 0;
  FOR(t,ts) {
    while(ds[i] < t) {
      i++;
    }
    if(ds[i] == t) {
      i++;
    } else {
      return false;
    }
  }
  return true;
}

int main() {
  ios::sync_with_stdio(false);
  int N, M;
  cin >> N;
  VL ds(N);
  FOR(d,ds) {
    cin >> d;
  }
  cin >> M;
  VL ts(M);
  FOR(t,ts) {
    cin >> t;
  }
  sort(ds.begin(), ds.end());
  sort(ts.begin(), ts.end());
  cout << (solve(ds, ts) ? "YES" : "NO") << endl;
  
  return 0;
}


Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
#define rep2(i,m,n) for (int i = (m); i < (n); ++i)
#define rep(i,n) rep2(i,0,n)
#define debug(x) cerr << x << endl
typedef long long int ll;
typedef long double ld;
typedef pair<int, int> P;
template<typename T> struct V : vector<T> { using vector<T>::vector; };
V() -> V<int>;
V(size_t) -> V<int>;
template<typename T> V(size_t, T) -> V<T>;
template<typename T> vector<T> make_vec(size_t n, T a) { return vector<T>(n, a); }
template<typename... Ts> auto make_vec(size_t n, Ts... ts) { return vector<decltype(make_vec(ts...))>(n, make_vec(ts...)); }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &v) { for (auto &e : v) os << e << ' '; return os; }
struct fast_ios { fast_ios(){ cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
template<typename T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
template<typename T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
const int INF = 1<<30;
const ll LINF = 1LL<<61;
const ll MOD = 1000000007;

int main()
{
    ll N, X, M;
    cin >> N >> X >> M;
    vector<int> f(M, -1);
    vector<vector<ll>> s(40, vector<ll>(M));
    auto func = [&](ll x)
    {
        return (x * x) % M;
    };
    int cur = X;
    rep(i,M)
    {
        if(~f[cur]) break;
        s[0][cur] = cur;
        f[cur] = func(cur);
        cur = f[cur];
    }
    vector<vector<int>> d(40, vector<int>(M, -1));
    d[0] = f;
    // iota(s[0].begin(), s[0].end(), 0LL);
    rep(i,39)
    {
        rep(j,M)
        {
            d[i+1][j] = d[i][d[i][j]];
            s[i+1][j] = s[i][j] + s[i][d[i][j]];
        }
    }
    int pos = X;
    ll ans = 0;
    rep(i,40)
    {
        if((N >> i) & 1)
        {
            ans += s[i][pos];
            pos = d[i][pos];
        }
    }
    cout << ans << endl;

    return 0;
}


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

int main()
{
    string s;
    int k;
    cin >> s >> k;
    int x = s.size();
    set<string> se;

    for (int i = 1; i <= k; ++i)
    {
        for (int j = 0; j + i <= x; ++j)
        {
            se.insert(s.substr(j, i));
        }
    }
    //*
    set<string>::iterator it = se.begin();
    for (int i = 0; i < k-1; ++i)
    {
        ++it;
    }
    cout << *it << endl;
    //*/
    return 0;
}

Measured memory_bytes: 1664
#include <stdio.h>
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>

using ll = long long int;
const int INF = (1<<30);
const ll INFLL = (1ll<<60);
const ll MOD = (ll)(1e9+7);

#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	b = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}

ll cnt[100100];

int main(void){
	int n,q,a,b,c,i;
	ll s=0ll;
	std::cin >> n;
	for(i=0; i<n; ++i){
		std::cin >> a;
		++cnt[a];
		s += a;
	}
	std::cin >> q;
	for(i=0; i<q; ++i){
		std::cin >> b >> c;
		s -= cnt[b]*b;
		s += cnt[b]*c;
		cnt[c] += cnt[b];
		cnt[b] = 0;
		std::cout << s << std::endl;
	}
	return 0;
}


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

const int MAXNN = 1e2+5;
const int MAXN = 1e5+5;
#define ll long long
ll dp[2][MAXN];
int val[MAXNN],weight[MAXNN];

int main()
{
    int n,cap;cin >> n >> cap;
    for(int i=1;i<=n;++i){
        cin >> val[i] >> weight[i];
    }
    for(int i=1;i<=n;++i){
        int now = i%2,last = 1-now;
        for(int j=0;j<=cap;++j){
            if(j>=val[i]) dp[now][j] = dp[last][j-val[i]] + weight[i];
            dp[now][j] = max(dp[now][j],dp[last][j]);
        }
    }
    cout << dp[n%2][cap];
}


Measured memory_bytes: 1792
#define REP(i,n) for(int i=0; i<(int)(n); i++)

#include <cstdio>
inline int getInt(){ int s; scanf("%d", &s); return s; }

#include <set>

using namespace std;

int main(){
  const int a = getInt();
  const int b = getInt();
  const int k = getInt();
  int c = 0;
  for(int i = 100; i > 0; i--){
    if(a % i == 0 && b % i == 0) c++;
    if(c == k) {
      printf("%d\n", i);
      break;
    }
  }

  return 0;
}

Measured memory_bytes: 128
#include<iostream>
using namespace std;
int n,ans;
int main(){
	cin>>n;
	if(n/1000==2) ans++;
	if(n/100%10==2) ans++;
	if(n/10%10==2) ans++;
	if(n%10==2) ans++;
	cout<<ans;
	return 0;
}

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

#include <vector>

void func();

int main(){
    func();
}

void func(){
    int n;
    cin >> n;
    vector<int> v = {};
    for(int i = 0; i < n; i++)
    {
        int a;
        cin >> a;
        v.push_back(a);
    }
    sort(v.begin(),v.end());
    v.erase(unique(v.begin(),v.end()),v.end()); //末尾の次の要素のポインタを返す

    cout << v.size() << endl;
}

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

int main() {
    int a, b;
    cin >> a >> b;
    int c = a - b;
    if (c == 1 || c == -1 || a == b) {
        cout << "Yay!"  << '\n';
    } else {
        cout << ":("  << '\n';
    }
}


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

namespace ConsoleApp5
{
    class Program
    {

        static void Main(string[] args)
        {
            String S = Console.ReadLine();
            String[] L = S.Split(' ');
            int H = int.Parse(L[0]);
            int W = int.Parse(L[1]);
            int K = int.Parse(L[2]);

            List<int[]> Black = new List<int[]>();

            for (int i=0; i<H; i++)
            {
                S = Console.ReadLine();
                for(int j=0; j<W; j++)
                {
                    if(S[j] == '#')
                    {
                        Black.Add(new int[2] { i, j });
                    }
                }
            }

            int blackcount = Black.Count();
            int N = H + W;
            int ans = 0;
            bool[] red = new bool[N];

            for (int i = 0; i < Math.Pow(2, N); i++)
            {
                int res = 0;
                
                for (int j = 0; j < blackcount; j++)
                {
                    if (red[Black[j][0]] == false && red[Black[j][1] + H] == false)
                    {
                        res++;
                    } 
                }
                if(res == K)
                {
                    ans++;
                }
                
                for (int j = 0; j < N; j++)
                {
                    if (red[j] == false)
                    {
                        red[j] = true;
                        break;
                    }
                    else
                    {
                        red[j] = false;
                    }

                }
                
            }
            Console.WriteLine(ans);

        }
    }
}

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

dp = [[0] * 3 for _ in range(N)]
#dp = [[0]*3]*N

arr = [list(map(int, input().split())) for _ in range(N)]

dp[0][0]=arr[0][0]
dp[0][1]=arr[0][1]
dp[0][2]=arr[0][2]


for i in range(1,N,1):
    dp[i][0] = max(arr[i][0]+dp[i-1][1],arr[i][0]+dp[i-1][2])
    dp[i][1] = max(arr[i][1]+dp[i-1][0],arr[i][1]+dp[i-1][2])
    dp[i][2] = max(arr[i][2]+dp[i-1][0],arr[i][2]+dp[i-1][1])

print(max(dp[-1][0],dp[-1][1],dp[-1][2]))


Measured memory_bytes: 74988
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define EPS (1e-7)
#define INF (1e9)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
const double PI = acos(-1);
const ll MOD = 1000000007;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}
 
template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
///////////////////////////////////////////////////////////////

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    string S,T; cin >> S >> T;
    int N = S.size();
    int M = T.size();
    
    vector<vector<int>> dp(N+1, vector<int>(M+1));
    vector<vector<int>> py(N+1, vector<int>(M+1));
    vector<vector<int>> px(N+1, vector<int>(M+1));
    rep(i,N) {
        rep(j,M) {
            if (S[i] == T[j]) {
              dp[i+1][j+1] = dp[i][j] + 1;
              py[i+1][j+1] = i;
              px[i+1][j+1] = j;
            } else {
                if (dp[i][j+1] >= dp[i+1][j]) {
                    dp[i+1][j+1] = dp[i][j+1];
                    py[i+1][j+1] = i;
                    px[i+1][j+1] = j+1;
                } else {
                    dp[i+1][j+1] = dp[i+1][j];
                    py[i+1][j+1] = i+1;
                    px[i+1][j+1] = j;
                }
            }
        }
    }

    string ans = "";
    int k = N;
    int l = M;
    while (k != 0 && l != 0) {
        int y = py[k][l];
        int x = px[k][l];
        if (y != k && x != l) {
            ans += S[k-1];
        }
        k = y;
        l = x;
    }
    
    reverse(all(ans));

    cout << ans << endl;
}


Measured memory_bytes: 106112
package main

import(
  "fmt"
)

func main(){
  var n  , y int
  fmt.Scan( &n , &y )

  man10000 := -1
  man5000 := -1
  man1000 := -1
  for man := 0 ; man <= n ; man++ {
    for gosen := 0 ; man + gosen <= n ; gosen++ {
      sen := n - man - gosen
        if ( man + gosen + sen == n ) && ( man * 10000 + gosen * 5000 + sen * 1000 == y ) {
          man10000 = man
          man5000 = gosen
          man1000 = sen
      }
    }
  }

  fmt.Printf("%d %d %d" , man10000 , man5000 , man1000 )

}


Measured memory_bytes: 512
N, K = map(int, input().split())
*A, = map(int, input().split())
A = sorted(A)
if K in A:
    print('POSSIBLE')
else:
    temp = [A[i+1] - A[i] for i in range(N-1) if A[i+1] - A[i] > 0]
    diff = min(temp) if temp else -1
    if diff == -1:
        print('IMPOSSIBLE')
    else:
        for a in [a for a in A if a >= K]:
            if (a - K) % diff == 0:
                print('POSSIBLE')
                break
        else:
            print('IMPOSSIBLE')

Measured memory_bytes: 14224
// inputに入力データ全体が入る
function main(input) {
// 1行目がinput[0], 2行目がinput[1], …に入る
  input = input.split('\n');
  const first = ~~input[0];
  const s1 = ~~input[1].split(' ')[0];
  const s2 = ~~input[1].split(' ')[1];
  let i = first;
  while (i <= s2) {
    if (s1 <= i && i <= s2) {
      console.log('OK');
      return;
    }
    i += first;
  }
  console.log('NG')
  return;
}

//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 29492
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main(){
	int n,l;
  cin>>n>>l;
  vector<string>s(n);
  for(int i=0;i<n;i++){
	  cin>>s[i];
  }
  sort(s.begin(),s.end());
  for(int i=0;i<n;i++){
	  cout<<s[i];
  }
  
	return 0;
}


Measured memory_bytes: 3608
#include <iostream>

int main() {

	int a, b;

	std::cin >> a >> b;

	if (a < b) {
		std::cout << "a < b"
			<< std::endl;
	}
	else if (a > b) {
		std::cout << "a > b"
			<< std::endl;
	}
	else{
		std::cout << "a == b"
			<< std::endl;
	}
		return 0;
}



Measured memory_bytes: 3092
#include<stdio.h>
int main(void){
     int H,W,i,j;
     while(1){
     scanf("%d %d",&H,&W);
     if(W==0&&H==0) break;
     for(i=0;i<H;i++){
          for(j=0;j<W;j++){
               printf("#");
          }
          printf("\n");
     }
     printf("\n");

     }
     return 0;
}

Measured memory_bytes: 572
/**
 *    author:  otera    
**/
#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll mod=1e9+7 ;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define debug(x)  cerr << #x << " = " << (x) << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
#define int long long

int n;
vector<vector<int>> g;

int rec(int v, int p) {
    int res = 0;
    int zero_num = 0;
    for(int nv: g[v]) {
        if(nv == p) continue;
        int tmp = rec(nv, v);
        res += tmp;
        if(tmp == 0) zero_num ++;
    }
    if(zero_num > 1) res += zero_num - 1;
    return res;
}

void solve() {
	cin >> n;
    g.assign(n, vector<int>());
    int r = -1;
    rep(i, n - 1) {
        int a, b; cin >> a >> b;
        g[a].pb(b);
        g[b].pb(a);
        if(g[a].size() > 2) r = a;
        if(g[b].size() > 2) r = b;
    }
    if(r == -1) {
        cout << 1 << endl;
        return;
    }
    cout << rec(r, -1) << endl;
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//int t; cin >> t; rep(i, t)solve();
	solve();
    return 0;
}

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


public class Test
{	
    public static void Main()
	{   
	    int n = int.Parse(Console.ReadLine());
	    if(n%2 == 0) Console.WriteLine(n);
	    else Console.WriteLine(n*2);
	}
}

Measured memory_bytes: 13140
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int main() {
    int n,total=0;
    cin>>n;
    int a[110];
    for(int i=0;i<n;i++){
        cin>>a[i];
        total=total+a[i];
    }
    int ave;
    ave=total*1000/n;
    int answ,ans=100000;
    for(int i=0;i<n;i++){
        int b;
        b=a[i]*1000-ave;
        if(b<0)b=-b;
        if(b<ans){
            ans=b;
            answ=i;
        }
    }
    cout << answ<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;

int main() {
    int n,k;
    cin >> n >> k;

    vector<ll> x(n), y(n);
    vector<ll> xary, yary;

    for(int i=0; i<n; ++i) {
        cin >> x[i] >> y[i];
        xary.push_back(x[i]);
        yary.push_back(y[i]);
    }

    sort(xary.begin(),xary.end());
    sort(yary.begin(),yary.end());

    ll ans = (xary[n-1] - xary[0]) * (yary[n-1] - yary[0]);

    for(int xi=0; xi<n; ++xi) {
        for(int xj=xi+1; xj<n; ++xj) {
            for(int yi=0; yi<n; ++yi) {
                for(int yj=yi+1; yj<n; ++yj) {
                    
                    ll lx = xary[xi];
                    ll rx = xary[xj];
                    ll ly = yary[yi];
                    ll uy = yary[yj];

                    int num = 0;
                    for(int i=0; i<n; ++i) {
                        if(x[i] >= lx && x[i] <= rx && y[i] >= ly && y[i] <= uy) num++;
                    }

                    if(num >= k) ans = min(ans, (rx - lx) * (uy - ly));
                }
            }
        }
    }

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

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

using namespace std;
#define MN 2000
#define whole(xs) xs.begin(), xs.end()
#define INF (1<<28)

int N, M;

struct Edge {
    int u, v;
    int dist, cost;
    Edge(int u, int v, int dist, int cost) : 
        u(u), v(v), dist(dist), cost(cost) {}
};
typedef vector<Edge> Vertex;

vector<Vertex> Graph;
bool input() {
    scanf("%d %d", &N, &M);
    if (N == 0 && M == 0) return false;
    Graph.clear(); Graph.resize(N);
    for (int i = 0; i < M; i++) {
        int u, v, d, c; scanf("%d %d %d %d", &u, &v, &d, &c);
        u--; v--;
        Graph[u].push_back(Edge(u, v, d, c));
        Graph[v].push_back(Edge(v, u, d, c));
    }
    return true;
}

struct S {
    int v;
    int dist, cost, prev;
    S(int v, int dist, int cost, int prev) : v(v), dist(dist), cost(cost), prev(prev) {}
};
bool operator<(const S& a, const S& b) {
    return (a.dist == b.dist ? a.cost > b.cost : a.dist < b.dist);
}
bool operator>(const S& a, const S& b) {
    return (!(a < b));
}
ostream& operator<<(ostream& os, const S& s) {
    os << "v: " << s.v << " dist: " << s.dist << " cost: " << s.cost << " prev: " << s.prev;
    return os;
}
struct P {
    int v, dist;
    P(int v, int dist) : v(v), dist(dist) {}
};
bool operator<(const P& a, const P& b) {
    return a.dist < b.dist;
}
bool operator>(const P& a, const P& b) {
    return (!(a < b));
}
vector<S> CalcDist() {
    vector<S> V(N, S(0, INF, INF, -1));
    for (int i = 0; i < N; i++) V[i].v = i;
    priority_queue< P, vector<P>, greater<P> > PQ;
    PQ.push(P(0, 0));
    V[0].dist = 0; V[0].cost = 0; V[0].prev = -1;
    while (!PQ.empty()) {
        P cur = PQ.top(); PQ.pop();
        for (int i = 0; i < Graph[cur.v].size(); i++) {
            Edge& next = Graph[cur.v][i];
            if (V[next.v].dist == V[cur.v].dist + next.dist && V[next.v].cost > next.cost) {
                V[next.v].cost = next.cost;
                V[next.v].prev = cur.v;
                PQ.push(P(V[next.v].v, V[next.v].dist));
            } else if (V[next.v].dist > V[cur.v].dist + next.dist) {
                V[next.v].dist = V[cur.v].dist + next.dist;
                V[next.v].cost = next.cost;
                V[next.v].prev = cur.v;
                PQ.push(P(V[next.v].v, V[next.v].dist));
            }
        }
    }
    return V;
}

int main() {
    while (input()) {
        vector<S> V = CalcDist();
        int Ans = 0;
        for (int i = 0; i < N; i++) {
            Ans += V[i].cost;
        }
        cout << Ans << endl;
    }
    return 0;
}

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

using namespace std;

typedef long long ll;
typedef long double ld;

typedef pair<int, int> pii;
typedef pair<int, ll> pil;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;

const int MAXN = 1e6 + 15;
vi d[MAXN];
int cnt[MAXN];

void eratosphen()
{
      for (int i = 1; i < MAXN; ++i)
      {
            for (int j = i; j < MAXN; j += i)
                  d[j].push_back(i);
      }
}

int main()
{
      ios::sync_with_stdio(0);

      eratosphen();

      int n;
      cin >> n;
      vi a(n);

      for (int i = 0; i < n; ++i)
      {
            cin >> a[i];
            ++cnt[a[i]];
      }

      int res = 0;

      for (int i = 0; i < n; ++i)
      {
            --cnt[a[i]];
            bool ok = 1;
            for (int v : d[a[i]])
            {
                  if (cnt[v] > 0)
                        ok = 0;
            }
            res += ok;
            ++cnt[a[i]];
      }

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

Measured memory_bytes: 122336
//----------------------------------------------------------------------
#include <algorithm>
#include <bits/stdc++.h>
#include <iterator>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
//----------------------------------------------------------------------

using namespace std;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;

int main(void) {
    int n;
    cin >> n;
    vector<int> p(n);
    vector<int> q(n);
    rep(i, n)
        cin >> p[i];
    rep(i, n)
        cin >> q[i];

    vector<int> a(n);
    rep(i, n)
        a[i] = i + 1;


    int numa = 0;
    int numb = 0;
    int cnt = 0;
    do {
        cnt++;
        bool flag1 = true;
        bool flag2 = true;
        for(int i = 0; i < n; ++i) {
            if(a[i] != p[i]) {
                flag1 = false;
            }
            if(a[i] != q[i]) {
                flag2 = false;
            }
        }

        if(flag1) {
            numa = cnt;
        }
        if(flag2) {
            numb = cnt;
        }
    }while(next_permutation(a.begin(), a.end()));

    cout << abs(numa - numb) << endl;

    return 0;
}


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

int main() {
  int64_t L1 = 2;
  int64_t L2 = 1;
  int64_t L3;
  int N;
  cin >> N;
  
  if (N == 0) {
    cout << L1 << endl;
  }
  else if (N == 1) {
    cout << L2 << endl;
  }
  else {
    for (int i = 2; i <= N; i++) {
      L3 = L1 + L2;
      L1 = L2;
      L2 = L3;
    }
    cout << L3 << endl;
  }
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Diagnostics.Contracts;
using System.Globalization;
using System.Linq;

namespace at_coder
{
#if TEST
    [TestClass]
#endif
    public class Test_169_a
    {

#if TEST
        public static void Test_Main()
#else
        public static void Main()
#endif
        {
            int a, b;
            ReadInt(out a, out b);

            Write($"{a * b}");
        }


        private static void Write(string s)
        {
            Console.WriteLine(s);
        }

        private static int[] ReadIntArray()
        {
            string[] ss = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
            int[] ar = new int[ss.Length];
            for (int i = 0; i < ss.Length; i++)
            {
                ar[i] = int.Parse(ss[i], CultureInfo.InvariantCulture);
            }
            return ar;
        }
        private static int ReadInt()
        {
            return int.Parse(Console.ReadLine(), CultureInfo.InvariantCulture);
        }
        private static void ReadInt(out int a, out int b)
        {
            var ar = ReadIntArray();
            a = ar[0];
            b = ar[1];
        }
        private static void ReadInt(out int a, out int b, out int c)
        {
            var ar = ReadIntArray();
            a = ar[0];
            b = ar[1];
            c = ar[2];
        }
        private static string ReadString()
        {
            return Console.ReadLine();
        }
        private static string[] ReadStringArray()
        {
            string[] ss = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
            return ss;
        }
#if !TEST
    }
}
#endif

Measured memory_bytes: 25908
let arr=readLine()!.characters.split{$0==" "}.map{Int(String($0))!}

let a = arr[0]
let b = arr[1]

var ans: String = ""
var r: String
var n: Int

if (a < b) {
  r = String(a)
  n = b
} else {
  r = String(b)
  n = a
}

var i = 0
for i in 0..<n {
  ans = ans + r
}

print(ans)

Measured memory_bytes: 4080
#include<iostream>
using namespace std;
int main(){
	while(1){
	int n,x;
	cin>>n>>x;
	if(n==0&&x==0)break;
	int c=0;
	for(int i=1;i<=n;i++){
		for(int j=i+1;j<=n;j++){
			for(int z=j+1;z<=n;z++){
				if(i!=j&&j!=z&&i!=z&&i+j+z==x){
					c++;
				}
			}
		}
	}
	cout<<c<<endl;
	}
}

Measured memory_bytes: 3080
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstdio>
#include <cmath>
#include <string>
#include <string.h>
#include <stack>
#include <queue>
#include <map>
#include <stdlib.h>
#include <set>
typedef long long ll;
using namespace std;

int main() {
	int n,cnt=0;
	cin>>n;
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			if(i*4+j*7==n){
				cnt++;
			}
		}
	}
	if(cnt>0){
		cout<<"Yes"<<endl;
	}else{
		cout<<"No"<<endl;
	}

	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define watch(x) cout << (#x) << " is " << (x) << endl

typedef long long ll;
typedef long double ld;
using namespace std;

const int MOD = 1e9 + 7;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int count = 0;
    double a, b;
    cin >> a >> b;
    cout << ceil((b - 1)/(a - 1));

    return 0;
}


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

int main()
{
	string S;
	cin >>S;

	//文字数を入手
	int ans =S.size();

	//答え方は1010...か0101...の2通り
	for (int i=0;i<2;i++)
	{
		int change=0;
		for(int j=0;j<S.size();j++)
		{
			//(char)(0+'0') ->0
			//(char)(1+'0') ->1
			//偶数番目
			 if(j%2==0&&S[j]!=(char)(i+'0'))
			 change++;
			 //キ数番目
			 if(j%2==1&&S[j]==(char)(i+'0'))
			 change++;
		}
		ans =min(ans,change);
	}
	cout << ans<<endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
const ll MOD = 1000000007;
const ll INF = 10000000000000000;
vector<int> x4 = {0, 1, 0, -1}, x8 = {0, 1, 1, 1, 0, -1, -1, -1};
vector<int> y4 = {1, 0, -1, 0}, y8 = {1, 1, 0, -1, -1, -1, 0, 1};
template<class T> struct edge { int from, to; T cost;};
template<class T> inline bool chmin(T& a, T b){if (a>b){a = b; return true;}return false;}
template<class T> inline bool chmax(T& a, T b){if (a<b){a = b; return true;}return false;}
template<class T> inline T powerM(T a,T b){if (b==0) return 1;
T tmp = powerM(a,b/2); if (b%2==0) return tmp*tmp%MOD; else return tmp*tmp%MOD*a%MOD; }
template<class T> inline T power(T a,T b,T m){ if (b==0) return 1;
  T tmp = power(a,b/2,m); if (b%2==0) return tmp*tmp%m; else return tmp*tmp%m*a%m; }
template<class T> inline T gcd(T a, T b){if (b==0) return a; return gcd(b, a%b);}
template<class T> inline T lcm(T a, T b){return a / gcd(a,b) * b;}
// ax+by=gcd(a,b)を解く
template<class T> inline T extgcd(T a,T b,T &x,T &y){if (b==0){x=1; y=0; return a;} T d=extgcd(b,a%b,y,x); y -= a/b*x; return d;}
void chey(){ cout <<"hey" <<endl; }


int main() {
  int K; cin >>K;
  queue<ll> que;
  for (int i=1; i<=9; i++) que.push(i);
  ll x;
  rep(i, K){
    x = que.front(); que.pop();
    int b = x%10;
    if (x % 10 != 0) que.push(10*x+b-1);
    que.push(10*x+b);
    if (x % 10 != 9) que.push(10*x+b+1);
  }
  cout <<x <<endl;
}


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

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef long long LL;
typedef pair<int, int> PII;
typedef pair<LL,LL> PLL;
typedef map<int,int> MII;
typedef queue<int> QI;
typedef queue<PII> QPII;
typedef stack<int> SI;
typedef stack<PII> SPII;
typedef deque<int> DI;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef vector<bool> VB;
typedef vector<VB> VVB;
typedef vector<double> VD;
typedef vector<VD> VVD;
typedef vector<string> VS;
typedef vector<VS> VVS;
typedef vector<char> VC;
typedef vector<VC> VVC;
typedef vector<PII> VPII;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define PF push_front
#define POB pop_back()
#define POF pop_front()
#define MP make_pair
#define SZ(a) int((a).size())
#define SQ(a) ((a)*(a))
#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 LB lower_bound
#define UB upper_bound
#define SORTR(c) sort((c).begin(), (c).end(), greater<int>())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define FORR(i,a,b) for(int i = (b-1);i>=a;i--)
#define REPR(i,n) FORR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL INF = INT_MAX;
const LL LINF = LLONG_MAX;
const LL MOD = 1e9+7;
const LL MODD = 998244353;

//other
//-------------------------------------------
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define FI first
#define SE second

//memo
// << fixed << setprecision()

VI dx = {1,0,-1,0,1,1,-1,-1};
VI dy = {0,1,0,-1,1,-1,1,-1};

LL Gcd(LL a, LL b) {
  return __gcd(a,b);
}

LL Lcm(LL a, LL b) {
  LL abd = Gcd(a,b);
  LL x = a / abd, y = b / abd;
  
  return x*y*abd;
}


LL RepSqu(LL N, LL P, LL M) {
  if(N == 0) {
    return 0;
  }
  
  if(P == 0) {
    return 1;
  }
  if(P%2 == 0) {
    LL t = RepSqu(N, P/2, M);
    return t*t % M;
  }
  return (N * RepSqu(N, P-1, M)) % M;
}


int main() {
  
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int A,B,K,t=0;
  cin >> A >> B >> K;
  
  int C = Gcd(A,B);
//  cout << C << endl;
  
  FORR(i,1,C+1){
    if(C%i == 0){
     t++;
    }
    if(t == K){
     cout << i << endl;
      break;
    }
  }
  
  
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define all(x) (x).begin(), (x).end()
using namespace std;

int main() {
    int n;
    cin >> n;
    vector<int> b(n + 1);
    for (int i = 1; i <= n - 1; i++) cin >> b[i];
    b[0] = b[n] = 1e5 + 1;
    int sum = 0;
    for (int i = 1; i <= n; i++) {
        sum += min(b[i - 1], b[i]);
    }
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>

int main(void)
{
	//変数の宣言
	int n;
	int d[60];
	int i,j,k;
	int time[13];
	int flag=0;
	int time24[25];
	int temp=0;
	int ans=100;
	int lastans=0;
	
	//データの読み込み
	scanf("%d",&n);
	
	
	for(i=0;i<=12;i++){
		time[i]=0;
	}
	
	for(i=0;i<24;i++){
		time24[i]=0;
	}
	for(i=0;i<n;i++){
		scanf("%d",&d[i]);
		time[d[i]]++;
	}
	
//	printf("nは%dです\n", n);
//	printf("データの読み込み終了\n");
	//実際の処理
	
	if(n>=24){
		printf("0");
		return 0;
	}else if(n<12){
//		printf("n<12\n");
		for(i=0;i<=12;i++){
			if(i==0){
				if(time[i]>=1) flag=1;
			}else if(i==12){
				if(time[i]>=2) flag=1;
			}else{
				if(time[i]>=3) flag=1;
			}
		}
		if(flag==1){
			printf("0");
			return 0;
		}
		
//		printf("s!=0\n");
		
		time24[0]=1;
		time24[24]=1;
		for(i=0;i<(1<<n);i++){
//			printf("i=%d\n",i);
			
			for(j=1;j<24;j++){
				time24[j]=0;
			}
			
			for(j=0;j<n;j++){
				if(i&(1<<j)){
					if(time24[d[j]]==0){
						time24[d[j]]=1;
					}else{
						time24[24-d[j]]=1;
					}
				}else{
					if(time24[24-d[j]]==0){
						time24[24-d[j]]=1;
					}else{
						time24[d[j]]=1;
					}
				}
			}
			
//			for(j=0;j<24;j++){
//				printf("time24[%d]=%d\n",j,time24[j]);
//			}
			temp=1;
			ans=100;
			for(j=1;j<=24;j++){
				if(time24[j]==1){
					if(temp<ans) ans=temp;
//					printf("temp=%d ans=%d",temp,ans);
					temp=1;
				}else{
					temp++;
				}
			}
			if(lastans<ans) lastans=ans;
//			printf("%d\n",ans);
		}
		printf("%d",lastans);
	}else{
		for(i=0;i<=12;i++){
			if(i==0){
				if(time[i]>=1) flag=1;
			}else if(i==12){
				if(time[i]>=2) flag=1;
			}else{
				if(time[i]>=3) flag=1;
			}
		}
		if(flag==1){
			printf("0");
		}else{
			printf("1");
		}
		return 0;
	}
	
//	printf("計算部分終了\n");
	
	//出力
	
//	printf("結果の出力終了\n");
	
}



Measured memory_bytes: 128
a,b,c =map(int,input().split())
if a == 5 and b==5 and c==7:
  print("YES")
elif a == 5 and b==7 and c==5:
  print("YES")
elif a == 7 and b==5 and c==5:
  print("YES")
else :
  print("NO")

Measured memory_bytes: 2940
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const ll INF = 1LL << 62;
const int inf = 1 << 30;
const ll MOD = 1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b, const ll mod=MOD) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b, const ll mod=MOD) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b, const ll mod=MOD) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b, const ll mod=MOD) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n, x; cin >> n >> x;
    vll a(n); for(auto& e : a) cin >> e;

    ll res = 0LL;
    rep(i, 1, n){
        ll& pre = a[i-1];
        ll& cur = a[i];

        ll diff = pre + cur - x;
        if(diff < 0) continue;
        ll dcur = min(cur, diff);
        cur -= dcur;
        res += diff;
    }

    cout << res << endl;

    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define rep(i,n) for(int i=0;i<n;i++)

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

Measured memory_bytes: 3596
N, M, X = map(int, input().split())
from itertools import product

CA = [
  list(map(int, input().split())) for _ in range(N)
]
P = list(product([0,1], repeat = N))

COST = 10 ** 9 + 7
for p in P:
  skill = [0]*M
  cost = 0
  for i, _p in enumerate(p):
    if _p == 0:
      cost += CA[i][0]
      for j in range(M):
        skill[j] += CA[i][j+1]
  #print(skill, cost)
  if min(skill) >= X:
    COST = min(COST, cost)

if COST == 10 ** 9 + 7:
  print(-1)
else:
  print(COST)

Measured memory_bytes: 9564
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define pi M_PI
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1000000007,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<ll,ll> P;
bool cmp(P a,P b) {
  return a.F*b.S<b.F*a.S;
}
void Main() {
  ll n;
  R n;
  ll h[n+1],a[n+1],d[n+1],s[n+1];
  rep(i,n+1) cin >> h[i] >> a[i] >> d[i] >> s[i];
  ll ans=0,t=0;
  vector<P> v;
  REP(i,1,n+1) {
    ll x=a[i]-d[0],y=a[0]-d[i];
    if(x<=0) continue;
    if(y<=0) {
      pr(-1);
      return;
    }
    if(s[0]<s[i]) ans+=x;
    t+=x;
    v.pb(P((ll)ceil((double)h[i]/y),x));
  }
  sort(all(v),cmp);
  rep(i,v.size()) {
    ans+=t*v[i].F-v[i].S;
    if(ans>=h[0]) {
      pr(-1);
      return;
    }
    t-=v[i].S;
  }
  pr(ans);
}

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


Measured memory_bytes: 4900
#include <iostream>

using namespace std;

int main()
{
	int a, b;
	cin >> a >> b;

	if (a > b) cout << "a > b" << endl;
	if (a < b) cout << "a < b" << endl;
	if (a == b) cout << "a == b" << endl;
	return 0;
}

Measured memory_bytes: 1156
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
typedef pair<ll, ll> P;

vector<P> prime_factorize(ll N){
	vector<P> ans;
	for(ll a = 2; a*a <= N; a++){
		if(N%a == 0){
			ll ex = 0;
			while(N%a == 0){
				ex++;
				N /= a;
			}
			ans.push_back(P(a, ex));
		}
	}
	if(N != 1) ans.push_back(P(N, 1));
	return ans;
}


int main(){
    ll A, B; scanf("%lld %lld", &A, &B);
    ll g = __gcd(A, B);
    auto vec = prime_factorize(g);
    printf("%d\n", int(vec.size()) + 1);
}

Measured memory_bytes: 3752
#include<bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define int long long
#define vec(a,n) vector<int> (a)((n));
#define Vec(a,n) vector<string> (a)((n));
#define twovec(a,n,m) vector<vector<int>> a(n,vector<int>(m,0));
#define Twovec(a,n,m) vector<vector<double>> a(n,vector<double>(m,0));
#define P pair<int,int>
#define All(a) (a).begin(),(a).end()
#define Sort(a) sort(All(a));
#define Reverse(a) reverse(All(a));
#define PQ(n) priority_queue<P,vector<P>,greater<P>> (n)
#define pq(n) priority_queue<int> (n)
#define print(a) cout << (a) << endl;
#define printD(a) cout << setprecision(10) << ans << endl;
using namespace std;
int max_int = 1000000007;
void Debug(auto a);
int nibul(auto a,auto b);
int nibuu(auto a,auto b);
void input(vector<int>& a,int n);

int n;
struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

int m = -2;
signed main(){
    cin >> n;
    vector<int> a;
    if(n==0){
        print(0)
        return 0;
    }
    while(n != 1){
        if(n>0){
            //print(n%m)
            a.push_back(n%m);
            n /= m;
        }
        else{
            //負
            int x = n/m;
            int y = abs(n%m);
            if(y==1){
                x++;
            }
            //cout << x << " " << y << endl;
            a.push_back(y);
            n = x;
        }
    }
    a.push_back(1);
    REP(i,a.size()){
        cout << a[a.size()-1-i];
    }
    return 0;
}

void Debug(auto a){
    cout << "{ ";
    for(auto b: a){
        cout << b << " ";
    }
    cout << "}" << endl;
}
int nibul(auto a,auto b){
    int x = lower_bound(All(a),b) - a.begin();
    //key以上の初めてのitr
    return x;
}
int nibuu(auto a,auto b){
    int x = upper_bound(All(a),b) - a.begin();
    //key以下の最後のitr
    return x-1;
}

void input(vector<int>& a,int n){
    REP(i,n){
        cin >> a[i];
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>

using namespace std;

#define FOR(i,k,n) for(int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

template<class T> void debug(T begin, T end){ for(T i = begin; i != end; ++i) cerr<<*i<<" "; cerr<<endl; }
inline bool valid(int x, int y, int W, int H){ return (x >= 0 && y >= 0 && x < W && y < H); }

typedef long long ll;
const ll INF = 1LL<<60;
const double EPS = 1e-8;
const int MOD = 1000000007;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
ll get_cost(int from, int to, int L, const vector<ll>& accum){
  ll sum = accum[to] - accum[from - 1];
  return sum / L;
}

int main(){
  int N, M, L;
  while(cin >> N >> M >> L && N){
    vector<int> K(N);
    vector<int> S(M);
    REP(i, N) cin >> K[i];
    REP(i, M) cin >> S[i];

    vector<ll> accum(M + 1);
    REP(i, M) accum[i + 1] = accum[i] + S[i];

    sort(K.begin(), K.end());
    static ll dp[2000][2000] = {};
    REP(i, N)REP(j, N) dp[i][j] = INF;
    dp[0][1] = get_cost(K[0], K[1], L, accum);
    ll ans = INF;
    REP(i, N - 1) FOR(j, i + 1, N - 1){
      if(j + 1 != N - 1){ // default
        dp[i][j + 1] = min(dp[i][j + 1], dp[i][j] + get_cost(K[j], K[j + 1], L, accum)); // j -> j + 1
        dp[j][j + 1] = min(dp[j][j + 1], dp[i][j] + get_cost(K[i], K[j + 1], L, accum)); // i -> j + 1
      }else{ // goal
        ans = min(ans, dp[i][j] + get_cost(K[i], K[N - 1], L, accum) + get_cost(K[j], K[N - 1], L, accum));
      }
    }
    cout<<ans<<endl;
  }
  return 0;
}

Measured memory_bytes: 33584