akhauriyash/Code-Regression huggingface dataset:
import math

tmp = input().split()
X = int(tmp[0])
Xn_1 = 100
Year = 0

while True:
    Xn = Xn_1*1.01
    Year = Year + 1
    if Xn >= X:
        print(Year)
        break
    Xn_1 = math.floor(Xn)

Measured memory_bytes: 9176
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace AtCoder.ABC090.D
{
    class Program
    {
        static void Main ()
        {
            var cin = new Scanner ();
            var N = cin.nextLong ();
            var K = cin.nextLong ();
            var result = 0L;

            if (K == 0) result = N * N;
            else
            {
                for (long b = K + 1; b <= N; b++)
                {
                    long p = N / b;
                    long r = N % b;
                    result += p * (b - K) + Math.Max (0, r - K + 1);
                }
            }
            Console.WriteLine (result);
        }
    }

    class Scanner
    {
        string[] s;
        int i;

        char[] cs = new char[] { ' ' };

        public Scanner ()
        {
            s = new string[0];
            i = 0;
        }

        public string next ()
        {
            if (i < s.Length) return s[i++];
            string st = Console.ReadLine ();
            while (st == "") st = Console.ReadLine ();
            s = st.Split (cs, StringSplitOptions.RemoveEmptyEntries);
            if (s.Length == 0) return next ();
            i = 0;
            return s[i++];
        }

        public int nextInt ()
        {
            return int.Parse (next ());
        }
        public int[] ArrayInt (int N, int add = 0)
        {
            int[] Array = new int[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextInt () + add;
            }
            return Array;
        }

        public long nextLong ()
        {
            return long.Parse (next ());
        }

        public long[] ArrayLong (int N, long add = 0)
        {
            long[] Array = new long[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextLong () + add;
            }
            return Array;
        }

        public double nextDouble ()
        {
            return double.Parse (next ());
        }

        public double[] ArrayDouble (int N, double add = 0)
        {
            double[] Array = new double[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextDouble () + add;
            }
            return Array;
        }

        public decimal nextDecimal ()
        {
            return decimal.Parse (next ());
        }

        public decimal[] ArrayDecimal (int N, decimal add = 0)
        {
            decimal[] Array = new decimal[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextDecimal ();
            }
            return Array;
        }
    }
}

Measured memory_bytes: 13140
#include <iostream>
#include <algorithm>

using namespace std;

long N;

int main() {
  cin >> N;

  long ans = N;
  for (long i = 1; i * i <= N; i++) {
    if (N % i == 0 && i + N / i - 2 < ans) {
      ans = i + N / i - 2;
    }
  }

  printf("%ld\n", ans);
}

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

#define lld long long
#define pi pair<int,int>
#define pl pair<lld,lld>
#define mem0(x) memset(x,0,sizeof(x))
#define fillnum(x,n) fill(begin(x),end(x),n)
#define asort(x) sort(x.begin(),x.end())
#define dsort(x,t) sort(x.begin(),x.end(),greater<t>())

int n;

void solved(int idx, double x1, double y1, double x2, double y2){
    if(idx == n){
        return;
    }
    double x3 = (2*x1+1*x2)/3;
    double y3 = (2*y1+1*y2)/3;
    double x4 = (1*x1+2*x2)/3;
    double y4 = (1*y1+2*y2)/3;
    double x5 = (x4-x3)*cos(M_PI/3)-(y4-y3)*sin(M_PI/3)+x3;
    double y5 = (x4-x3)*sin(M_PI/3)+(y4-y3)*cos(M_PI/3)+y3;
    solved(idx+1,x1,y1,x3,y3);
    printf("%.8f %.8f\n",x3,y3);
    solved(idx+1,x3,y3,x5,y5);
    printf("%.8f %.8f\n",x5,y5);
    solved(idx+1,x5,y5,x4,y4);
    printf("%.8f %.8f\n",x4,y4);
    solved(idx+1,x4,y4,x2,y2);
}

int main() {
    cin >> n;
    printf("%.8f %.8f\n",0.0,0.0);
    solved(0,0.0,0.0,100.0,0.0);
    printf("%.8f %.8f\n",100.0,0.0);
}


Measured memory_bytes: 3208
#include <iostream>
#include <queue>

using namespace std;

int main()
{
  int n;
  int s;
  int x = 1;
  queue<int> qu;

  cin >> n;

  while (n--){
    cout << "Case " << x++ << ":" << endl;
    cin >> s;
    for (int i = 0; i < 10; i++){
      s = s * s;
      int t = 10000000;
      for (int cnt = 0; cnt < 8; cnt++){
        qu.push(s / t);
        s %= t;
        t /= 10;
      }
      s = 0;
      t = 1000;
      for (int cnt = 0; cnt < 8; cnt++){
        if (cnt >= 2 && cnt <= 5){
          s += qu.front() * t;
          t /= 10;
        }
        qu.pop();
      }
      cout << s << endl;
    }
  }

  return (0);
}

Measured memory_bytes: 1216
import java.util.*;
import java.math.*;

public class Main {

  // // 最大公約数
  // public static long gcd (long m,long n) {
  //   if (m < n) return gcd(n,m);
  //   if (n == 0) return m;
  //   return gcd(n,m%n);
  // }
  //
  // // 最小公倍数
  // public static long lcm (long m,long n) {
  //   return m*n/gcd(m,n);
  // }
  //
  // // 素数判定
  // public static boolean isPrime (long n) {
  //   if (n == 2) return true;
  //   if (n < 2 || n%2 == 0) return false;
  //   double d = Math.sqrt(n);
  //   for (int i = 3; i <= d; i+=2) {
  //     if (n%i == 0) {
  //       return false;
  //     }
  //   }
  //   return true;
  // }

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    long sum = 0;

    for (int i = 1; i <= n; i++) {
      if (i % 15 == 0) {

      } else if (i % 3 == 0 || i % 5 == 0) {

      } else {
        sum += i;
      }
    }

    System.out.println(sum);

  }

}


Measured memory_bytes: 35768
N,K=map(int,input().split())
p = sorted([[int(_) for _ in input().split()] for i in range(N)])
a=10**20
for xi in range(N-K+1):
  for xj in range(xi+K-1,N):
    q = sorted(y for x,y in p[xi:xj+1])
    for yi,yj in zip(q,q[K-1:]):
      if yi<=p[xi][1] and p[xj][1]<=yj:
        a = min(a, (p[xi][0]-p[xj][0])*(yi-yj))
print(a)


Measured memory_bytes: 3316
import java.util.*;

public class Main{

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String a = sc.next();
		String b = sc.next();
		
		if(a.equals("H") && b.equals("H")) System.out.println("H");
		if(a.equals("H") && b.equals("D")) System.out.println("D");
		if(a.equals("D") && b.equals("H")) System.out.println("D");
		if(a.equals("D") && b.equals("D")) System.out.println("H");
	}
}

Measured memory_bytes: 23252
#![allow(non_snake_case, unused_imports)]

// Input
macro_rules! input { (source = $s:expr, $($r:tt)*) => { let mut iter = $s.split_whitespace(); let mut next = || { iter.next().unwrap() }; input_inner!{next, $($r)*} }; ($($r:tt)*) => { let stdin = std::io::stdin(); let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock())); let mut next = move || -> String{ bytes.by_ref().map(|r|r.unwrap() as char).skip_while(|c|c.is_whitespace()).take_while(|c|!c.is_whitespace()).collect() }; input_inner!{next, $($r)*} }; }
macro_rules! input_inner { ($next:expr) => {}; ($next:expr, ) => {}; ($next:expr, $var:ident : $t:tt $($r:tt)*) => { let $var = read_value!($next, $t); input_inner!{$next $($r)*} }; ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => { let mut $var = read_value!($next, $t); input_inner!{$next $($r)*} }; }
macro_rules! read_value { ($next:expr, ( $($t:tt),* )) => { ( $(read_value!($next, $t)),* ) }; ($next:expr, [ $t:tt ; $len:expr ]) => { (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>() }; ($next:expr, [ $t:tt ]) => { { let len = read_value!($next, usize); (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") }; }

// Module
use std::cmp::{min,max};
use std::collections::{HashSet,HashMap,BTreeMap,VecDeque};

// Functions

// Main
fn main(){
    input!{
        N: usize,
        M: usize,
        mut X: [i64; M],
    }
    X.sort();
    let mut dd = vec![];
    for i in 1..M{
        dd.push(X[i]-X[i-1]);
    }
    dd.sort();
    let ans = if N>=M {
        0
    }else{
        dd[0..(M-N)].iter().sum::<i64>()
    };
    println!("{:?}", ans);
}

Measured memory_bytes: 6396
def solve():
    N, Y = map(int, input().split())
    for i in range(N+1):
        for j in range(N+1):
            if i+j>N:
                break
            if 10000*i+5000*j+1000*(N-i-j)==Y:
                return [i,j,N-i-j]
    return [-1,-1,-1]
print(*solve())

Measured memory_bytes: 64392
#include <bits/stdc++.h>
using namespace std;
#define int       long long
#define w(x)      int x;cin >> x;while (x--)
#define rep(d,a,n)  for(int d=a;d<=n;d++)
#define rep_(d,a,n)  for(int d=a;d<=n;d--)
#define nl        "\n" 
#define fast_io ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define oj  freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
const int inf=1e18;
int gcd(int a,int b,int temp){
    if(temp==1){
        return 1;
    }else if(a%temp==0 && b%temp==0){
        return temp;
    }
    temp-=max(a%temp,b%temp);
    return gcd(a,b,temp);
}

int fun(){
    int n,k;
    cin>>n>>k;
    int *p=new int[n];
    rep(i,0,n-1){
        cin>>p[i];
    }
    sort(p,p+n);
    int ans=0;
    int i=0;
    while(k--){
        ans+=p[i];
        i++;
    }
    return ans;
}
int32_t main()
{
  
    fast_io;
    cout<<fun();
    return 0;
}

Measured memory_bytes: 3604
i = 0
while i < 10**5:
    i = i + 1
    a, op, b = input().split()
    a = int(a); b = int(b); op = str(op)
    
    if op == '?':
        break
    
    if op == '+':
        x = a+b
    elif op == '-':
        x = a-b
    elif op == '*':
        x = a*b
    else:
        x = int(a/b)
    print(x)


Measured memory_bytes: 5596
import sys, re

S = sys.stdin.readline().rstrip()

if S == 'keyence' or re.fullmatch(r'[a-z]+keyence', S) or re.fullmatch(r'k[a-z]+eyence', S) or re.fullmatch(r'ke[a-z]+yence', S) or re.fullmatch(r'key[a-z]+ence', S) or re.fullmatch(r'keye[a-z]+nce', S) or re.fullmatch(r'keyen[a-z]+ce', S) or re.fullmatch(r'keyenc[a-z]+e', S) or re.fullmatch(r'keyence[a-z]+', S):
  print('YES')
else:
  print('NO')

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

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

  cout << s.substr(0,3) << endl;

  return 0;
}

/*
*/


Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a, b;
  cin >> a >> b;
 
  if (a % 2 == 1 && b % 2 == 1) { 
    cout << "Odd" << endl;
  }
  else {
    cout << "Even" << endl;
  }
}

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

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

  int ans = 0;

  for (int i = 0; i <= n - 3; i++) {
    if (s.substr(i, 3) == "ABC") ans++;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10 ** 9)

N,M,K = map(int,input().split())
AB = [list(map(int,input().split())) for _ in range(M)]
CD = [list(map(int,input().split())) for _ in range(K)]

V = [[] for _ in range(N)]
for a,b in AB:
  a -= 1
  b -= 1
  V[a].append(b)
  V[b].append(a)
# print(V)

L = [0 for _ in range(N)]
def dfs(u,l):
  L[u] = l
  for t in V[u]:
    if L[t] == 0:
      dfs(t,l)

l = 1
for i in range(N):
  if L[i] == 0:
    dfs(i,l)
    l += 1
#print(L)
C = {}
for ll in L:
  if ll in C:
    C[ll] += 1
  else:
    C[ll] = 1
#print(C)
ans = [C[L[i]]-1 for i in range(N)]
for a,b in AB:
  a -= 1
  b -= 1
  ans[a] -= 1
  ans[b] -= 1
for c,d in CD:
  c -= 1
  d -= 1
  if L[c] == L[d]:
    ans[c] -= 1
    ans[d] -= 1
print(*ans)

Measured memory_bytes: 376580
#include <bits/stdc++.h>
#define l_ength size
const int inf = (1<<30);
const int mod = 1000000007; // 998244353
using ll = long long;
using namespace std;

int main(){
	bool ans[3] = {true, true, true};
	int a, b; cin >> a >> b;
	--a; --b;
	ans[a] = ans[b] = false;
	for( int i = 0; i < 3; ++i ){
		if( ans[i] ) cout << i+1 << endl;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize("O3")

#define fi first
#define se second
#define em emplace
#define eb emplace_back
#define mp make_pair
#define pi pair<int,int>
#define vi vector<int>
#define vpi vector<pair<int,int>>
#define vll vector<ll>
#define vpll vector<pair<ll,ll>>
#define endl '\n'

#define si(v) int((v).size())
#define all(v) (v).begin(), (v).end()
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i) 
#define rep2(i, n, m) for (ll i = n; i <= (ll)(m); ++i)
#define rep3(i, n, m) for (ll i = n; i >= (ll)(m); --i)

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

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

constexpr ll MOD = 1000000007;

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

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

  rep(i, n) cin >> a[i];
  bool ok = true;

  if (a[0] != 0) ok = false;
  rep(i, n-1) if (a[i+1] - a[i] > 1) ok = false;

  if (!ok) {
    cout << -1 << endl;
    return (0);
  }

  ll ans = 0;
  rep(i, n-1) {
    if (a[i+1] - a[i] == 1) ans -= a[i];
    ans += a[i];
  }

  ans += a[n-1];
  cout << ans << endl;

  return (0);
}


Measured memory_bytes: 3992
#!/usr/bin/env python3
import sys

YES = "Yes"  # type: str
NO = "No"  # type: str


def solve(S: str):
    N = len(S)
    a = S[0:int((N-1)/2)]
    b = S[int((N+3)/2)-1:N]
    if a == b[::-1]:
        Na = len(a)
        if Na % 2 == 0:
            aa = a[0:int(Na/2)]
            ab = a[int(Na/2):Na]
        else:
            aa = a[0:int((Na - 1) / 2)]
            ab = a[int((Na + 3) / 2)-1:Na]
        Nb = len(b)
        if Nb % 2 == 0:
            ba = b[0:int(Nb/2)]
            bb = b[int(Nb/2):Nb]
        else:
            ba = b[0:int((Nb - 1) / 2)]
            bb = b[int((Nb + 3) / 2)-1: Nb]
        if aa == ab[::-1] and ba == bb[::-1]:
            print(YES)
        else:
            print(NO)
        return
    print(NO)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  # type: str
    solve(S)


if __name__ == '__main__':
    main()


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

namespace abc_058_B
{
    class Program
    {
        static void Main(string[] args)
        {
            string a = Console.ReadLine();
            string s = Console.ReadLine();
            for (int i = 0; i < a.Length + s.Length; i++)
            {
                if (i % 2 == 0) { Console.Write(a[i/2]); }
                else { Console.Write(s[(i-1)/2]); }
            }Console.WriteLine();
            Console.ReadLine();
        }
    }
}


Measured memory_bytes: 11092
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <string>
#include <cstdio>
#include <cstring>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <bitset>

typedef long long ll;
typedef unsigned long long ull;
using namespace std;

#define FALSE printf("false\n");
#define TRUE printf("true\n");
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i = 0;i < ((int)(n));++i)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define test(a) cout<<"line:"<<__LINE__<<"["<<(#a)<<": "<<(a)<<"]"<<endl

const int INF = 1e9+7;
const ll INFL = 9*1e18;
const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };

#define SUM(vec) accumulate(all(vec),0LL) // 配列の中身を全部足す
template<typename T>void print(T&& x){cout<<x<<endl;}// 改行付き出力
ll inline digit(ll num){int tmp = 0;while(num){tmp++;num/=10;}return tmp;} // 桁数
template<typename T>inline T digitSum(T num){T sum = 0;while(num){sum+=num%10;num/=10;}return sum;} // 各桁の和
template<typename T>inline T gcd(T a,T b){if(b == 0)return a;return gcd(b,a%b);} // 最大公約数
template<typename T>inline T lcm(T a, T b){T g = gcd(a,b);return a/g*b;} // 最小公倍数
template<typename T>inline T power(T a,T b){T tmp=1;rep(i,b){tmp*=a;}return tmp;} // 累乗
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; }
int ctoi(char c){return c - '0';}


// TODO: write
int main() { 
  int h,a;cin>>h>>a;
  int ans = h/a + !!(h%a);
  print(ans);
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fo(i, n) for(int i=0; i<n; i++)
#define Fo(i, k, n) for(int i=k; i<n; i++)
#define MOD 1000000007
#define deb(n) cout<<"[ "#n<<" = "<<n<<" ]"<<endl;
#define FIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
const long long  MAX = 1 << 18;
int case_no = 1;
#define w(x) int x; cin>>x; while(x--)

int main() {
	FIO
	double n, x;
	int t;
	cin >> n >> x >> t;
	int ans = ceil(n / x);
	cout << t * ans << endl;
	return 0;
}

Measured memory_bytes: 3720
{-# LANGUAGE BangPatterns #-}
 
module Main
  ( main
  )
where
 
import           Control.Applicative
import           Control.Monad
import           Control.Monad.ST
import           Data.Bits
import qualified Data.ByteString.Char8         as BS
import           Data.Char
import           Data.List
import           Data.Maybe
import           Data.Ord
import qualified Data.Vector                   as V
import qualified Data.Vector.Mutable           as MV
import qualified Data.Vector.Unboxed           as UV

parse = fst . fromJust
parseInt = parse . BS.readInt
parseInteger = parse . BS.readInteger
readInt = parseInt <$> BS.getLine
readInteger = parseInteger <$> BS.getLine
readIntList = map parseInt . BS.words <$> BS.getLine
readIntegerList = map parseInteger . BS.words <$> BS.getLine


main = do
  [a, b, x] <- readIntegerList
  print $ b `div` x - if a > 1 then (a - 1) `div` x else if a == 0 then -1 else 0


Measured memory_bytes: 380
import Data.List( sortBy, sort, group)
main = do
    getLine
    as_ <- return . map (read::String->Int) . words =<< getLine
    let
	gs = group . sort $ as_
	counts = map length gs
	countSorted = sortBy (flip compare) counts
	proc []	v		= v
	proc [n] v
	  | even n		= v
	  | otherwise		= v+1
	proc (1:ns) v		= v + 1 + length ns
	proc (2:tl@(1:ns)) v	= proc tl v
	proc (2:2:ns) v		= let v' = v+2
				    in v' `seq` proc ns v'
	proc (2:n:ns) v		= let v' = v+1
				    in v' `seq` proc ((n-1):ns) v'
	proc (n:ns) v
	  | even n		= proc (2:ns) v
	  | otherwise		= let v' = v+1
				    in v' `seq` proc ns v'
    print $ proc countSorted 0

Measured memory_bytes: 31868
#include <stdio.h>
#define INF 10000000
#define N 100
int p[N],m[N+1][N+1];

void matrixChainOrder(int length)
{
  int i, j, k, l, n, q;
  n = length-1;
  for( i=1 ; i<=n ; i++ )
    m[i][i] = 0;
  for( l=2 ; l<=n ; l++ ){
    for( i=1 ; i<=n-l+1 ; i++ ){
      j = i + l -1;
      m[i][j] = INF;
      for( k=i ; k<=j-1 ; k++ ){
	q = m[i][k]+m[k+1][j]+p[i-1]*p[k]*p[j];
	if(m[i][j]>q) m[i][j] = q;
      }
    }
  }
}

int main()
{
  int n,i;
  int r[N+1], c[N+1];
  scanf("%d",&n);
  for( i=1 ; i<=n ; i++ )
    scanf("%d %d",&r[i],&c[i]);
  for( i=0 ; i<n ; i++ ){
    p[i] = r[i+1];
  }
  p[i] = c[n];

  matrixChainOrder(n+1);

  printf("%d\n",m[1][n]);
  
  return 0;
}

Measured memory_bytes: 636
#include <iostream>
    #include <math.h>
    #include <vector>
    #include <string>
    using namespace std;
    int main() {
        int a,b;
        cin >> a >> b;
        if(0 == (b%a)) cout << a+b<<endl;
        else cout << b-a<<endl;
        return 0;
    }

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

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;
using std::bitset;

#define rep(i,n)    for(int i=0; i<(int)n; i++)
#define reps(i,s,e) for(int i=s; i<(int)e; i++)
#define coutd(i) cout << std::fixed << std::setprecision(i)
typedef long double ld;
typedef long long ll;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef std::pair<int, int> pii;
typedef std::pair<ll, ll> pll;

template<class T>
using Set = std::set<T>;
template<class T, class U>
using Map = std::map<T, U>;

template<class T>
using Graph = vector<vector<T>>;

const int INT_BIG = 1<<28;

int main() {
    string S, T;
    cin >> S >> T;
    int len = S.length();
    int counter = 0;
    rep(i, len) {
        if (S[i] != T[i]) {
            counter++;
        }
    }
    cout << counter << endl;
}

Measured memory_bytes: 3916
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const ll MOD = 1e9 + 7;
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0); 
    int n;
    cin >> n;
    ll ans = 0, sum = 0;
    for(int i = 0; i < n; ++i) {
        ll x;
        cin >> x;
        ans = (ans + sum * x % MOD) % MOD;
        sum = (sum + x) % MOD;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3652
#include <iostream>
using namespace std;
using ull = unsigned long long;

int main(){
    ull N, K;
    cin >> N >> K;

    ull ans = K;
    
    for(int i = 1; i < N; ++i){
        ans *= K - 1;
    }

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


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

#define rep(i, n) for(int i = 0;i < n;i++)
#define repr(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)

int main(){
  int n;
  cin>>n;
  int x=n,s=0;
  while(x>0){
    s+=x%10;
    x=x/10;
  }
  cout<<(n%s? "No":"Yes")<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<queue>
using namespace std;
typedef pair<int, int> P;

int main(){
    int N,M;
    cin >> N >> M;
    
    priority_queue<P, vector<P>, greater<P> > que;
    for(int i=0;i<M;i++){
        int a,b;
        cin >> a >> b;
        P p = make_pair(b, a);
        que.push(p);
    }

    int ans = 0;
    int cur = 0;
    while(!que.empty()){
        if(cur > que.top().second){
            que.pop();
        }else{
            cur = que.top().first;
            ans++;
        }
    }

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

Measured memory_bytes: 1400
n = int(input())
s_arr = []
for i in range(n):
    s = sorted(input())
    s_arr.append(''.join(s))
s_arr.sort()

from collections import Counter
c = Counter(s_arr)
cnt = 0
for i in c:
    cnt += c[i]*(c[i]-1)//2
print(cnt)

Measured memory_bytes: 19720
#include <bits/stdc++.h>
using namespace std;
int main(){
  int w, h, x, y, r;
  cin >> w >> h >> x >> y >> r;
  if(0 <= x - r && x + r <= w &&0 <= y - r && y + r <= h) printf("Yes\n");
  else printf("No\n");
}


Measured memory_bytes: 3104
#include <iostream>      // cout, endl, cin
#include <string>        // string, to_string, stoi
#include <vector>        // vector
#include <algorithm>     // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility>       // pair, make_pair
#include <tuple>         // tuple, make_tuple
#include <cstdint>       // int64_t, int*_t
#include <cstdio>        // printf
#include <map>           // map
#include <queue>         // queue, priority_queue
#include <set>           // set
#include <stack>         // stack
#include <deque>         // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset>        // bitset
#include <cctype>        // isupper, islower, isdigit, toupper, tolower
#include <memory>        // unique_ptr, shared_ptr, weak_ptr

using namespace std;

int main() {
    int n;
    cin >> n;
    
    for (int i=1; i<=n; i++) {
        if (i%3 == 0) {
            cout << ' ' << i;
        } else {
            int I=i;
            while (I != 0) {
                if (I%10 == 3) {
                    cout << ' ' << i;
                    break;
                }
                I /= 10;
            }
        }
    }
    cout << endl;
    return 0;		 
}



Measured memory_bytes: 3096
#include <algorithm>
#include <iostream>
#include <cstdlib>
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <string>
#include <typeinfo>
#include <vector>
//#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<string> vs;
typedef vector<vector<bool>> vvb;
typedef vector<vector<int>> vvi;

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

int main()
{
  vi v(3);
  rep(i,3){
    cin >> v.at(i);
  }
  sort(all(v));
  cout << v.at(2) - v.at(0) << endl;
  return 0;
}


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

const int maxn = 100 + 5;
int a[maxn];
int n;

int main()
{
    cin >> n;
    for (int i = 0; i < n; i++) cin >> a[i];
    int ans = 0;
    for (int i = 1; i <= n; i++)
    {
        if ((i & 1) && (a[i - 1] & 1)) ++ans;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3608
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
const int mod = 1e9+7;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;
int main(){
    cout << fixed << setprecision(10);
    int n;
    cin >> n;
    vector<int> x(n),y(n),h(n);
    int id = -1;
    int ans1,ans2,ans3;
    rep(i,n){
        cin >> x[i] >> y[i] >> h[i];
        if(h[i] > 0) id = i;
    }
    rep(ix,101){
        int nh;
        int jjy;
        bool ok;
        rep(jy,101){
            jjy = jy;
            ok = 1;
            nh = h[id] + abs(ix - x[id]) + abs(jy - y[id]);
            rep(k,n){
                if(h[k] > 0 && nh - abs(ix - x[k]) - abs(jy - y[k]) != h[k]) ok = 0;
                if(h[k] == 0 && nh - abs(ix - x[k]) - abs(jy - y[k]) > 0) ok = 0;
            }
            if(ok){
                ans1 = ix;
                ans2 = jjy;
                ans3 = nh;
            }
        }
    }
    cout << ans1 << " " << ans2 << " " << ans3 << endl;
    return 0;
}

Measured memory_bytes: 3620
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
void push(int);
int pop(void);

int top,st[2000];

int main(){
  int a,b;
  char t[100];
  while(scanf("%s",t)!=EOF){
    if(t[0]=='+'){
      a=pop();
      b=pop();
      push(a+b);
    }else if(t[0]=='-'){
      a=pop();
      b=pop();
      push(b-a);
    }else if(t[0]=='*'){
      a=pop();
      b=pop();
      push(a*b);
    }else{
      push(atoi(t));
    }
  }

  printf("%d\n",pop());
  return 0;

}


void push(int x){
  top=top+1;
  st[top]=x;
}

int pop(){
  top--;
  return st[top+1];
}



Measured memory_bytes: 2052
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <vector>
#include <stack>
#include <map>
#include <set>
#include <cmath>
#include <cctype>
#include <ctime>

using namespace std;

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define eps 1e-9

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

const int INF = 0x7fffffff;
char s[20], ans[20];

int main() {
#ifdef __AiR_H
    freopen("A.in", "r", stdin);
//    freopen("out.txt", "w", stdout);
#endif // __AiR_H
    scanf("%s", s); int cur = 0, len = strlen(s);
    for (int i = 0; i < len; ++i) {
        if (s[i] != 'B') { ans[cur++] = s[i]; }
        else if (cur != 0) { ans[cur - 1] = '\0'; --cur; }
    }
    for (int i = 0; i < cur; ++i) {
        printf("%c", ans[i]);
    }
    printf("\n");
#ifdef __AiR_H
    printf("Time used = %.2fs\n", (double)clock() / CLOCKS_PER_SEC);
#endif // __AiR_H
    return 0;
}


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

using namespace std;

int A,B,K;
vector<int> N;


void input(){
  cin >> A >> B >> K;
}

void solve(){
  int m=min(A,B);
  for(int i=1;i<=m;i++){
    if(A%i==0 && B%i==0){
      //      cout << i << endl;
      N.push_back(i);
    }
  }
}

int main(){
  input();
  solve();
  /*  for(auto ax:N){
    cout << ax << endl;
  }
  */
  sort(N.begin(),N.end(),greater<int>());
  /*  for(auto ax:N){
    cout << ax << endl;
  }
  */
  cout << N[K-1] << endl;
  return 0;
}


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

int main()
{
  int n; cin>>n;
  string s; cin>>s;
  string sl = s.substr(0, n);
  string sr = s.substr(n);
  map<pair<string, string>, ll> mpl;
  map<pair<string, string>, ll> mpr;
  {
    for (int bits=0; bits<1<<n; bits++) {
      string s1 = "";
      string s2 = "";
      for (int i=0; i<n; i++) {
        if (bits>>i&1) s2.push_back(sl[i]);
        else s1.push_back(sl[i]);
      }
      reverse(s2.begin(), s2.end());
      mpl[make_pair(s1, s2)]++;
    }
  }
  {
    for (int bits=0; bits<1<<n; bits++) {
      string s1 = "";
      string s2 = "";
      for (int i=0; i<n; i++) {
        if (bits>>i&1) s2.push_back(sr[i]);
        else s1.push_back(sr[i]);
      }
      reverse(s2.begin(), s2.end());
      mpr[make_pair(s2, s1)]++;
    }
  }
  ll ans = 0;
  for (auto v:mpl) {
    ans += v.second * mpr[v.first];
  }
  cout << ans << endl;

  return 0;
}


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

using namespace std;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
#define watch(a) { std::cout << #a << " = " << a << "\n"; }
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }
template<class T, class V> istream& operator>> (istream& ist, pair<T, V>& p) { return ist >> p.first >> p.second; }
template<class T> ostream& operator<< (ostream& ost, pair<T, T>& p) { return ost << p.first << ", " << p.second; }
template<class T> istream& operator>> (istream& ist, vector<T>& vs) { for(auto& e: vs) ist >> e; return ist; }

typedef long long ll;
int const inf = INT_MAX / 2;

int main() {
  int N; cin >> N;
  vector<int> B(N - 1);
  rep(i, N - 1) cin >> B[i];
  int ans = B[N - 2];
  for (int i = N - 2; i >= 0; i--) {
    ans += min(B[i], i > 0 ? B[i - 1] : B[i]);
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNext()) {
            int n = sc.nextInt();
            int[] v = new int[n];
            int[] c = new int[n];
            for (int i = 0; i < n; ++i) {
                v[i] = sc.nextInt();
            }
            for (int i = 0; i < n; ++i) {
                c[i] = sc.nextInt();
            }
            int res = 0;
            for (int i = 0; i < n; ++i) {
                res += Math.max(0, v[i] - c[i]);
            }
            System.out.println(res);
        }
        sc.close();
    }
}


Measured memory_bytes: 21844
// https://atcoder.jp/contests/agc037/submissions/6956246
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define chmax(a, b) a = (a >= b ? a : b)
#define chmin(a, b) a = (a <= b ? a : b)
#define sz(v) (int)v.size()
#define inf (int)(1e9+7)
#define ceil(a, b) a / b + !!(a % b)
ll pow(ll a, int b) { return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }


int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int n;
    while (cin >> n && n) {
        int m;
        cin >> m;
        int p[m][n];
        rep(i, m) rep(j, n) cin >> p[i][j];
        
        int ans = -inf;
        rep(j, n) {
            int sum = 0;
            rep(i, m) sum += p[i][j];
            chmax(ans, sum);
        }
        
        cout << ans << endl;
    }
}




Measured memory_bytes: 3400
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<algorithm>
using namespace std;

const int N=370;
const int M=30;

struct node{
	int x,y;
	node(){}
	node(int x,int y):x(x),y(y){}
}p[N];
int D,ans;
int s[N][M],lst[M],c[M],t[N],cnt[N][M];

int calc(){
	int sum=0;
	for (int i=1;i<=26;i++) lst[i]=0;
	for (int i=1;i<=D;i++){
		sum+=s[i][t[i]];
		lst[t[i]]=i;
		for (int j=1;j<=26;j++) sum-=c[j]*(i-lst[j]);
	}
	return sum;
}

int argmx(int d){
	int id=1;
	for (int i=2;i<=26;i++)
		if (s[d][i]>s[d][id]) id=i;
	return id;
}

bool cmp(node a,node b){
	return a.y>b.y;
}

int main(){
	scanf("%d",&D);
	for (int i=1;i<=26;i++) scanf("%d",&c[i]);
	for (int i=1;i<=D;i++)
		for (int j=1;j<=26;j++) scanf("%d",&s[i][j]);
	for (int i=1;i<=D;i++) t[i]=argmx(i);
	ans=calc();
	int lim=100000/D/26;
	int sum,tmp;
	for (int T=1;T<=lim;T++){
		for (int d=1;d<=D;d++){
			for (int i=1;i<=26;i++) lst[i]=0;
			for (int i=1;i<d;i++) lst[t[i]]=i;
			for (int i=1;i<=26;i++) p[i]=node(i,s[d][i]-c[i]*(d-lst[i]));
			sort(p+1,p+1+26,cmp);
			for (int i=1;i<=10;i++){
				int q=p[i].x;
				tmp=t[d];
				t[d]=q; sum=calc();
				if (sum>ans) ans=sum;
				else t[d]=tmp;
			}
		}
	}
	for (int i=1;i<=D;i++) printf("%d\n",t[i]);
	return 0;
}

Measured memory_bytes: 3888
package main

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

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

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

// min, max, asub, absなど基本関数
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

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

func abs(a int) int {
	if a >= 0 {
		return a
	}
	return -a
}

func lowerBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] >= x
	})
	return idx
}

func upperBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] > x
	})
	return idx
}

func chk(x int) int {
	if x == 2 {
		return 3
	}
	if x == 4 || x == 6 || x == 9 || x == 11 {
		return 2
	}
	return 1
}

func main() {
	sc.Split(bufio.ScanWords)
	x, y := getInt(), getInt()
	if chk(x) == chk(y) {
		out("Yes")
		return
	}
	out("No")
}


Measured memory_bytes: 640
#include <iostream>

using namespace std;

int main()
{
    int n,count = 0;
    string s;
    cin >> n;
    cin >>s;
    for(int i=0;i<n-2;i++){
        if(s[i]=='A'&&s[i+1]=='B' && s[i+2]=='C'){
            count ++;
            i+=2;
        }
    }
    cout << count << endl;
    return 0;
}


Measured memory_bytes: 256
from collections import Counter

n = int(input())

s = [input() for _ in range(n)]

c = Counter(s)

csort = sorted(c.items(), key=lambda x:x[1],reverse=True)

maxc = csort[0][1]
ans = []
for s,v in csort:
    if v == maxc:
        ans.append(s)
        
anssort = sorted(ans)

for s in anssort:
    print(s)

Measured memory_bytes: 50108
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <tuple>
#include <queue>
#include <bitset>
#include <unordered_map>
#include <tuple>
#include <utility>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <sys/time.h>

using namespace std;

void solve(long long X, long long A){
  if (X < A) {
    std::cout << 0 << std::endl;
  } else {
    std::cout << 10 << std::endl;
  }
}

int main(){
  long long A;
  long long X;
  scanf("%lld",&X);
  scanf("%lld",&A);
  solve(X, A);
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>  // clang-format off
using Int = long long;
#define REP_(i, a_, b_, a, b, ...) for (Int i = (a), lim##i = (b); i < lim##i; i++)
#define REP(i, ...) REP_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
struct SetupIO { SetupIO() { std::cin.tie(nullptr), std::ios::sync_with_stdio(false), std::cout << std::fixed << std::setprecision(13); } } setup_io;
#ifndef dump
#define dump(...)
#endif  // clang-format on

/**
 *    author:  knshnb
 *    created: Sat Jun 13 21:01:31 JST 2020
 **/

signed main() {
    Int a, v, b, w, T;
    std::cin >> a >> v >> b >> w >> T;
    std::cout << (std::abs(a - b) > (v - w) * T ? "NO" : "YES") << std::endl;
}


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

int main() {
  int n,m,x;
  cin>>n>>m>>x;
  vector<int> c(n);
  vector<vector<int>> avi(n,vector<int>(m));
  rep(i,n){
    cin>>c[i];
    rep(j,m){
      cin>>avi[i][j];
    }
  }
  int min_cost = 1200010;
  bool ch = false;
  for(int tmp=0; tmp<(1<<n); tmp++){ 
    bitset<12> b(tmp);
    int tmp_cost = 0;
    vector<int> tmp_avi(m,0);
    rep(i,n){ 
      if(b.test(i)){
        tmp_cost+=c[i];
        rep(j,m){
          tmp_avi[j]+=avi[i][j];
        }
      }
    } 
    bool suc =true;
    rep(i,m){
      if(tmp_avi[i]<x){
        suc = false;
      }
    }
    if(suc){
      min_cost=min(min_cost,tmp_cost);
      ch = true;
    }
  }
  if(ch){
    cout<<min_cost<<endl;
  }else{
    cout<<-1<<endl;
  }
}



Measured memory_bytes: 3644
import java.util.*;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
   		int n = sc.nextInt();	
		int a = sc.nextInt();
		if (n%500<=a){
			System.out.print("Yes");
        }else{
        	System.out.print("No");
        }
    }
}

Measured memory_bytes: 22612
#include<bits/stdc++.h>
#define rep(i,l,r) for(ll (i)=(l);(i)<(r);(i)++)
#define ll long long
using namespace std;
int main(){
    string ans;
    cin>>ans;
    ll n;
    cin>>n;
    int rev=0;
    rep(i,0,n){
        ll t;
        cin>>t;
        if(t==1)rev++;
        else {
            ll f;        
            string c;
            cin>>f>>c;
            if(rev%2){
                if(f==1)ans+=c;
                else ans.insert(0,c);
            }
            else {
                if(f==1)ans.insert(0,c);
            else ans+=c;
            }
        }
    }
    if(rev%2)reverse(ans.begin(),ans.end());
    cout<<ans<<endl;
}

Measured memory_bytes: 900
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <utility>
#include <vector>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define fi first
#define se second
typedef long long ll;

int N,M,H,W,K,A,B;
string S;
string alpha = "abcdefghijklmnopqrstuvwxyz";
string ALPHA = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

int main() {
  class union_find{
        vector<long> parent, tree_size;
    public:
        union_find(unsigned long _n) : parent(_n), tree_size(_n, 1){
            for(unsigned long i = 0; i < _n; ++i)parent[i] = i;
        }
        ll find(ll x){
            while(parent[x] != x)x = parent[x] = parent[parent[x]];
            return x;
        }
        bool merge(ll a, ll b){
            a = find(a);
            b = find(b);
	    if(a==b) return false;
            if(tree_size[a] < tree_size[b])swap(a, b);
            tree_size[a] += tree_size[b];
            parent[b] = a;
            return true;
        }
	bool same(ll a, ll b){
	    a = find(a);
	    b = find(b);
	    return a == b;
	}
  };
  vector<ll> fib(1010);//1-indexed
  fib[0]=1;
  fib[1]=2;
  reps(i,2,1011) {
    fib[i] = fib[i-1]+fib[i-2];
    fib[i]%= 1001;
  }
  while(cin>>N>>M){
    ll ans = N;
    union_find uf(N+10);
    reps(i,1,N+1){
      reps(j,i+1,N+1){
	if(abs(fib[i]-fib[j])<M) ans -= uf.merge(i-1,j-1);
      }
    } cout<<ans<<endl;
  }
}



Measured memory_bytes: 3112
import java.io.*;
import java.util.*;
import static java.lang.Math.*;
public class Main {
    public static void main(String[] $) {
        int n=sc.nextInt();
        Solve(n,0,0,100,0);
        out.println(100+" "+0);
        out.close();
    }

    static void Solve(int n,double x1,double y1,double x2,double y2){
        if(n==0){
            out.println(x1+" "+y1);
            return;
        }
        //ベクトルと座標（位置ベクトル）の区別に気を付ける
        double x3=(x2-x1)/3;
        double y3=(y2-y1)/3;
        double sx=x3*cos(PI/3)-y3*sin(PI/3)+x3+x1;
        double sy=x3*sin(PI/3)+y3*cos(PI/3)+y3+y1;
        double tx=x3*2+x1;
        double ty=y3*2+y1;
        x3+=x1;
        y3+=y1;
        Solve(n-1,x1,y1,x3,y3);
        Solve(n-1,x3,y3,sx,sy);
        Solve(n-1,sx,sy,tx,ty);
        Solve(n-1,tx,ty,x2,y2);
    }

    static PrintWriter out = new PrintWriter(System.out);

    static class sc {
        static Scanner scanner = new Scanner(System.in);

        static String next() {
            return scanner.next();
        }

        static String nextLine() {
            return scanner.nextLine();
        }

        static int nextInt() {
            return Integer.parseInt(scanner.next());
        }

        static long nextLong() {
            return Long.parseLong(scanner.next());
        }

        static double nextDouble() {
            return Double.parseDouble(scanner.next());
        }

        static boolean hasNext() {
            return scanner.hasNext();
        }

        static boolean hasNextInt() {
            return scanner.hasNextInt();
        }

        static boolean hasNext(String str) {
            return scanner.hasNext(str);
        }
    }

}


Measured memory_bytes: 31788
#include<iostream> 
#include<iomanip> 
#include<vector> 
#include<map> 
#include<set> 
#include<algorithm> 
#include<numeric> 
#include<limits> 
#include<bitset> 
#include<functional> 
#include<type_traits> 
#include<queue> 
#include<stack> 
#include<array> 
#include<random> 
#include<utility> 
#include<cstdlib> 
#include<ctime>
#define INT_MAX 2147483647
#define _LIBCPP_DEBUG 0
#define _GLIBCXX_DEBUG
#define rep(i,n) for (int i = 0; i < (n); ++i)	
using namespace std;


int max(int a,int b) {
	int max;
	if (a > b) max = a;
	else max = b;
	return max;
}
int min(int a, int b) {
	int min;
	if (a < b) min = a;
	else min = b;
	return min;
}


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

	s[3] = '8';
	cout << s << endl;

}

Measured memory_bytes: 256
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif
//#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
typedef long double ld;
typedef long long ll;
int n;
const int mod = (int)1e9 + 7;
int mult(int a, int b) {
    return (1LL * a * b) % mod;
}

int pw(int a, int b) {
    if (b == 0) return 1;
    if (b & 1) return mult(a, pw(a, b - 1));
    int res = pw(a, b / 2);
    return mult(res, res);
}

int sub(int a, int b) {
    int s = a - b;
    if (s < 0) s += mod;
    return s;
}

int sum(int a, int b) {
    int s = a + b;
    if (s >= mod) s -= mod;
    return s;
}

const int maxN = (int)1e5 + 10;

int fact[maxN], invfact[maxN], inv[maxN];

void init() {
    inv[1] = invfact[1] = invfact[0] = fact[0] = fact[1] = 1;
    for (int i = 2; i < maxN; i++) {
        fact[i] = mult(fact[i - 1], i);
        inv[i] = mult(inv[mod % i], mod - mod / i);
        invfact[i] = mult(invfact[i - 1], inv[i]);
    }
}

int cnk(int n, int k) {
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return mult(fact[n], mult(invfact[k], invfact[n - k]));
}
int p[maxN];
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
//    freopen("input.txt", "r", stdin);
    deque < int > s;
    int n;
    cin >> n;
    bool rev = false;
    for (int i = 1; i <= n; i++) {
        int x;
        cin >> x;
        if (rev) {
            s.emplace_front(x);
        }
        else {
            s.emplace_back(x);
        }
        rev = !rev;
    }
    if (rev) reverse(s.begin(), s.end());
    for (int v : s) cout << v << " ";
    return 0;
}

Measured memory_bytes: 3072
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
using namespace std;
const int MAXN=100005,INF=0x3F3F3F3F;

int N,K;
vector<int> adj[MAXN];
pair<int,int> range[MAXN];
pair<int,int> paint[MAXN];
int ans[MAXN];
queue<int> Q;
priority_queue<pair<int,int>,vector<pair<int,int> >,greater<pair<int,int> > > Q0;

int main()
{
	scanf("%d",&N);
	for(int i=1;i<N;i++)
	{
		int a,b;
		scanf("%d%d",&a,&b);
		adj[a].push_back(b);
		adj[b].push_back(a);
	}
	scanf("%d",&K);
	for(int i=1;i<=N;i++)
		range[i]=make_pair(-INF,INF);
	for(int i=1;i<=K;i++)
	{
		scanf("%d%d",&paint[i].first,&paint[i].second);
		range[paint[i].first]=make_pair(paint[i].second,paint[i].second);
		Q0.push(make_pair(0,paint[i].first));
	}
	while(!Q0.empty())
	{
		pair<int,int> t=Q0.top();
		Q0.pop();
		int fa=t.second;
		if(range[fa].second-range[fa].first<t.first)
			continue;
		for(int i=0;i<(int)adj[fa].size();i++)
		{
			int u=adj[fa][i];
			if(range[u].first!=-INF)
			{
				if(range[u].first%2==range[fa].first%2)
				{
					puts("No");
					return 0;
				}
				if(range[fa].second+1<range[u].first||range[u].second<range[fa].first-1)
				{
					puts("No");
					return 0;
				}
				if(range[fa].first-1<=range[u].first&&range[u].second<=range[fa].second+1)
					continue;
			}
			range[u].first=max(range[u].first,range[fa].first-1);
			range[u].second=min(range[u].second,range[fa].second+1);
			Q0.push(make_pair(range[u].second-range[u].first,u));
		}
	}
	puts("Yes");
	
	for(int i=1;i<=N;i++)
		if(range[i].first==range[i].second)
		{
			ans[i]=range[i].first;
			Q.push(i);
		}
	while(!Q.empty())
	{
		int u=Q.front();
		Q.pop();
		for(int i=0;i<(int)adj[u].size();i++)
		{
			int v=adj[u][i];
			if(range[v].first==range[v].second)
				continue;
			if(range[v].second>=ans[u]+1)
				ans[v]=ans[u]+1;
			else
				ans[v]=ans[u]-1;
			range[v].first=range[v].second=ans[v];
			Q.push(v);
		}
	}
	for(int i=1;i<=N;i++)
		printf("%d\n",ans[i]);
	
	return 0;
}


Measured memory_bytes: 9592
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<string>
#define ll long long
#define INF 0x3f3f3f3f
#define N 1005
using namespace std;

int a[3][N];

int main()
{
	int n;
	cin>>n;
	for(int i=1;i<=2;i++)
	for(int j=1;j<=n;j++)
	cin>>a[i][j];
	for(int i=1;i<=2;i++)
	for(int j=1;j<=n;j++)
	a[i][j]+=max(a[i-1][j],a[i][j-1]);
	cout<<a[2][n]<<'\n';
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define FAST ios_base::sync_with_stdio(0); cin.tie(); cout.tie();
 
#define MAXX 10005
 
#define PI 3.14159265358979323846264338327950
 
#define F first
#define S second
 
#define ll 	 long long int
 
#define mod  1000000007



int main()
{
	FAST;
	string s;
	cin >> s;
	ll n;
	cin >> n;
	for(ll i = 0; i < s.size(); i ++){
		if(s[i] == '1'){
			n--;
		}
		else{
			n = 0;
		}
		if(n == 0){
			cout << s[i]; return 0;
		}
	}

	return 0;
}

Measured memory_bytes: 3600
#include<stdio.h>
#define N 2000000
int main(void){
  int i,max=-1000000000;
  int min;
  int n,R[N];
   
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&R[i]);
  }
 
  min = R[0];
  for(i=1;i<n;i++){
    if(R[i] - min > max) max = R[i] - min;
    if(R[i] < min) min = R[i];
  }
 
  printf("%d\n",max);
}


Measured memory_bytes: 2632
#include <bits/stdc++.h>
using namespace std;
#define rep(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(v) v.begin(), v.end()
using ll = long long;
const ll MOD = 1e9+7; ll LLINF = 1LL << 60; int INF = INT_MAX;

//

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

Measured memory_bytes: 256