akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n,s) for(int i=(s);i<(n);i++)
typedef long long int ll;
using namespace std;
using Graph = vector<vector<int> >;

int main(){
cin.tie(0);
ios::sync_with_stdio(false);
int N,A;
cin>>N>>A;
cout<<N*N-A<<endl;
//system("pause");
return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <climits>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#define INF_INT (INT_MAX / 2)
#define INF_LONG (LONG_MAX / 2)
//#define DEBUG true
#define DEBUG false
using namespace std;

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

  string s;
  cin >> s;

  bool exist[26];
  fill(exist, exist + 26, false);
  for(char ch: s){
    exist[ch - 'a'] = true;
  }

  for(char ch = 'a'; ch <= 'z'; ch++){
    if(!exist[ch - 'a']){
      cout << ch << endl;
      return 0;
    }
  }

  cout << "None" << endl;

  return 0;
}


Measured memory_bytes: 512
#include <iostream>

using namespace std;

int main() {
	int a, b;
	cin >> a >> b;
	
	if (a == b) {
		cout << "Draw" << endl;
	}
	else if (a == 1 || (a > b && b != 1)) {
		cout << "Alice" << endl;
	}
	else {
		cout << "Bob" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define endl "\n"
#define se second
#define ls( s) (s&(-s))
#define ll long long
#define inf 0x3f3f3f3f
const ll N = 500030;
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
const ll mod =    1e9+7;

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

ll h,w;
cin>>h>>w;
if(h==1||w==1)
{
	cout<<1;
	return 0;
}
cout<<(h*w)/2+((h*w)%2);


}

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


struct UnionFind {
    vector<int> par;

    UnionFind(int n) : par(n, -1) { }
    void init(int n) { par.assign(n, -1); }

    int root(int x) {
        return par[x] < 0 ? x : par[x] = root(par[x]);
    }

    bool is_same(int x, int y) {
        return root(x) == root(y);
    }

    bool merge(int x, int y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        if (par[x] > par[y]) swap(x, y);
        par[x] += par[y];
        par[y] = x;
        return true;
    }

    int size(int x) {
        return -par[root(x)];
    }
};

void Main()
{
	int N, K, L; cin >> N >> K >> L;
	UnionFind uf1(N);
	rep(i,K) {
		int p, q; cin >> p >> q;
		--p, --q;
		uf1.merge(p, q);
	}
	UnionFind uf2(N);
	rep(i,L) {
		int p, q; cin >> p >> q;
		--p, --q;
		uf2.merge(p, q);
	}
	map<pair<int, int>, int> mp;
	rep(i,N) {
		++mp[make_pair(uf1.root(i), uf2.root(i))];
	}
	rep(i,N) {
		cout << mp[make_pair(uf1.root(i), uf2.root(i))];
		if (i != N - 1) cout << " ";
	}
	cout << endl;
}

int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
}


Measured memory_bytes: 13568
using System.Collections.Generic;
using System.Linq;
using static System.Math;
using System;

public class hello
{
    public static void Main()
    {
        var n = int.Parse(Console.ReadLine().Trim());
        Console.WriteLine(getAns(n));
    }
    static int getAns(int n)
    {
        var a = new List<int>();
        for (int i = 1; i <= 9; i++)
        {
            a.Add(i);
            a.Add(i * 11);
            for (int j = 0; j <= 9; j++)
            {
                a.Add(i * 100 + j * 10 + i);
                a.Add(i * 1000 + j * 100 + j * 10 + i);
            }
        }
        var b = a.OrderBy(x => x).ToArray();
        var t = int.MaxValue; var ans = 0;
        foreach (var x in b)
            if (Abs(n - x) < t) { t = Abs(n - x); ans = x; }
        return ans;
    }
}



Measured memory_bytes: 18216
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

S = input()
T = input()
leng = len(S)
for i in range(leng+1):
    S = S[-1]+S[:-1]
    if S==T:
        print('Yes')
        break
else:
    print('No')

Measured memory_bytes: 61736
#include<cstdlib>
#include<iostream>
using namespace std;
int main() {
    // 1 or 2
    int N;
    int A;
    int B;
    cin >> N;
    if (N == 1) {
      cout << "Hello World" <<endl;
    } else {
      cin >> A;
      cin >> B;
      cout << A+B << endl;
    }
     return 0;

}



Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <sstream>
#include <math.h>
#include <map>
#include <set>
#include <ios>     // std::left, std::right
#include <iomanip> // std::setw(int), std::setfill(char)
using namespace std;


int main(){
  int N,K;
  cin>>N>>K;
  if((N-1)/2+1>=K){
    cout<<"YES"<<"\n";
  }
  else{
    cout<<"NO"<<"\n";
  }
return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <cmath>
#include <string>
#include <algorithm>
#include <queue>
#include <vector>
#include <functional>
#include <stack>
#include <map>
#include <utility>
#define REP(i,n) for(int i=0;i<n;++i)
using namespace std;

int main() {
  int n, x, t;
  cin >> n >> x >> t;

  int a = n / x;

  if (n % x != 0) {
    ++a;
  }

  cout << a * t << endl;
}


Measured memory_bytes: 3580
[<AutoOpen>]
module Program

open System

let read f = stdin.ReadLine() |> f
let reada f = stdin.ReadLine().Split() |> Array.map f
let reads f = stdin.ReadLine().Split() |> Array.toList |> List.map f

[<EntryPoint>]
let main _ =
    let [N;M] = reads int
    let AS = reads int64 |> List.sort
    let BCS =
        List.init M (fun _ -> reads int64)
        |> List.sortByDescending (List.item 1)

    let rec solve acc xs = function
        | [] -> acc + List.sum xs
        | [b;c] :: ys ->
            let rec loop acc' b' = function
                | [] -> (acc', [])
                | z :: zs ->
                    if b' = 0L then
                        (acc', z :: zs)
                    elif z < c then
                        loop (acc' + c) (b' - 1L) zs
                    else
                        loop (acc' + z) b' zs
            let acc', xs' = loop acc b xs
            solve acc' xs' ys

    solve 0L AS BCS
    |> printfn "%i"

    0

Measured memory_bytes: 44496
#include <iostream>
#include <cstdio>
#include <string>
#include <sstream>
#include <algorithm>
#include <math.h>
#include <map>
#include <iomanip>
#include <vector>
#include <queue>

#define PI 3.14159265359

#define INF 1000000;

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

typedef long long ll;

using namespace std;


/*
class ElectronicPetEasy
{
public:
	string isDifficult(int st1, int p1, int t1, int st2, int p2, int t2)
	{
		
	}
};
*/




int main()
{
	int vx[]={ 0, 1,-1, 0, 0,-1,-1, 1, 1, 2,-2, 0, 0};
	int vy[]={ 0, 0, 0, 1,-1,-1, 1,-1, 1, 0, 0, 2,-2};
	int x, y, size, grid[10][10], nm_ans = 0, max_ans = 0;
	
	//grid初期化
	for (int i=0; i<10; i++)
	{
		for (int j=0; j<10; j++)
		{
			grid[i][j] = 0;
		}
	}
	
	while (scanf("%d,%d,%d", &x, &y, &size) != EOF)
	{
		switch (size)
		{
		case 1:
			for (int i=0; i<5; i++)
			{
				if ((min(x+vx[i], y+vy[i]) >= 0) && (max(x+vx[i], y+vy[i]) < 10))
				{
					grid[x+vx[i]][y+vy[i]]++;
				}
			}
			break;
		case 2:
			for (int i=0; i<9; i++)
			{
				if ((min(x+vx[i], y+vy[i]) >= 0) && (max(x+vx[i], y+vy[i]) < 10))
				{
					grid[x+vx[i]][y+vy[i]]++;
				}
			}
			break;
		case 3:
			for (int i=0; i<13; i++)
			{
				if ((min(x+vx[i], y+vy[i]) >= 0) && (max(x+vx[i], y+vy[i]) < 10))
				{
					grid[x+vx[i]][y+vy[i]]++;
				}
			}
			break;
		}
	}
	
	for (int i=0; i<10; i++)
	{
		for (int j=0; j<10; j++)
		{
			max_ans = max(max_ans, grid[i][j]);
			if (grid[i][j] == 0) nm_ans++;
		}
	}
	
	cout << nm_ans << endl;
	cout << max_ans << endl;
	
	return 0;
}

Measured memory_bytes: 1208
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
using namespace std;

int main() {
    int N, K;
    cin >> N >> K;
    vector<int> A(N);
    for (int i=0; i<N; ++i) {
        cin >> A[i];
    }

    map<int, int> b;
    for (int i=0; i<N; ++i) {
        auto it = b.begin();
        bool flag;
        tie(it, flag) = b.insert(make_pair(A[i], 1));
        if (flag != true) b.at(A[i])++;
    }

    vector<int> c(N);
    set<int> d;
    decltype(b)::iterator it = b.begin();
    decltype(b)::iterator last = b.end();
    for (int i=0; it != last; ++i, ++it) {
        d.insert(it->first);
        c[i] = it->second;
    }
    c.erase(c.begin() + d.size(), c.end());
    sort(c.begin(), c.end());
    int m = d.size() - K;
    if (m > 0) {
        int output = 0;
        for (int i=0; i<m; ++i) {
            output += c[i];
        }
        cout << output << endl;
    } else cout << 0 << endl;
}

Measured memory_bytes: 20608
#include <bits/stdc++.h>
using namespace std;
#define ll long long
 
int main(int qtd, char* nome[])
{
	ios::sync_with_stdio(false);
	cin.tie(0);

	map<string, int> mp;
	string s1, s2;
	cin >> s1 >> s2;
	cin >> mp[s1] >> mp[s2];
	string t;
	cin >> t;
	mp[t]--;
	cout << mp[s1] << ' ' << mp[s2] << endl;
	
	return 0;
}

Measured memory_bytes: 256
n  = int(input())
a = list(map(int,input().split()))

y=0

x = max(a)

if max(a)-min(a) >1:
    print("No")

elif max(a) == min(a):
    if max(a)==n-1 or n>=2*max(a):
        print('Yes')
    else:
        print('No')
        
else:
    for i in range(n):
        if a[i] == x:
            y += 1

    if y >=2*(x-(n-y)) and x-n+y >0 and n-y>0:
        print('Yes')
    else:
        print('No')
    

Measured memory_bytes: 14092
#include<bits/stdc++.h>
using namespace std;
#define MAXN 200005
#define ll long long
int main()
{
    int a,b,h,m;
    scanf("%d%d%d%d",&a,&b,&h,&m);
    //cout<<acos(-1)<<endl;
    double hx,hy,mx,my;
    double angle_h=(90-h%12*30-m/2.0)/180.0*acos(-1);
    double angle_m=(90-m*6)/180.0*acos(-1);
    hx=cos(angle_h)*a;
    hy=sin(angle_h)*a;
    mx=cos(angle_m)*b;
    my=sin(angle_m)*b;
    double ans=sqrt((hx-mx)*(hx-mx)+(hy-my)*(hy-my));
    printf("%.10f\n",ans);
}

Measured memory_bytes: 4092
# -*- coding: utf-8 -*-
N=int(input())
A=list(map(int,input().split()))
An=[]
count=1
for i in A:
    An.append((count,i))
    count=count+1
An.sort(key=lambda x:x[1])
ans=[str(m[0]) for m in An]
ans=" ".join(ans)
print(ans)

Measured memory_bytes: 24932
n, m = map(int, input().split())
hlist = list(map(int, input().split()))
ab = [list(map(int, input().split())) for _ in range(m)]

maxh = [0]*n
for a, b in ab:
  maxh[a-1] = max(maxh[a-1], hlist[b-1])
  maxh[b-1] = max(maxh[b-1], hlist[a-1])
ans = 0
for i in range(n):
  if maxh[i] < hlist[i]:
    ans += 1
print(ans)

Measured memory_bytes: 31896
import sys
sys.setrecursionlimit(1 << 25)
readline = sys.stdin.buffer.readline
read = sys.stdin.readline  # 文字列読み込む時はこっち
ra = range
enu = enumerate


def exit(*argv, **kwarg):
    print(*argv, **kwarg)
    sys.exit()


def mina(*argv, sub=1): return list(map(lambda x: x - sub, argv))
# 受け渡されたすべての要素からsubだけ引く.リストを*をつけて展開しておくこと


def a_int(): return int(readline())


def ints(): return list(map(int, readline().split()))


def read_col(H):
    '''H is number of rows
    A列、B列が与えられるようなとき
    ex1)A,B=read_col(H)    ex2) A,=read_col(H) #一列の場合'''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, readline().split())))
    return tuple(map(list, zip(*ret)))


def read_tuple(H):
    '''H is number of rows'''
    ret = []
    for _ in range(H):
        ret.append(tuple(map(int, readline().split())))
    return ret


def read_matrix(H):
    '''H is number of rows'''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, readline().split())))
    return ret
    # return [list(map(int, read().split())) for _ in range(H)] # 内包表記はpypyでは遅いため


MOD = 10**9 + 7
INF = 2**31  # 2147483648 > 10**9
# default import
from collections import defaultdict, Counter, deque
from operator import itemgetter, xor, add
from itertools import product, permutations, combinations
from bisect import bisect_left, bisect_right  # , insort_left, insort_right
from functools import reduce
from math import gcd


def lcm(a, b):
    # 最小公倍数
    g = gcd(a, b)
    return a // g * b


S = input()
add = 'es' if S.endswith('s') else 's'
print(S + add)


Measured memory_bytes: 68704
S=input()
T=input()
# a,b=map(int,input().split(" "))
# a=[int(_) for _ in input().split(" ")]

#print("-----")

ans="Yes"

if len(T)-len(S) != 1:
    ans="No"
else:
    for i in range(len(S)):
        if S[i]!=T[i]:
            ans="No"

print(ans)



Measured memory_bytes: 9100
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(true){
			int a = sc.nextInt();
			int b = sc.nextInt();
			if(a == 0 && b == 0){break;}
			for(int i = 0; i < a; i++){
				String s = "";
				for(int i2 = 0; i2 < b; i2++){
					s += "#";
				}
				System.out.println(s);
			}
			System.out.println();
		}
	}
}



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

int main(){
    int n, x, cnt = 0;
    while(cin >> n >> x, n != 0){
        cnt = 0;
        for(int i = 1; i <= n; i++){
            for(int j = i+1; j <= n; j++){
                for(int k = j+1; k <= n; k++){
                    if(i==j || j==k || k==i) continue;
                    if(i+j+k==x){
                        //cout << i << " " << j << " " << k << " " << "O" << endl;
                        cnt++;
                    }
                }
            }
        }
        cout << cnt << endl;
    }
    
    return 0;
}


Measured memory_bytes: 3116
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Math;

namespace CSharp
{
    static class Program
    {
        static bool Solve(int[] H)
        {
            int height = 0;

            foreach (var value in H)
            {
                //Console.WriteLine($"{value} {height}");
                if (value < height)
                {
                    return false;
                }

                height = Max(height, value - 1);
            }

            return true;
        }

        static void Main(string[] args)
        {
            ReadString();
            int[] H = ReadIntArray();
            bool ans = Solve(H);
            Console.WriteLine(ans ? "Yes" : "No");
        }

        #region Helpers

        static int[] ReadIntArray() => Console.ReadLine().Split().Select(s => int.Parse(s)).ToArray();
        static long[] ReadLongArray() => Console.ReadLine().Split().Select(s => long.Parse(s)).ToArray();

        static int[] ReadLineIntArray(int count) => Enumerable.Repeat(0, count).Select(_ => int.Parse(Console.ReadLine())).ToArray();
        static long[] ReadLineLongArray(int count) => Enumerable.Repeat(0, count).Select(_ => long.Parse(Console.ReadLine())).ToArray();

        static string ReadString() => Console.ReadLine();
        static int ReadInt() => int.Parse(Console.ReadLine());
        static long ReadLong() => long.Parse(Console.ReadLine());

        static void ReadInt(out int first)
        {
            var array = ReadIntArray();
            first = array[0];
        }

        static void ReadInt(out int first, out int second)
        {
            var array = ReadIntArray();
            first = array[0];
            second = array[1];
        }

        static void ReadInt(out int first, out int second, out int third)
        {
            var array = ReadIntArray();
            first = array[0];
            second = array[1];
            third = array[2];
        }

        static void ReadInt(out int first, out int second, out int third, out int fourth)
        {
            var array = ReadIntArray();
            first = array[0];
            second = array[1];
            third = array[2];
            fourth = array[3];
        }

        static void ReadLong(out long first)
        {
            var array = ReadLongArray();
            first = array[0];
        }

        static void ReadLong(out long first, out long second)
        {
            var array = ReadLongArray();
            first = array[0];
            second = array[1];
        }

        static void ReadLong(out long first, out long second, out long third)
        {
            var array = ReadLongArray();
            first = array[0];
            second = array[1];
            third = array[2];
        }

        static void ReadLong(out long first, out long second, out long third, out long fourth)
        {
            var array = ReadLongArray();
            first = array[0];
            second = array[1];
            third = array[2];
            fourth = array[3];
        }

        #endregion
    }
}

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

vector<vector<int>> g(200200);
pair<int, int> tdfs(int v, int p) {
    pair<int, int> d = make_pair(1, v);
    for (auto u : g[v])
        if (u != p) {
            pair<int, int> d2 = tdfs(u, v);
            d2.first++;
            d = max(d, d2);
        }
    return d;
}

int treediameter() {
    return tdfs(tdfs(0, -1).second, -1).first;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    // cout << fixed << setprecision(10);

    int n;
    cin >> n;

    rep(i, 0, n - 1) {
        int x, y;
        cin >> x >> y;
        x--, y--;
        g[x].emplace_back(y);
        g[y].emplace_back(x);
    }
    // cout << treediameter() << endl;
    int x = treediameter();
    if (x % 3 == 2)
        cout << "Second" << endl;
    else
        cout << "First" << endl;

    return 0;
}

Measured memory_bytes: 26880
#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 - 1; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define FORR(i, m, n) for(int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)

ll mod = 1e09;

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

  int a, b;
  cin >> a >> b;
  cout << (a + b) % 24 << endl;

}


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

using namespace std;

#define pb push_back
#define mp make_pair
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
typedef long long LL;
typedef pair<int, int> PII;

int n;
int a[100000], b[100000];

struct Le {
    inline bool operator()(const int &lhs, const int &rhs) const {
        if (b[lhs] != b[rhs]) {
            return b[lhs] < b[rhs];
        }
        return lhs < rhs;
    }
};

struct Ri {
    inline bool operator()(const int &lhs, const int &rhs) const {
        if (a[lhs] != a[rhs]) {
            return a[lhs] > a[rhs];
        }
        return lhs < rhs;
    }
};

set<int, Le> le;
set<int, Ri> ri;

LL solve(int x) {
    LL ans = 0;
    int pos = 0;
    forn(i, n) {
        le.insert(i);
        ri.insert(i);
    }
    forn(i, n) {
        int ind;
        if ((i + x) & 1) {
            ind = *le.begin();
            le.erase(ind);
            ri.erase(ind);
        } else {
            ind = *ri.begin();
            le.erase(ind);
            ri.erase(ind);
        }
        if (b[ind] < pos) {
            ans += pos - b[ind];
            pos = b[ind];
        } else if (a[ind] > pos) {
            ans += a[ind] - pos;
            pos = a[ind];
        }
    }
    return ans + abs(pos);
}

int main() {
    scanf("%d", &n);
    forn(i, n) scanf("%d%d", a + i, b + i);
    LL ans = max(solve(0), solve(1));
    cout << ans << endl;
    return 0;
}


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

#define fl(k, n) for(int i = k; i < n; i++)
#define flr(k, n) for(int i = n - 1; i >= k; i--)
#define vi vector<int>
#define vp vector<pair<int, int>>
#define mp make_pair
#define ll long long

using namespace std;

int binary_search(vector<int> nums, int target_val){
  int begin = 0;
  int end = nums.size();
  int mid;

  while(begin <= end){
    mid = begin + (end - begin) / 2;
    if(nums[mid] == target_val)
      return mid;
    else if(nums[mid] <= target_val && nums[mid + 1] > target_val)
      return mid;
    else if(nums[mid] > target_val)
      end = mid - 1;
    else
      begin = mid + 1;
  }

  if(begin == 0)
    return -1;
  else 
    return nums.size();
}

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
    
  string s, t;
  cin >> s >> t;

  int n = s.length();
  int m = t.length();

  vector<vi> lcs(n + 1, vi(m + 1));

  fl(0, n + 1)
    lcs[i][0] = 0;

  fl(0, m + 1)
    lcs[0][i] = 0;

  fl(0, n){
    for(int j = 0; j < m; j++){
      if(s[i] == t[j])
        lcs[i + 1][j + 1] = 1 + lcs[i][j];
      else{
        lcs[i + 1][j + 1] = max(lcs[i][j + 1], lcs[i + 1][j]);
      }
    }
  }

  /*
  fl(0, n + 1){
    for(int j = 0; j <= m; j++){
      cout << lcs[i][j] << " ";
    }
    cout << "\n";
  }
  */


  stack<char> l;
  int im = m;
  int in = n;
  while(im * in != 0){
    // cout << im << " " << in << endl;
    // cout << t[im - 1] << " " << s[in - 1] << endl;
    if(s[in - 1] == t[im - 1]){
      l.push(s[in - 1]);
      in--;
      im--;
    }
    else{
      if(lcs[in][im - 1] > lcs[in - 1][im]){
        im--;
      }
      else{
        in--;
      }
    }
  }

  while(!l.empty()){
    cout << l.top();
    l.pop();
  }
  cout << "\n";
}

Measured memory_bytes: 38512
#include <iostream>
#include <cstdio>
#include <cstdlib>

using namespace std;

struct Node {
    int key;
    Node *left;
    Node *right;
    Node(int key) : key(key), left(NULL), right(NULL) { }
};

int n;
char command[7];

Node *root;

inline Node* create_node(int key) {
    return new Node(key);
}

void destroy_node(Node *node) {
//    printf("[destroy_node] key = %d\n", node->key);
    if (node->left) {
        destroy_node(node->left);
        delete node->left;
    }
    if (node->right) {
        destroy_node(node->right);
        delete node->right;
    }
}

inline void insert(int key) {

    if (root == NULL) {
        root = create_node(key);
        return;
    }

    Node *node = root, *parent = NULL;
    while (node) {
        parent = node;
        if (key < node->key) {
            node = node->left;
        }
        else {
            node = node->right;
        }
    }

    Node *newnode = create_node(key);
    if (key < parent->key) {
        parent->left = newnode;
    }
    else {
        parent->right = newnode;
    }
}

void pre_order(Node *node) {
    printf(" %d", node->key);
    if (node->left) {
        pre_order(node->left);
    }
    if (node->right) {
        pre_order(node->right);
    }
}

void in_order(Node *node) {
    if (node->left) {
        in_order(node->left);
    }
    printf(" %d", node->key);
    if (node->right) {
        in_order(node->right);
    }
}

int main(void) {

    scanf("%d", &n);

    for (int i = 0, key; i < n; ++i) {
        scanf("%s", command);
        if (command[0] == 'i') {
            scanf("%d", &key);
            insert(key);
        }
        else {      // print 
            if (! root) { continue; }
            in_order(root);
            printf("\n");
            pre_order(root);
            printf("\n");
        }
    }

    if (root) {
        destroy_node(root);
        delete root;
    }

    return 0;
}

Measured memory_bytes: 16820
// Aaradhya Beri
#pragma GCC optimze("Ofast")
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define pb push_back
#define fi first
#define se second
typedef long long ll;
typedef long double f80;
#define double long double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define sz(x) ((long long)x.size())
#define fr(a,b,c) for(int a=b; a<=c; a++)
#define rep(a,b,c) for(int a=b; a<c; a++)
#define trav(a,x) for(auto &a:x)
#define all(con) con.begin(),con.end()
const ll infl=0x3f3f3f3f3f3f3f3fLL;
const int infi=0x3f3f3f3f;
//const int mod=998244353;
const int mod=1000000007;
typedef vector<int> vi;
typedef vector<ll> vl;

int powm(int a, int b) {
    int res=1;
    while(b) {
        if(b&1)
            res=(res*a)%mod;
        a=(a*a)%mod;
        b>>=1;
    }
    return res;
}
 
void solve() {
    int n;
    cin>>n;
    int h[n];
    rep(i,0,n)
        cin>>h[i];
    int dp[n];
    dp[0] = 0;
    dp[1] = dp[0] + abs(h[1] - h[0]);
    rep(i,2,n)
        dp[i] = min(dp[i-1] + abs(h[i] - h[i-1]),dp[i-2] + abs(h[i]-h[i-2]));
   cout<<dp[n-1]<<endl;
}
 
signed main() {
    ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    cout<<fixed<<setprecision(8);
    int t = 1;
    //cin>>t;
    while(t--)
        solve();
    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <climits>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <deque>
#define INF_INT (INT_MAX / 2)
#define INF_LONG (LONG_MAX / 2)
//#define DEBUG true
#define DEBUG false
#define MAX_N 10
using namespace std;

const int MAX = 100001;
const int MOD = 1000000007;

typedef long long ll;
typedef pair< int, int > pii;
typedef pair< ll, ll > pll;
typedef pair< ll, int > pli;
typedef pair< int, ll > pil;

int ceil(int x, int y){
  return (x % y == 0) ? x / y : x / y + 1;
}

int gcd(int x, int y){
  return y ? gcd(y, x % y) : x;
}

int lcm(int x, int y){
  return x / gcd(x, y) * y;
}

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

  int n;
  cin >> n;
  double x[n];
  string u[MAX_N];
  for(int i = 0; i < n; i++){
    cin >> x[i] >> u[i];
  }

  double sum = 0;
  for(int i = 0; i < n; i++){
    if(u[i] == "JPY") sum += x[i];
    else sum += x[i] * 380000.0;
  }

  printf("%.6lf\n", sum);

  return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>  // ver1.9.4
#define int long long
#define ALL(v) (v).begin(),(v).end()
#define Vi vector<int>
#define pb push_back
#define mp make_pair
#define cYES cout<<"YES"<<endl
#define cNO cout<<"NO"<<endl
#define cYes cout<<"Yes"<<endl
#define cNo cout<<"No"<<endl
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repeq(i,a,b) for(int i=a;i<=b;i++)
#define repr(i,a,b) for(int i=a;i>b;i--)
#define repreq(i,a,b) for(int i=a;i>=b;i--)
#define leng(n) (int)(log10(n)+1)
#define Vout(a) rep(i,0,a.size()-1)cout<<a[i]<<' ';cout<<a[a.size()-1]<<endl;
#define INF 9000000000000000000  //  9.0 * 10^18
#define MOD 1000000007  //  10^9 + 7
using namespace std;

signed main() {
  cout << fixed << setprecision(8);
  int n;
  cin >> n;
  int odd=0,memo;
  rep(i,0,n){
    cin >> memo;
    if(memo%2==1) odd++;
  }
  if(odd%2==0) cYES;
  else cNO;
  return 0;
}

Measured memory_bytes: 256
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>

#include <algorithm>
#include <bitset>
#include <complex>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#include <cassert>
#include <functional>

typedef long long ll;
using namespace std;

#ifndef LOCAL
#define debug(x) ;
#else
#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;

template<typename T1, typename T2>
ostream &operator<<(ostream &out, const pair<T1, T2> &p) {
  out << "{" << p.first << ", " << p.second << "}";
  return out;
}

template<typename T>
ostream &operator<<(ostream &out, const vector<T> &v) {
  out << '{';
  for (const T &item : v) out << item << ", ";
  out << "\b\b}";
  return out;
}
#endif

#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 200010


int main() {
  char S[SIZE];
  int K;
  ll dp[101][5][2] = {};


  scanf("%s%d", S, &K);

  int N = strlen(S);

  dp[0][0][0] = 1;

  for (int i=0; i<N; i++) {
    for (int j=0; j<10; j++) {
      for (int k=0; k<=3; k++) {
        if (S[i]-'0' > j) {
          dp[i+1][k+(j!=0)][1] += dp[i][k][1] + dp[i][k][0];
        } else if (S[i]-'0' == j) {
          dp[i+1][k+(j!=0)][0] += dp[i][k][0];
          dp[i+1][k+(j!=0)][1] += dp[i][k][1];
        } else {
          dp[i+1][k+(j!=0)][1] += dp[i][k][1];
        }
      }
    }
  }

  cout << dp[N][K][0] + dp[N][K][1] << endl;

  return 0;
}


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

int main(int argc, char *argv[])
{
  char W[10 + 1];
  char T_buf[1000 + 3];
  int appear = 0;

  scanf("%s", W);

  while (1) {
    scanf("%s", T_buf);
    if (!strcmp(T_buf, "END_OF_TEXT")) break;

    if (!strcasecmp(T_buf, W)) appear++;
  }

  printf("%d\n", appear);

  return 0;
}

Measured memory_bytes: 556
A = [0]*3
for i in range(0,3):
    A[i] = list(map(int, input().split()))
N = int(input())
b = [int(input()) for i in range(N)]
 
c = 0
while c < N:
    for i in range(0,3):
      for j in range(0,3):
        if b[c] == A[i][j]:
          A[i][j] = 0
    c += 1
            
 
hoge = [0]*3                
for i in range(0,3):
  for j in range(0,3):
    hoge[i] += A[i][j]#横
 
fuga = [0]*3
for i in range(0,3):
  for j in range(0,3):
    fuga[i] += A[j][i]
    
 
hogehoge = A[0][0] + A[1][1] + A[2][2]
fugafuga = A[0][2] + A[1][1] + A[0][2]
 
if hoge[0] == 0:
    print("Yes")
elif hoge[1] == 0:
    print("Yes")
elif hoge[2] == 0:
    print("Yes")
elif fuga[0] == 0:
    print("Yes") 
elif fuga[1] == 0:
    print("Yes") 
elif fuga[2] == 0:
    print("Yes") 
elif hogehoge == 0:
  print("Yes")
elif fugafuga == 0:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 3064
S = input()
T = input()

ans = 10 ** 5

sl = len(S)
tl = len(T)

for i in range(sl-tl+1):
    cnt = 0
    for j in range(tl):
        if S[i+j] == T[j]:
            continue
        cnt += 1
    ans = min(ans, cnt)

print(ans)

Measured memory_bytes: 8984
#include <cstdio>
#include <iostream>
#include <vector>
#include <queue>
#include <string>
#include <utility>
#include <map>
#include <set>
#include <algorithm>

#define REP(i, a, b) for (int i=a; i <b; i++)
#define F first
#define S second

using namespace std;

typedef long long ll;
typedef vector< int > vi;

int main() {
    int a, b;
    cin >> a >> b;
    int pro = a*b;
    if (pro % 2 == 0) {
        printf("Even\n");
    } else {
        printf("Odd\n");
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ls rt<<1
#define rs rt<<1|1
#define lson rt<<1,l,M
#define rson rt<<1|1,M+1,r
#define PI acos(-1)
#define MM int M=(l+r)>>1;
#define fu(i,r,t) for(int i=r;i<=t;i++)
#define fd(i,r,t) for(int i=r;i>=t;i--)
#define fh(i,be,e) for(int i=head[be];~i;i=e[i].next)
#define fa(i,V) for(auto i:V)
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long
#define endl '\n'
#define lcm(a,b) (a*b)/__gcd(a,b)
#define cp(i,ans) printf("%.if",ans);
#define cpp(i,ans) cout<<setprecision(i)<<fixed<<ans<<endl;
#define ppb pop_back
#define ppf pop_front
#define pb push_back
#define pf push_front
#define pq priority_queue
#define lowbit(x) (x)&(-x)
#define all(V) V.begin(),V.end()
#define ms multiset
#define mod(x) ((x+mo_num)%mo_num)
#define vc vector
#define vct vector<int>
#define out(i) cout<<(i)<<endl;
#define fi first
#define se second
#define fun(i) fu(i,1,n)
#define fut(i) fu(i,1,t)
#define fum(i) fu(i,1,m)
#define ld long double
#define umap unordered_map
#define P pair<int,int>
#define SET set<int>
#define mp map<int,int>
#define mk make_tuple
#define low lower_bound
#define upp upper_bound
#define yn(key) out(key?"YES":"NO")
#define in(i) i+1,i+1+n
#define im(i) i+1,i+1+m
#define bffs(i) __builtin_ffs(i)
#define bcount(i) __builtin_popcount(i)
#define bone(i) ((1<<i)-1)
using namespace std;
const int INF=LLONG_MAX/2;
const int dx[]={0,0,-1,1},dy[]={-1,1,0,0};//up down left right
const int maxn=1e6+1e5;
const int mo_num=1e9+7;
int n,m,t,a[maxn],b[maxn],ans;
queue<P>have;
vct e[maxn];
main()
{
    IOS
    cin>>n>>m;
    fum(i)
    {
        int u,v;
        cin>>u>>v;
        e[u].pb(v);
        e[v].pb(u);
    }
    have.push({1,0});
    while(!have.empty())
    {
        P tp=have.front();
        have.pop();
        if(a[tp.fi])continue;
        b[tp.fi]=tp.se;
        a[tp.fi]=1;
        fa(i,e[tp.fi])
        {
            if(a[i])continue;
            have.push({i,tp.fi});
        }
    }
    out("Yes")
    fu(i,2,n)out(b[i])
    return 0;
}

Measured memory_bytes: 38456
#include <bits/stdc++.h>
#define M_PI_2 1.57079632679489661923
#define ll long long int
#define endl '\n'
using namespace std;

void solve()
{
  int n;
  cin>>n;
  n%=10;
  if(n==2 || n==4 || n==5 || n==7 || n==9)
    cout<<"hon"<<endl;
  else if(n==0 || n==1 || n==6 || n==8)
    cout<<"pon"<<endl;
 else 
    cout<<"bon"<<endl;

}    

int main() 
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    solve();
    return 0;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
       
using namespace std;
typedef long long ll;
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; }

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

  vector<int> lindex(10, N - 1), rindex(10, 0);
  vector<vector<int>> T(N + 1, vector<int>(10, 0));
  for (int i = 0; i < (int)(N); ++i) {
    int s = S[i] - '0';
    chmin(lindex[s], i);
    chmax(rindex[s], i);
    for (int j = 0; j < (int)(10); ++j) T[i + 1][j] = T[i][j] + (j == s);
  }

  int ans = 0;
  for (int l = 0; l < (int)(10); ++l) for (int r = 0; r < (int)(10); ++r) for (int k = 0; k < (int)(10); ++k) {
    ans += (T[rindex[r]][k] - T[lindex[l] + 1][k] > 0);
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 2432
using System;
class Program
{
  static void Main()
  {
    string[] LR = Console.ReadLine().Split(' ');
    long L = long.Parse(LR[0]);
    long R = long.Parse(LR[1]);
    long ans = 2019;
    
    if (R - L >= 2018)
    {
      ans = 0;
    }
    else{
      long L_mod = (L % 2019);
      long R_mod = (R % 2019);
      if(L_mod > R_mod)
      {
        ans = 0;
      }
      else
      {
        for (long i = L_mod; i <= R_mod - 1; i++)
        {
          for (long j = i + 1; j <= R_mod; j++)
          {
            long m = (i * j) % 2019;
            ans = Math.Min(ans, m);
          }
        }
      }
    }
    
    Console.WriteLine(ans);
    
  }
}

Measured memory_bytes: 11092
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;
import java.util.Collections;
import java.util.Arrays;
import java.lang.Math;

public class Main {
	static final int MOD = 1000000007;
	public static void main(String[] args) {
		FS reader = new FS();
		// write reader
		int N = reader.nextInt();
		int M = reader.nextInt();
		int[] A = new int[N+1];
		for(int i=0; i<N+1; i++) A[i] = 1;
		for(int i=0; i<M; i++) A[reader.nextInt()] = 0;

		solver(N, M, A);
	}
	
	public static void solver(int N, int M, int[] A) {
		// write logic
		int[] DP = new int[N+1];
		DP[0] = 1;
		DP[1] = 1;
		
		for(int i=2; i<=N; i++) {
		    DP[i] = (DP[i-1]*A[i-1]+DP[i-2]*A[i-2])%MOD;
		}
		System.out.println(DP[N]);
	}
	
	// Read Class
	static class FS {
		private final InputStream in = System.in;
		private final byte[] buffer = new byte[1024];
		private int ptr = 0;
		private int buflen = 0;
		private boolean hasNextByte() {
			if (ptr < buflen) {
				return true;
			} else {
				ptr = 0;
				try {
					buflen = in.read(buffer);
				} catch (IOException e) {
					e.printStackTrace();
				}
				if (buflen <= 0) {
					return false;
				}
			}
			return true;
		}
	
		private int readByte() { return hasNextByte() ? buffer[ptr++] : -1;}
		private boolean isPrintableChar(int c) {return 33 <= c && c <= 126;}
		private void skipUnprintable() {while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;}
	
		public boolean hasNext() { skipUnprintable(); return hasNextByte();}
		public String next() {
			if (!hasNext()) throw new NoSuchElementException();
			StringBuilder sb = new StringBuilder();
			int b = readByte();
			while(isPrintableChar(b)) {
				sb.appendCodePoint(b);
				b = readByte();
			}
			return sb.toString();
		}
		public int nextInt() {
			return (int)nextLong();
		}
		public long nextLong() {
			if (!hasNext()) throw new NoSuchElementException();
			long n = 0;
			boolean minus = false;
			int b = readByte();
			if (b == '-') {
				minus = true;
				b = readByte();
			}
			if (b < '0' || '9' < b) {
				throw new NumberFormatException();
			}
			while(true) {
				if ('0' <= b && b <= '9') {
					n *= 10;
					n += b - '0';
				} else if(b == -1 || !isPrintableChar(b)) {
					return minus ? -n : n;
				} else {
					throw new NumberFormatException();
				}
				b = readByte();
			}
		}
	}
}


Measured memory_bytes: 24396
#include <iostream>
#include <algorithm>
#include <iterator>
#include <numeric>
#include <vector>
#include <cstdlib>

using namespace std;

int main() {
  int N;
  cin >> N;
  vector<int> P(N), Q(N), R(N);
  copy_n(istream_iterator<int>(cin), N, P.begin());
  copy_n(istream_iterator<int>(cin), N, Q.begin());
  int a, b, n;
  a = b = 0;
  n = 1;
  iota(R.begin(), R.end(), 1);
  do {
    if (a == 0) {
      if (P == R) a = n;
    }
    if (b == 0) {
      if (Q == R) b = n;
    }
    ++n;
  } while (next_permutation(R.begin(), R.end()));
  cout << abs(b - a) << endl;
  return 0;
}


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

using namespace std;

typedef long long ll;

ll gcd(ll a, ll b) {
    ll maxv = max(a,b);
    ll minv = min(a,b);

    if(maxv % minv == 0) return minv;
    else return gcd(maxv - minv, minv);
}
int main() {
    ll A, B;

    cin >> A >> B;

    ll gcd_value = gcd(A, B);
    ll gcd_value_2 = gcd_value;
    ll root = (ll)sqrt(gcd_value);
    ll ret = 1; //約数1の分
    if(gcd_value % 2 == 0) {
        ret += 1;
        while(gcd_value % 2 == 0) gcd_value /= 2;
    }
    for(ll i = 3; i*i <= gcd_value_2; i+=2 ) {
        if (gcd_value % i == 0) {
            ret += 1;
            while(gcd_value % i == 0) gcd_value /= i;
        }
    }
    if (gcd_value != 1) ret++;



    cout << ret ;
}

Measured memory_bytes: 256
def main():
    n, m = map(int,input().split())
    s = input()
    t = input()

    l = n * m // gcd(n,m)

    nlist = [0 for i in range(n)]
    mlist = [0 for i in range(m)]
    for i in range(n):
        nlist[i] =  i*l//n

    for i in range(m):
        mlist[i] =  i*l//m

    src_set = set(nlist)
    tag_set = set(mlist)
    matched_list = list(src_set.intersection(tag_set))

    for i in matched_list:
        s_index = nlist.index(i)
        t_index = mlist.index(i)

        if s[s_index] != t[t_index]:
            print("-1")
            exit()

    print(l)

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

if __name__ == "__main__":
        main()


Measured memory_bytes: 55408
#include <stdio.h>
#include <queue>
#include <vector>
#include <utility>
using namespace std;
typedef pair<int,int> pii;
vector<pii> arr[16];
int chk[16];
int main(){
	int N;scanf("%d",&N);
	for(int i=1;i<=N;i++){
		int s;scanf("%d",&s);
		while(s--){
			int a,b;
			scanf("%d %d",&a,&b);
			arr[i].push_back({a,b});
		}
	}
	int ans = 0;
	for(int s=0;s<(1<<N);s++){
		queue<int> q;
		int cnt = 0;
		for(int i=1;i<=N;i++){
			chk[i]=1<<((s&(1<<(i-1)))>0?1:0);
			if(chk[i]&2){
				q.push(i);
				cnt++;
			}
		}
		while(!q.empty()){
			int x = q.front();
			//printf("%d\n",x);
			q.pop();
			for(auto node : arr[x]){
				int nx = node.first;
				//if(node.second && (chk[nx]&2) == 0) q.push(nx);
				chk[nx]|=1<<node.second;
			}
		}
		bool isok=true;
		for(int i=1;i<=N;i++) isok&=chk[i]!=3;
		if(isok&&cnt>ans) ans=cnt; 
	}
	printf("%d",ans);
}

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

using namespace std;

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()
#define F first
#define S second
#define forn(i, n) for (int i = 0; i < (int)n; i++)
#define pb push_back
#define fastIO ios::sync_with_stdio(0), cin.tie(0)
#define endl '\n'
typedef long long ll;
typedef double lf;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

int main() {
#ifdef LOCAL
    freopen("in.txt", "r", stdin);
    // freopen("out.txt", "w", stdout);
#else
    fastIO;
#endif
    int n;
    cin>>n;
    vector<int> v(n);
    forn(i,n)cin>>v[i];
    ll sum=0;
    for(int i=0;i<n-1;i++){
        for(int j=i+1;j<n;j++){
            sum+=v[i]*v[j];
        }
    }
    cout<<sum<<endl;
    return 0;
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
#define int long long

using namespace std;

signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n, k;
    cin >> n >> k;
    vector <int> data(n);
    for (int i = 0; i < n; ++i) cin >> data[i];
    for (int i = 0; i < n; ++i) --data[i];
    vector <int> used(n, 0);
    int ans = 0;
    int cur_n = 1;
    while (k > 0) {
        if (used[ans] == 0) {
                //cout << ans << " " << cur_n << " " << k << endl;
            used[ans] = cur_n;
            ++cur_n;
            ans = data[ans];
            --k;
        }
        else {
                //cout << k << endl;
            int leng = cur_n - used[ans];
        //cout << leng << endl;
            k = k % leng;
            if (k < 0) k += leng;
        //cout << k << endl;
            while (k > 0) {
                ans = data[ans];
                --k;
            }
        }
    }
    cout << ans + 1;
    return 0;
}



Measured memory_bytes: 6360
def main():
    import sys
    input = sys.stdin.readline
    N = int(input())
    A = list(map(int, input().split()))
    x = A[0]
    for a in A[1:]:
        x ^= a
    ans = []
    for a in A:
        ans.append(str(x^a))
    print(" ".join(ans))

if __name__ == '__main__':
    main()

Measured memory_bytes: 104628
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <cstring>
#include <cmath>
#include <climits>
#include <ctime>
#include <fstream>
#include <functional>
#define endl '\n'
#define ll long long
#define mod 1000000007
#define NCONS 200001
//#define NCONS 100001
//#define NCONS 1001
//#define NCONS 101
#define MCONS 2001
#define LIMIT 1000000000
#define TRUE 1
#define FALSE 0
#define toRadian(degree) ((degree) * (M_PI / 180.))
#define toDegree(radian) ((radian) * (180. / M_PI))
using namespace std;
struct Point{int x; int y;};
struct PPoint{Point x; Point y;};
ll gcd(ll a, ll b) { if(a < b) swap(a, b); if(b <= 0) return a; return gcd(b, a % b); }

int main(void)
{
    cin.tie(NULL); ios_base::sync_with_stdio(false);
    string s; cin >> s;
    bool flag = false;
    
    for(int i = 0; i <= 2; i++)
        if(s[i] == s[i+1])
            flag = true;
    if(flag) cout << "Bad";
    else cout << "Good";
    
    
    
    
    
    return 0;
}


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

namespace _0510
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] A = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int[] B = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int S = A[0] + A[1] + A[2] + A[3];
            int T = B[0] + B[1] + B[2] + B[3];
            if (S < T)
            {
                Console.WriteLine(T);
            }
            else if (S == T)
            {
                Console.WriteLine(S);
            }
            else
            {
                Console.WriteLine(S);
            }
        }
    }
}

Measured memory_bytes: 9456
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll mod1=998244353;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  char X, Y;
  cin>>X>>Y;
  if(X<Y) cout<<"<"<<endl;
  else if(X>Y) cout<<">"<<endl;
  else cout<<"="<<endl;
}



Measured memory_bytes: 3520
#include <bits/stdc++.h>
#define mod 9929
#define inf 1e18
#define endl '\n'
#define eps 1e-9
#define zeros(x) ((x)&(-x))
#define nmax 100000

using namespace std;

typedef long long ll;
typedef long double ld;

string s[] = {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};
string n;
int wh;

int main()
{
    //freopen("input.txt", "r", stdin);
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    cin>>n;
    for (int i=0; i<7; i++)
    {
        if (n == s[i])
            wh = i;
    }

    cout<<7-wh;
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define repl(i, l, r) for (ll i = (l); i < (r); i++)
#define rep(i, n) repl(i, 0, n)
#define CST(x) cout << fixed << setprecision(x)
using ll = long long;
const ll MOD = 1000000007;
const int inf = 1e9 + 10;
const ll INF = 4e18 + 10;
const int dx[9] = {1, 0, -1, 0, 1, -1, -1, 1, 0};
const int dy[9] = {0, 1, 0, -1, 1, 1, -1, -1, 0};
int main() {
	cin.tie(0);
	cout.tie(0);
	ios::sync_with_stdio(false);

	int n;
	cin >> n;
	int a[n][2];
	rep(i, n) cin >> a[i][0] >> a[i][1];
	vector<int> cnt(n);
	rep(i, n - 2) {
		bool f = true;
		rep(j, 3) {
			if (a[i + j][0] != a[i + j][1]) f = false;
		}
		if (f) {
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;

	return 0;
}

Measured memory_bytes: 3664
a,b,x = map(int,input().split())
c = 2*((b/a)-(x/(a**3)))
d = ((b**2)*(a))/(2*x)

import math

if a*b/2 <= x/a:
    print(math.degrees(math.atan(c)))
else:
    print(math.degrees(math.atan(d)))

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

#define rep(i,x,y) for(int i=(x);i<(y);++i)
#define debug(x) #x << "=" << (x)

#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define print(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define print(x)
#endif

const int inf=1e9;
const int64_t inf64=1e18;
const double eps=1e-9;

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){
    os << "[";
    for (const auto &v : vec) {
    	os << v << ",";
    }
    os << "]";
    return os;
}

void solve(int n){
    vector<pair<int,int>> times;
    rep(i,0,n){
        int s,t,u;
        cin >> s >> t >> u;
        vector<int> v({s,t,u}),perm({0,1,2});
        do{
            rep(j,0,60){
                int x=(v[perm[0]]+j)%60,y=(v[perm[1]]+j)%60,z=(v[perm[2]]+j)%60;
                if(x%5!=y/12) continue;
                x/=5;
                times.push_back(make_pair(x*3600+y*60+z,i));
            }
        }while(next_permutation(perm.begin(),perm.end()));
    }
    sort(times.begin(),times.end());

    auto format=[](int t){
        string h=to_string(t/3600);
        if(h.size()==1) h="0"+h;
        string m=to_string(t%3600/60);
        if(m.size()==1) m="0"+m;
        string s=to_string(t%60);
        if(s.size()==1) s="0"+s;
        return h+":"+m+":"+s;
    };
    int min_interval=inf;
    pair<string,string> ans;
    rep(i,0,times.size()){
        vector<bool> f(n);
        int count=0;
        rep(j,i,times.size()){
            if(!f[times[j].second]) ++count;
            f[times[j].second]=true;
            if(count==n and times[j].first-times[i].first<min_interval){
                min_interval=times[j].first-times[i].first;
                ans.first=format(times[i].first);
                ans.second=format(times[j].first);
            }
        }
    }
    cout << ans.first << " " << ans.second << endl;
}

int main(){
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(10);
    for(;;){
        int n;
        cin >> n;
        if(!n) break;
        solve(n);
    }
    return 0;
}

Measured memory_bytes: 3284