akhauriyash/Code-Regression huggingface dataset:
import sys
from io import StringIO
import unittest


def resolve():
    n, m, x = map(int, input().split())

    ca = [list(map(int, input().split())) for _ in range(n)]
    cost_list = []

    for i in range(2 ** n):
        cost = 0
        skills = [0] * m
        for j in range(n):
            if ((i >> j) & 1):
                cost += ca[j][0]
                for num, s in enumerate(ca[j][1:]):
                    skills[num] += s

        if all([sk >= x for sk in skills]):
            cost_list.append(cost)

    if cost_list == []:
        print(-1)
    else:
        print(min(cost_list))


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """3 3 10
60 2 2 4
70 8 7 9
50 2 3 9"""
        output = """120"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """3 3 10
100 3 1 4
100 1 5 9
100 2 6 5"""
        output = """-1"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """8 5 22
100 3 7 5 3 1
164 4 5 2 7 8
334 7 2 7 2 9
234 4 7 2 8 2
541 5 4 3 3 6
235 4 8 6 9 7
394 3 6 1 6 2
872 8 4 3 7 2"""
        output = """1067"""
        self.assertIO(input, output)


if __name__ == "__main__":
    # unittest.main()
    resolve()


Measured memory_bytes: 16412
import java.io.*;

public class Main {
	public static void main(String[] args) {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		try {
			//initialize
			double dp[][][][] = new double[16][9][9][9];
			for(int i=0;i<16;i++){
				for(int j=0;j<9;j++){
					for(int k=0;k<9;k++){
						for(int l=0;l<9;l++){
							dp[i][j][k][l] = -1.0;
						}
					}
				}
			}
			String line;
			while(true){
				/* input */
				line = br.readLine();

				int n = Integer.parseInt(line);

				if(n==0) break;

				line = br.readLine();

				char s = line.split(" ")[0].charAt(0), t = line.split(" ")[1].charAt(0), b = line.split(" ")[2].charAt(0);

				/* processing */
				

				double ans = solve(dp, n,s-'A',t-'A',b-'A');
				/* output */
				System.out.println(ans);
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	public static double solve(double[][][][] dp, int n, int s, int t, int b){
		if(dp[n][s][t][b]>=0) return dp[n][s][t][b];
		if(n==0){
			if(s==t){
				dp[n][s][t][b] = 1.0;
				return 1.0;
			} else {
				dp[n][s][t][b] = 0.0;
				return 0.0;
			}
		} else {
			double ret = 0;
			if(dp[n-1][s>2&&b!=s-3?s-3:s][t][b]>=0){
				ret += 0.25*dp[n-1][s>2&&b!=s-3?s-3:s][t][b];
			} else {
				dp[n-1][s>2&&b!=s-3?s-3:s][t][b] = solve(dp,n-1,s>2&&b!=s-3?s-3:s,t,b); 
				ret += 0.25*dp[n-1][s>2&&b!=s-3?s-3:s][t][b];
			}
			if(dp[n-1][s%3!=2&&b!=s+1?s+1:s][t][b]>=0){
				ret += 0.25*dp[n-1][s%3!=2&&b!=s+1?s+1:s][t][b];
			} else {
				dp[n-1][s%3!=2&&b!=s+1?s+1:s][t][b] = solve(dp,n-1,s%3!=2&&b!=s+1?s+1:s,t,b); 
				ret += 0.25*dp[n-1][s%3!=2&&b!=s+1?s+1:s][t][b];
			}
			if(dp[n-1][s<6&&b!=s+3?s+3:s][t][b]>=0){
				ret += 0.25*dp[n-1][s<6&&b!=s+3?s+3:s][t][b];
			} else {
				dp[n-1][s<6&&b!=s+3?s+3:s][t][b] = solve(dp,n-1,s<6&&b!=s+3?s+3:s,t,b);
				ret += 0.25*dp[n-1][s<6&&b!=s+3?s+3:s][t][b];
			}
			if(dp[n-1][s%3!=0&&b!=s-1?s-1:s][t][b]>=0){
				ret += 0.25*dp[n-1][s%3!=0&&b!=s-1?s-1:s][t][b];
			} else {
				dp[n-1][s%3!=0&&b!=s-1?s-1:s][t][b] =solve(dp,n-1,s%3!=0&&b!=s-1?s-1:s,t,b);
				ret += 0.25*dp[n-1][s%3!=0&&b!=s-1?s-1:s][t][b];
			}
			
			dp[n][s][t][b] = ret;
			return ret;
		}
	}
}

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

#define maxn 1e10

using namespace std;

long long sum[200010];
long long x[200010];

int main()
{
	int n,a;
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&a);
		sum[i]=sum[i-1]+a;
		x[i]=x[i-1]^a;
	}
	int l=1;
	long long ans=0;
	for(int r=1;r<=n;r++)
	{
		while(sum[r]-sum[l-1]!=(x[r]^x[l-1])) l++;//满足条件就走，当l=r-1时肯定会走 
		ans+=r-l+1;
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 3328
//  LINK ZADATKA: http://code-festival-2017-qualb.contest.atcoder.jp/tasks/code_festival_2017_qualb_a

#include <queue>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <complex>
#include <fstream>
#include <cstring>
#include <string>
#include <climits>

using namespace std;

typedef long long ll;
typedef complex<double> point;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector< vector<int> > vvi;

#define sd(x) scanf("%d",&x)
#define slld(x) scanf("%lld",&x)
#define ss(x) scanf("%s",x)
#define FOR(k,a,b) for(int k=(a); k<=(b); ++k)
#define REP(k,a) for(int k=0; k<(a);++k)
#define SZ(a) int((a).size())
#define ALL(c) (c).begin(),(c).end()
#define PB push_back
#define MP make_pair
#define INF 999999999
#define INFLONG 1000000000000000000
#define MOD 1000000007
#define MAX 100
#define ITERS 100
#define MAXM 200000
#define MAXN 1000000
#define _gcd __gcd
#define eps 1e-9


char p[100], sol[100];
int main(){

	ss(p);

	int dulj = strlen(p);
	
	FOR(i, 0, dulj-9){
		sol[i] = p[i];	
	}
	printf("%s", sol);
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define FORD(i,a,b) for (int i = (a); i >= (b); i--)
#define REP(i,a) FOR(i,0,(int)(a)-1)
#define reset(a,b) memset(a,b,sizeof(a))
#define BUG(x) cout << #x << " = " << x << endl
#define PR(x,a,b) {cout << #x << " = "; FOR (_,a,b) cout << x[_] << ' '; cout << endl;}
#define CON(x) {cout << #x << " = "; for(auto i:x) cout << i << ' '; cout << endl;}
#define mod 1000000007
#define pi acos(-1)
#define eps 0.00000001
#define pb push_back
#define sqr(x) (x) * (x)
#define _1 first
#define _2 second
 
int n, ma, mb, a[44], b[44], c[44], dp[444][444];
 
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> ma >> mb;
  REP (i, n) cin >> a[i] >> b[i] >> c[i];
  REP (i, 444) REP (j, 444) dp[i][j] = mod;
  dp[0][0] = 0;
  REP (ii, n) {
  	FORD (i, 400, 0) FORD (j, 400, 0) if (dp[i][j] != mod) {
  		dp[i + a[ii]][j + b[ii]] = min(dp[i + a[ii]][j + b[ii]], dp[i][j] + c[ii]);
  	}
  }
  int ans = mod;
  FOR (i, 1, 400) FOR (j, 1, 400) if (i * mb == j * ma) ans = min(ans, dp[i][j]);
  if (ans == mod) cout << -1;
  else cout << ans;
}

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

int main() 
{
    int n;
    float t,a;
    cin >> n >> t >> a;
    float m=(float)INT_MAX;
    int j=1;
    for (int i=1; i<=n; i++)
    {
        float h;
        cin >> h;
        float z = (float)abs(t-h*0.006-a);
        // cout << z << endl;
        if (z<m)
        {
            m = z;
            j=i;
            // cout << "abs" << endl;
        }
    }
    cout << j;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<climits>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<ctime>
#include<string>
#include<cstring>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<bitset>
#define endl "\n"
using namespace std;

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

  int len, index;
  char w[100]; cin >> w;
  char sorted[100];
  char max, tmp;
  bool flag=1;
  len = strlen(w);

  //selectionsSort
  for (int i = 0; i < len-1; i++)
  {
    max = w[i];
    index = i;
    for (int j = i+1; j < len; j++)
    {
      if (w[j] > max)
      {
        max = w[j];
        index = j;
      }
    }
    if (i != index)
    {
      tmp = w[i];
      w[i] = max;
      w[index] = tmp;
    }
  }

  for (int i=0; i < len; i+=2)
  {
    if (w[i] != w[i+1])
    {
      flag = 0;
      break;
    }
  }
  if (flag) cout << "Yes" << endl;
  else cout << "No" << endl;

  return 0;
}


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

using namespace std;

int main(){
  string s;
  cin>>s;
  string strs[]={
    "dream",
    "dreamer",
    "erase",
    "eraser"
  };
  bool dp[100001]={true};
  for(int i=0;i<s.size();i++){
    for(auto e:strs){
      int n=i+e.size();
      if(n<=s.size()&&!s.compare(i,e.size(),e)){
	dp[n]|=dp[i];
      }
    }
  }
  cout<<(dp[s.size()]?"YES":"NO")<<endl;
}


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

using namespace std;

#define ok1 printf("ok1\n");
#define ok2 printf("ok2\n");
#define M 1000000000000000000LL
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define pb push_back
#define pf push_front
#define MIN(a,b) a=min((a),(b))
#define MAX(a,b) a=max((a),(b))
#define SIZE(v) (int)v.size()
#define Eunique(v) v.erace(unique(all(v)),v.end())
#define pvec(v)　rep(i,v.size()){cout << v[i] << " ";}
#define INF 0x3f3f3f3f
#define mset(m,v) memset(m,v,sezeof(m))
#define mod (int)(1e9 +7);

const double pi = acos(-1.0);

typedef vector<int> vi;
typedef string ss;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef deque<ll> dll;
typedef pair<ll,ll> P;
ll dx[4] = {1,0,-1,0},dy[4] = {0,1,0,-1};

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

ll lcm(ll a,ll b){
    ll g = gcd(a,b);
    return a / g * b; // Be careful not to overflow
}

int main()
{
    ll n,k;
    double ans=0;
    cin >> n >> k;

    REP(i,1,min(n + 1,k)){
        double tmp1 = (double)1 / n;
        ll tmp2 = i;
        while(tmp2 < k){
            tmp1 *= 0.5;
            tmp2 *= 2;
        }

        ans += tmp1;

        //cout << n << " " << k/i << " ";
        //printf("%.20f\n",((double)1/n) * pow(0.5,k/i));
    }
    if(n >= k)ans += ((double)1/n) * (n - k + 1);

    //cout << endl;
    printf("%.10f\n",ans);

    //cout << (double)10 / 3 << endl;

    return 0;
}

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

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            //[summary]C - Green Bin
            int n = int.Parse(Console.ReadLine());
            var words = new List<string>();

            for (int i = 0; i < n; i++)
            {
                var chars = new Dictionary<string, int>();
                var s = Console.ReadLine();

                foreach (var c in s)
                {
                    var si = c.ToString();

                    if (chars.ContainsKey(si))
                    {
                        chars[si]++;
                    }
                    else
                    {
                        chars.Add(si, 1);
                    }
                }

                var query = chars.OrderBy(x => x.Key);
                string word = "";

                foreach (var q in query)
                {
                    word += q.Key + q.Value;
                }

                words.Add(word);
            }

            var dic = new Dictionary<string, int>();

            foreach (var word in words)
            {
                if (dic.ContainsKey(word))
                {
                    dic[word]++;
                }
                else
                {
                    dic.Add(word, 1);
                }
            }

            long count = 0;

            for (int i = 0; i < n; i++)
            {
                dic[words[i]]--;
                count += dic[words[i]];
            }

            Console.WriteLine(count);
        }
    }
}

Measured memory_bytes: 32488
#include <bits/stdc++.h>
using namespace std;
#define dump(x) cout << (x) << '\n';
#define fi first
#define se second
typedef int64_t Int;
Int mod = 1e9+7;
Int INF = 1e9+7;

int main() {
    Int n;
    cin >> n;
    dump(n * n * n);
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cmath>
#include <complex>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <vector>

const int MOD = 1e9 + 7;
const int iINF = 2147483647 / 2;
const long long int llINF = 9223372036854775807 / 2;

using namespace std;
using ll = long long int;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vvvl = vector<vector<vector<ll>>>;

typedef pair<ll, ll> pll;
bool paircomp(const pll &a, const pll &b) {
  if (a.first == b.first)
    return a.second < b.second;
  return a.first < b.first;
}

#define REP(i, n) for (ll i = 0; i < (n); i++)
#define RREP(i, n) for (ll i = (n)-1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define AUTO(i, m) for (auto &i : m)
#define ALL(a) (a).begin(), (a).end()
#define MAX(vec) *std::max_element(vec.begin(), vec.end())
#define MIN(vec) *std::min_element(vec.begin(), vec.end())
#define ARGMAX(vec)                                                            \
  std::distance(vec.begin(), std::max_element(vec.begin(), vec.end()))
#define ARGMIN(vec)                                                            \
  std::distance(vec.begin(), std::min_element(vec.begin(), vec.end()))
#define REV(T) greater<T>()
#define PQ(T) priority_queue<T, vector<T>, greater<T>>
#define VVL(a, b, c) vector<vector<ll>>(a, vector<ll>(b, c))
#define VV(T, a, b, c) vector<vector<T>>(a, vector<T>(b, c))
#define VVVL(a, b, c, d)                                                       \
  vector<vector<vector<ll>>>(a, vector<vector<ll>>(b, vector<ll>(c, d)))
#define VVV(T, a, b, c, d)                                                     \
  vector<vector<vector<T>>>(a, vector<vector<T>>(b, vector<T>(c, d)))
#define SP(a) setprecision(a)
#define SQRT(a) sqrt((long double)(a))
#define DPOW(a, b) pow((long double)(a), (long double)(b))
#define UNIQUE(vec)                                                            \
  do {                                                                         \
    sort(ALL((vec)));                                                          \
    (vec).erase(std::unique(ALL((vec))), (vec).end());                         \
  } while (0)

ll POW(ll n, ll m) {
  if (m == 0) {
    return 1;
  } else if (m % 2 == 0) {
    ll tmp = POW(n, m / 2);
    return (tmp * tmp);
  } else {
    return (n * POW(n, m - 1));
  }
}

int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ll N;
  cin >> N;
  vl A(N);
  ll po = 0;
  REP(i, N) {
    cin >> A[i];
    po ^= A[i];
  }
  REP(i, N) cout << (po ^ A[i]) << " ";
  cout << endl;

  return 0;
}


Measured memory_bytes: 4768
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define rep(i,n) for(ll i = 0; i < (ll)(n); i++)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll INF = 1LL << 60;
int main(){
    ll n, a, b;
    cin >> n >> a >> b;
    ll ans = n / (a+b) * a;
    ans += min(a,n%(a+b));
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
c = [0]*3
for i in range(3):
	c[i] = list(map(int,input().split()))
a = [0]*3
b = [0]*3
a[0] = 0
for j in range(3):
	b[j] = c[0][j] - a[0]
a[1] = c[1][0] - b[0]
a[2] = c[2][0] - b[0]
count = 0
for i in range(3):
	for j in range(3):
		if c[i][j] == a[i] + b[j]:
			count += 1
if count == 9:
	print('Yes')
else:
	print('No')

Measured memory_bytes: 9172
#include <bits/stdc++.h>
using namespace std;
#define li long long int
#define pb push_back
#define rep(i,n) for(li i=0;i<n;i++)
void solve()
{
    li n;
    cin>>n;
    if(n>=400 && n<=599)
    cout<<"8";
    else if(n>=600 && n<=799)
    cout<<7;
    else if(n>=800 && n<=999)
    cout<<6;
    else if(n>=1000 && n<=1199)
    cout<<5;
    else if(n>=1200 && n<=1399)
    cout<<4;
    else if(n>=1400 && n<=1599)
    cout<<3;
    else if(n>=1600 && n<=1799)
    cout<<2;
    else
    cout<<1;
    
}

int main()
{
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    li t;
    t=1;
    while(t--)
    {
        solve();
        
    }
}

Measured memory_bytes: 3648
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include <climits>
using namespace std;

int main()
{
  int N, L;
  cin >> N >> L;
  int sum = 0;
  int min = 2000;
  int min_i = 1;
  for(int i = 1; i <= N; ++i){
    if(min >= abs(L + i - 1)){
      min = abs(L + i - 1);
      min_i = i;
    }
  }
  for(int i = 1; i <= N; ++i){
    if(i == min_i){
      continue;
    }
    sum += (L + i - 1);
  }
  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 256
def s()
  gets().chomp
end
def i()
  gets.to_i
end
def li()
  gets.split.map(&:to_i)
end
def ili()
  n = gets.to_i
  as = gets.split.map(&:to_i)
  [n, as]
end
class Array
  def sum
    total = 0
    self.each do |item|
      total += item
    end
    total
  end
end

def eratosthenes(size)
  prime_list = []
  is_prime = Array.new(size, true)
  is_prime[0] = false
  is_prime[1] = false

  2.upto(size-1){|i|
    if is_prime[i]
      prime_list << i
      (2).upto((size.to_f/i).ceil-1){|j|
        is_prime[j*i] = false
      }
    end
  }
  [prime_list, is_prime]
end

def dijkstra(s, e, cost)
  size = cost.length
  if s==e
    return 0
  end
  dp = {}
  dp[s] = 0
  undefined_node = {}
  size.times{|i|
    if i != s
      undefined_node[i] = cost[s][i]
    end
  }
  while undefined_node.length != 0
    min = undefined_node.min_by{|_, v| v}
    stock = {}
    temp = undefined_node.clone
    temp.each{|k, v|
      if min[1] == v
        undefined_node.delete(k)
        if k == e
          return v
        end
        dp[k] = v
        stock[k] = v
      end
    }

    stock.each{|k, v|
      undefined_node.each{|k2, v2|
        undefined_node[k2] = v + cost[k][k2] < v2 ?  v + cost[k][k2] : v2
      }
    }
  end
end

def get_bits(len)
  res =  []
  (2**len).times{|i|
    res << i.to_s(2).rjust(len, '0')
  }
  res
end

def get_GCD(m, n)
  tmp = [n, m].max
  n = [n, m].min
  m = tmp
  while n != 0
    tmp = m % n
    m = n
    n = tmp
  end
  m
end


n = i()
an = li()
minus = an.select {|item| item  <  0 }
plus = an.select {|item| item  >=  0 }
res = []
if minus.length == 0
  min, index = plus.each_with_index.min
  plus.delete_at(index)
  base = plus.pop
  plus.each { |a|
    res.push(min.to_s+" "+a.to_s)
    min -= a
  }
  res.push(base.to_s+" "+min.to_s)
  p base - min
elsif plus.length == 0
  max, index = minus.each_with_index.max
  minus.delete_at(index)
  base = minus.pop
  res = []
  minus.each { |a|
    res.push(max.to_s+" "+a.to_s)
    max -= a
  }
  res.push(max.to_s+" "+base.to_s)
  p  max - base
else
  minus_base = minus.pop
  plus_base = plus.pop
  plus.each { |a|
    res.push(minus_base.to_s + " " + a.to_s)
    minus_base -= a
  }
  minus.push(minus_base)
  minus.each { |a|

    res.push(plus_base.to_s + " " + a.to_s)
    plus_base -= a
  }
  puts plus_base
end

res.each { |r|
  puts r
}

Measured memory_bytes: 19888
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 文字列の入力
		String s = sc.next();
        String out = "";
        // sの文字列分の要素を持つ配列"strArray"作成
        String[] strArray = new String[s.length()];

		// 変数strの長さ分回す
        for (int i = 0; i < s.length(); i++) {
    	// 配列に順番に格納する
    		strArray[i] = String.valueOf(s.charAt(i));
		}
 
      
		System.out.println(check(strArray));
	}
  
  public static String check(String[] str){
	String out = "Yes";
    //判定関数
    for(int i=0;i<str.length;i++){
     if(i%2==0){
       //奇数(要素番号は偶数)
       if(str[i].equals("L"))
        out = "No";
     }
      else if(i%2==1){
       if(str[i].equals("R"))
         out = "No";
      }
    }
    
    return out;
  }
}

Measured memory_bytes: 21844
l = input().split()
a = l[0]
b = l[1]
flag = True
if (a=='H' and b=='H'):
    flag = True
if (a=='H' and b=='D'): 
    flag = False
if (a=='D' and b=='H'): 
    flag = False
if (a=='D' and b=='d'): 
    flag = True
print('H' if flag else 'D')

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define ll long long
#define MODV 1000000007
#define INFLL LLONG_MAX // 9223372036854775807
#define EPS 1e-9
#define rep(i, n) for(ll i=0, i##_len=(ll)(n); i<i##_len; i++)
#define repf(i, n) for(ll i=1, i##_len=(ll)(n+1); i<i##_len; i++)
#define all(v) v.begin(), v.end()
#define endl "\n"
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
#define Init() std::ios::sync_with_stdio(false); std::cin.tie(0); std::cout<<fixed<<setprecision(15);
template<class T>bool chmax(T &a, const T &b){ if(a<b){ a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b){ if(b<a){ a=b; return 1; } return 0; }
using namespace std;

// Union-Find; 素集合データ構造
class UnionFind {
public:
    vector<long long> parent;
    long long n;
    UnionFind(long long x) :parent(x, -1), n(x){}
    bool unite(long long x, long long y){
        x = find(x); y = find(y);
        if (x == y) return false;
        if (size(x) < size(y)) swap(x, y);
        parent[x] += parent[y]; parent[y] = x;
        return true; }
    bool same(long long x, long long y){ return find(x) == find(y); }
    long long find(long long x){ return parent[x] < 0 ? x : parent[x] = find(parent[x]); }
    long long size(long long x){ return -parent[find(x)]; }
};

int main(){
    Init();
    ll n, m; cin >> n >> m;
    UnionFind uf(n);

    rep(i, m){
        ll x, y, z; cin >> x >> y >> z;
        x--; y--; z %= 2;
        uf.unite(x, y);
    }

    set<ll> st;
    rep(i, n) st.insert(uf.find(i));
    cout << st.size() << endl;
}

Measured memory_bytes: 8676
from bisect import bisect_left,bisect_right

N=int(input())
L=list(map(int,input().split()))

L.sort()

cnt=0

for a in range(N):
    for b in range(a+1,N):
        right=bisect_right(L,L[a]+L[b]-1)
        left=max(b+1,bisect_left(L,L[b]-L[a]+1))

        cnt+=max(0,right-left)

print(cnt)


Measured memory_bytes: 46428
#include <array>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <deque>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <ctime>
#include <iterator>
#include <bitset>
#include <numeric>
#include <list>
#include <iomanip>
#include <tuple>
using namespace std;


typedef long long LL;
typedef pair<int,int> pii;
typedef pair<LL,LL> pll;

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
	v.assign(a, vector<T>(b, t));
}

template <class F, class T>
void convert(const F &f, T &t){
	stringstream ss;
	ss << f;
	ss >> t;
}

template <class T>
T clampMax(const T& a, const T& b) { return min(a, b); }

template <class T>
T clampMin(const T& a, const T& b) { return max(a, b); }

template <class T>
bool updateMax(T& a, const T& b) { if (a < b) { a = b; return true; } return false; }

template <class T>
bool updateMin(T& a, const T& b) { if (a > b) { a = b; return true; } return false; }

#define REP(i,n) for(int i=0;i<int(n);++i)
#define ALL(v) (v).begin(),(v).end()
#define RALL(v) (v).rbegin(),(v).rend()
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define PB push


#define MOD 1000000007LL
#define EPS 1e-10

char f(char c)
{
    switch (c)
    {
    case 'A': return 'T';
    case 'C': return 'G';
    case 'G': return 'C';
    case 'T': return 'A';
    }
    return 'T';
}

int main()
{
    char b;
    cin >> b;
    cout << f(b) << endl;
    return 0;
}

Measured memory_bytes: 888
# E - Rotation Matching

n, m = map(int, input().split())

l, r = 1, n
for i in range(m):
    if 2 * (r - l) == n or 2 * (r - l + 1) == n:
        l += 1
    print(l, r)
    l, r = l + 1, r - 1


Measured memory_bytes: 9268
#include<stdio.h>
int main(void){
int a,b,c,d,n,p;
while(scanf("%d",&n)!=EOF){
p=0;
for(a=0;a<10;a++){
for(b=0;b<10;b++){
for(c=0;c<10;c++){
for(d=0;d<10;d++){
if(n==a+b+c+d)
p++;
}
}
}
}
printf("%d\n",p);
}
return 0;
}

Measured memory_bytes: 596
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<iostream>
#include<map>
#include<queue>
using namespace std;
#define ll long long
#define For(i,a,b) for(int i=(int)a;i<=(int)b;++i)
#define Fordown(i,a,b) for(int i=(int)a;i>=(int)b;--i)
#define re read()
#define inf 2100000000
#define mem(a,b)memset(a,b,sizeof(a))
const int N=10000+10;
inline int read()
{
    int flag=1,ans=0;
    char ch=getchar();
    while(!isdigit(ch)&&ch!='-')ch=getchar();
    if(ch=='-'){flag=-1;ch=getchar();}
    while(isdigit(ch)){ans=(ans<<3)+(ans<<1)+(ch-'0');ch=getchar();}
    return ans*flag;
}
int a[N];
int n,m,k;
int mp[N][N];
int dx[4]={0,0,-1,1},dy[4]={1,-1,0,0};
int flag;
void init()
{
	n=re;m=re;
	k=re;
	For(i,1,k)a[i]=re;
}
void dfs(int x,int y,int color,int dep)
{
	mp[x][y]=color;
	int t1,t2;
	For(i,0,3)
	{
		t1=x+dx[i];t2=y+dy[i];
		if(t1>=1&&t2>=1&&t1<=n&&t2<=m&&!mp[t1][t2])
		{
			if(dep==a[color])dfs(t1,t2,color+1,1);
			else dfs(t1,t2,color,dep+1);
//			if(flag)return;
		}
	}
}
void work()
{
	int c=0;
	dfs(1,1,1,1);
	For(i,1,n)
	{
		For(j,1,m)printf("%d ",mp[i][j]);
		printf("\n");
	}
}
int main()
{
	init();
	work();
	return 0;
}


Measured memory_bytes: 3328
#include <iostream>
using namespace std;
int main(){
  int s,t;
  cin>>s>>t;
  if(s>t){
    for(int i=0;i<s;i++){
      cout<<t;
    }
  }
   else{
     for(int i=0;i<t;i++){
       cout<<s;
     }
   }
   return 0;
  }

Measured memory_bytes: 256
#include <bits/stdc++.h>
// #include <atcoder/all>
#define FOR(i, a, n) for(int (i) = (int)(a); (i) < (int)(n); ++(i))
#define FORe(i, a, n) for(int (i) = (int)(a); (i) <= (int)(n); ++(i))
#define rFOR(i, a, n) for(int (i) = (int)(n)-1; (i) >= (int)(a); --(i))
#define rFORe(i, a, n) for(int (i) = (int)(n); (i) >= (int)(a); --(i))
#define REP(i, n) FOR((i), 0, (n))
#define REPe(i, n) FORe((i), 1, (n))
#define REPo(i, n) FORe((i), 0, (n))
#define rREP(i, n) rFOR((i), 0, (n))
#define rREPe(i, n) rFORe((i), 1, (n))
#define rREPo(i, n) rFORe((i), 0, (n))
#define rep(i, n) FOR((i), 0, (n))
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define fi first
#define se second
#define dup(x, y) (((x)+(y)-1)/(y))
#define vc(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
// using namespace atcoder;
using ll = long long;
using ull = unsigned long long;
using P = pair<int,int>;
using pll = pair<ll,ll>;
using T = tuple<int,int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vs = vector<string>;
using vp = vector<P>;
using vt = vector<T>;

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

// auto mod int
const int mod = 1000000007;
// const int mod = 998244353;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

int main() {
  ll n;
  cin>>n;
  mint ans = 1;
  mint t9 = 1;
  mint t8 = 1;
  REP(i, n) {
    ans *= 10;
    t9 *= 9;
    t8 *= 8;
  }
  t9 *= 2;
  ans -= t9;
  ans += t8;
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3648
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x)  cerr << #x << " = " << (x) << endl;
using namespace std;

template <typename X, typename T>
auto vectors(X x, T a) {
	return vector<T>(x, a);
}

template <typename X, typename Y, typename Z, typename... Zs>
auto vectors(X x, Y y, Z z, Zs... zs) {
	auto cont = vectors(y, z, zs...);
	return vector<decltype(cont)>(x, cont);
}

template<typename T>
ostream& operator << (ostream& os, vector<T>& v){
	rep(i,v.size()){ os << v[i] << (i == v.size() - 1 ? "" : " "); } return os;
}
template<typename T>
istream& operator >> (istream& is, vector<T>& v){
	for(T& x: v){ is >> x; } return is;
}

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

	if(s.size() == 3) reverse(all(s));
	cout << s << endl;
}


Measured memory_bytes: 256
N, M = map(int, input().split())

# a = [int(input()) for _ in range(M)]
a = set([int(input()) for _ in range(M)])

dp = [0] * (N + 1)
dp[0] = 1

if 1 in a:
    dp[1] = 0
else:
    dp[1] = 1

for i in range(2, N + 1):
    if i in a:
        continue
    else:
        dp[i] = dp[i - 1] + dp[i - 2]
        dp[i] %= 1000000007

print(dp[-1])




Measured memory_bytes: 13216
A = int(input())
B = int(input())
C = int(input())
X = int(input())
count = 0
for i in range (A+1):
	for j in range (B+1):
		tmp = i*500 + j*100
		#print(tmp)
		k = (X-tmp) / 50
		if k>=0 and k <= C:
			count +=1
print(count)

Measured memory_bytes: 3060
#include <iostream>
#include <cstdio>
#include <queue>
#include <cstring>
#include <vector>
#include <map>
#include <algorithm>
#include <cctype>
#include <cmath>
using namespace std;

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

int dx4[4]={1,0,-1,0};
int dy4[4]={0,-1,0,1};
int dx8[8]={1,0,-1,1,-1,1,0,-1};
int dy8[8]={1,1,1,0,0,-1,-1,-1};

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

const int INF = 1e9;
const int MAX_V = 1e6+1;
const ll mod = 1000000007;

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

int n, m;
P m_p[1000000];

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

  cin >> n >> m;
  rep(i, m) {
    int a, b;
    cin >> a >> b;
    m_p[i] = make_pair(b, a);
  }
  sort(m_p, m_p + m);

  int ans = 0, last = 0;
  rep(i, m) {
    int a = m_p[i].second;
    int b = m_p[i].first;

    if(last < a) {
      last = b - 1;
      ans++;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>

using namespace std;

int main(int argc, char const *argv[]) {
	int N,temp;
	std::cin >> N;
	int f = 0;
	int keta = log10(N) + 1;
	temp = N;
	for (size_t i = 0; i < keta; i++) {
		f = f + temp % 10;
		temp /= 10;
	}
	if (N % f == 0) {
		std::cout << "Yes" << '\n';
	}
	else {
		std::cout << "No" << '\n';
	}
	return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int cnt[5];
int main() {
	int n; cin>>n;
	for(int i=1;i<=n;i++) {
		string s; cin>>s;
		if(s=="AC") cnt[1]++;
		else if(s=="WA") cnt[2]++;
		else if(s=="TLE") cnt[3]++;
		else if(s=="RE") cnt[4]++;
	}
	printf("AC x %d\nWA x %d\nTLE x %d\nRE x %d",cnt[1],cnt[2],cnt[3],cnt[4]);
	return 0;
}

Measured memory_bytes: 3700
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,n-1,0)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;
const ld eps = 1e-10;

struct edge {
  int to;
  ll cost;
  edge(int t, ll c): to(t), cost(c) {};
};

using P = pair<ll, int>;

vector<ll> d;
vector<int> par;
void dijkstra(int s, int N, vector<vector<edge>>& G) {
  priority_queue<P, vector<P>, greater<P>> que;
  d = vector<ll>(N, longinf);
  par = vector<int>(N, -1);
  d[s] = 0;
  que.push(P(0, s));

  while(!que.empty()) {
    P p = que.top();
    que.pop();
    int v = p.second;
    if(d[v] < p.first) continue;

    for(int i=0; i<(int)G[v].size(); i++) {
      edge e = G[v][i];
      if(d[e.to] > d[v] + e.cost) {
        d[e.to] = d[v] + e.cost;
        que.push(P(d[e.to], e.to));
        par[e.to] = v;
      }
    }
  }
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, m; cin >> n >> m;
  vector<int> L(m), R(m);
  vector<ll> C(m);
  vector<ll> P;
  P.push_back(0);
  P.push_back(n-1);
  rep(i, m) {
    cin >> L[i] >> R[i] >> C[i];
    L[i]--; R[i]--;
    P.push_back(L[i]);
    P.push_back(R[i]);
  }
  sort(all(P));
  P.erase(unique(all(P)), end(P));
  vector<int> Li(m), Ri(m);
  int k = P.size();
  vector<vector<edge>> G(k);
  rep(i, m) {
    Li[i] = lower_bound(all(P), L[i]) - begin(P);
    Ri[i] = lower_bound(all(P), R[i]) - begin(P);
    G[Li[i]].push_back({Ri[i], C[i]});
  }
  rep(i, k-1) G[i+1].push_back({i, 0});
  dijkstra(0, k, G);
  cout << (d[k-1]==longinf ? -1 : d[k-1]) << "\n";
  return 0;
}


Measured memory_bytes: 16040
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
int main(){
  int h,w,d,a,q;
  cin>>h>>w>>d;
  map<int,P> m;
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      cin>>a;
      m[a]=P(i,j);
    }
  }
  vector<int> b[d];
  for(int i=0;i<d;i++) b[i].push_back(0);
  for(int i=1;i<=h*w-d;i++){
    b[i%d].push_back(abs(m[i].first-m[i+d].first)+abs(m[i].second-m[i+d].second)+b[i%d][(i-1)/d]);
  }
  cin>>q;
  for(int i=0;i<q;i++){
    cin>>h>>w;
    cout<<b[w%d][(w-1)/d]-b[h%d][(h-1)/d]<<endl;
  }
}

Measured memory_bytes: 11008
#include <bits/stdc++.h>
using namespace std;
int a[105],b[105];
int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n;
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>a[i]>>b[i];
	}
	bool key=false;
	for(int i=0;i<n-2;i++)
	{
		if(a[i]==b[i]&&a[i+1]==b[i+1]&&a[i+2]==b[i+2])
		{
			key=true;
		}
	}
	if(key)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 3644
process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', function(chunk) {
  var input = chunk.trim();
  var hour = Math.floor(input / (60 * 60));
  var minute = Math.floor(input / 60) % 60;
  var second = input % 60
  console.log(hour + ':' + minute + ':' + second);
});

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

typedef long long ll;
typedef pair<int, int> P;
typedef pair<int, P> P1;
typedef pair<P, P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define fi first
#define sc second
#define rep(i, x) for (long long i = 0; i < x; i++)
#define repn(i, x) for (long long i = 1; i <= x; i++)
#define SORT(x) sort(x.begin(), x.end())
#define ERASE(x) x.erase(unique(x.begin(), x.end()), x.end())
#define POSL(x, v) (lower_bound(x.begin(), x.end(), v) - x.begin())
#define POSU(x, v) (upper_bound(x.begin(), x.end(), v) - x.begin())
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; --i)
#define rrepn(i, n) for (int i = ((int)(n)); i > 0; --i)
#define SZ(x) ((int)(x).size())
template <class T> bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> bool chmin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}
vector<pair<string, P> > vec;
// vector<vector<int>> data(3, vector<int>(4));

void solve(long long N, std::vector<long long> A) {
    vector<bool> mem(1000001);
    SORT(A);
    rep(i, N - 1) {
        if (A[i] == A[i + 1] && !mem[A[i]]) {
            for (int j = A[i]; j < 1000001;) {
                mem[j] = true;
                j = j + A[i];
            }
        }
    }
    ll res = 0;
    rep(i, N) {
        if (!mem[A[i]]) {
            res++;
            // cout << A[i] << endl;
            for (int j = A[i]; j < 1000001;) {
                mem[j] = true;
                j = j + A[i];
            }
        }
    }
    cout << res << endl;
}

int main() {
    long long N;
    scanf("%lld", &N);
    std::vector<long long> A(N);
    for (int i = 0; i < N; i++) {
        scanf("%lld", &A[i]);
    }
    solve(N, std::move(A));
    return 0;
}


Measured memory_bytes: 4836
#include<bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define pii pair<int,int> 
#define int long long 
#define N 200005

int h[N],mx[N];


int32_t main(){
    int n;
    cin>>n;

    int a[n+1];
    for(int i=1;i<=n;i++) cin>>a[i];

    map<int,int> mp;

    int cnt=0;
    for(int i=1;i<=n;i++){
        int freq=mp[a[i]-i];
        cnt+=freq;
        mp[-(i+a[i])]++;
    }
    cout<<cnt<<endl;




    
}

Measured memory_bytes: 27792
N, K = 5, 3
ARR = [96, 98, 95, 100, 20]


N, K = 3, 2
ARR = [1001, 869120, 1001]

N ,K = 15, 7
ARR = [3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5, 8, 9, 7, 9]

N, K = map(int,input().split())
ARR = list(map(int,input().split()))


def calculate(n, k, arr):
    for i in range(k, n):
        s = arr[i] / arr[i-k]
        if s > 1:
            print("Yes")
        else:
            print("No")

calculate(N, K, ARR)


Measured memory_bytes: 31256
#include<bits/stdc++.h>
using namespace std;
int main(){
long long a, b, x, ans=0, ans2=0, ans3=0;
  cin >> a >> b >> x;
  ans=b/x;
  ans2=a/x;
  if(a%x==0) ans++;
  ans3=ans-ans2;
  cout << ans3 <<endl;
  return 0;
}
  


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){

int N;
string S;
  
cin >> N;
cin >> S;

vector<string> Arufa = {"A", "B", "C", "D","E","F","G","H","I","J","K","L","M","N",
                       "O","P","Q","R","S","T","U","V","W","X","Y","Z"};

for(int j = 0; j < S.size(); j++)
{    
	for(int i = 0; i < Arufa.size(); i++)
	{
    	if(S.substr(j,1) == Arufa.at(i))
    	{
      	cout << Arufa.at((i + N) % Arufa.size());
    	}
	}
}
  
return 0;
}

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


int32_t main() {
	ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int n, a, b, p; cin >> n >> a >> b; long long ans = 0;
	for(int i = 1; i <= n; i++) {
		int x; cin >> x;
		if(i > 1) {
			ans += min(b * 1LL, 1LL * (x - p) * a);
		}
		p = x;
	}

	cout << ans << endl;
}

Measured memory_bytes: 3596
// author : Kartikey Tewari
// date: 2020-02-22   17:46:54
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define endl '\n'
#define pii pair<ll,ll>
using namespace std;

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

    ll n,r;
    cin >> n >> r;
    if (n>=10)
    {
        cout << r << endl;
    }   
    else
    {
        ll a=100*(10-n);
        cout << a+r << endl;
    }
    
    return 0;
}

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

using namespace std;
 
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

#define pb push_back;
#define mp make_pair;
#define fi first;
#define se second;

typedef vector<int> vi;
typedef long long ll;
typedef pair<int, int> pii;
typedef long double ld;

const int INF = 1 << 29;
const int MOD = 1e9 + 7;
 
int main() {
  string s;
  cin >> s;
  if(s == "Sunny") puts("Cloudy");
  if(s == "Cloudy") puts("Rainy");
  if(s == "Rainy") puts("Sunny");
  return 0;
}

Measured memory_bytes: 256
#ifndef ___Class_NonRecursiveRMQ
#define ___Class_NonRecursiveRMQ

// ------ Includes ------ //
#include <limits>
#include <vector>
#include <algorithm>

// ------ RMQ Class ------ //
template<typename Type>
class RMQ {
private:
	int size_; std::vector<Type> dat;
public:
	RMQ() : size_(0), dat(std::vector<Type>()) {};
	RMQ(int size__) {
		for (size_ = 1; size_ < size__; ) size_ <<= 1;
		dat.resize(size_ << 1, std::numeric_limits<Type>::max());
	}
	template<class T>
	RMQ(T begin_, T end_) {
		int n = end_ - begin_;
		for (size_ = 1; size_ < n; size_ <<= 1); dat.resize(size_ << 1, std::numeric_limits<Type>::max());
		for (int i = 0; i < n; i++) dat[i + size_] = *(begin_ + i);
		for (int i = size_ - 1; i > 0; i--) dat[i] = std::min(dat[i << 1], dat[(i << 1) + 1]);
	}
	inline unsigned size() { return size_; }
	inline void update(unsigned i, Type x) {
		i += size_; dat[i] = x;
		while (i > 1) {
			i >>= 1;
			dat[i] = std::min(dat[i << 1], dat[i << 1 | 1]);
		}
	}
	inline Type query(unsigned l, unsigned r) {
		Type ret = std::numeric_limits<Type>::max();
		l += size_; r += size_;
		while (l != r) {
			if (l & 1) ret = std::min(ret, dat[l++]); l >>= 1;
			if (r & 1) ret = std::min(ret, dat[--r]); r >>= 1;
		}
		return ret;
	}
};

#endif

int N, Q, c, x, y;
int main() {
	scanf("%d%d", &N, &Q);
	RMQ<int> seg(N);
	while(Q--) {
		scanf("%d%d%d", &c, &x, &y);
		if(c == 0) seg.update(x, y);
		else printf("%d\n", seg.query(x, y + 1));
	}
}

Measured memory_bytes: 3432
#[allow(unused_macros)]
macro_rules! input_byline {
    ($($r:tt)* ) => {
        let stdin = std::io::stdin();
        let mut q = std::collections::VecDeque::new();
        let mut next = || {
            if q.is_empty() {
                let mut s = String::new();
                stdin.read_line(&mut s);
                for v in s.split_whitespace() {
                    q.push_back(v.to_string());
                }
            }
            q.pop_front().unwrap()
        };
        input_inner!{next, $($r)*}
    };

}

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

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

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

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

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

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

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

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

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

trait Printable {
    fn p(&self);
}

impl<T: std::fmt::Display> Printable for T {
    fn p(&self) {
        println!("{}", self);
    }
}

impl<T: std::fmt::Display> Printable for [T] {
    fn p(&self) {
        for i in 0..self.len() {
            if i != 0 {
                print!(" ");
            }
            print!("{}", self[i]);
        }
        println!("");
    }
}

#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::{BinaryHeap, HashMap};

#[allow(dead_code)]
type Graph = Vec<Vec<usize>>;

fn main() {
    input! {
        n: usize,
        a: usize,
        b: usize,
    }
    if (b - a - 1) & 1 == 1 {
        println!("Alice");
    } else {
        println!("Borys");
    }
}


Measured memory_bytes: 4352
#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <cmath>
#include <queue>
#include <stack>
#include <list>
#include <functional>
#include <numeric>
#include <iostream>
#include <string>
#include <time.h>

using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (n); ++i)

int color[112345];
bool f[112345];
int N;

int main() {

	scanf("%d", &N);
	vector<vector<pair<int,int>>> edges(N);
	rep(i, N-1) {
		int u, v, w;
		scanf("%d%d%d", &u, &v, &w);
		--u;
		--v;
		edges[u].push_back({ v, w });
		edges[v].push_back({ u, w });
	}
	queue<int> q;
	q.push(0);

	while (!q.empty()) {
		int vet = q.front();
		q.pop();
		for (auto e : edges[vet]) {
			if (e.second % 2) {
				color[e.first] = !color[vet];
				if (!f[e.first]) {
					q.push(e.first);
					f[e.first] = true;
				}
			}
			else {
				color[e.first] = color[vet];
				if (!f[e.first]) {
					q.push(e.first);
					f[e.first] = true;
				}
			}
		}
	}

	rep(i, N) printf("%d\n", color[i]);

	return 0;
}


Measured memory_bytes: 6912