akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;
    using namespace std;
 
    int main(){
      string a,b,c;
      cin >> a >> b >> c;
      if(a[a.size()-1]==b[0] && b[b.size()-1]==c[0]) cout << "YES" << endl;
      else cout << "NO" << endl;
      return 0;}

Measured memory_bytes: 256
import java.util.Scanner;


public class Main {
	public static void main(String[] args) {
		int N,D,ans=0;
		Scanner sc = new Scanner(System.in);
		D=sc.nextInt();//何日間の予定をたてるか
		N=sc.nextInt();//何枚の服を所持しているか
		int temperature[]=new int[D];
		int min[]=new int[N];
		int max[]=new int[N];
		int show[]=new int[N];
		int showreminder[][]=new int[D][N];
		for(int i=0;i<D;i++){
			temperature[i]=sc.nextInt();
		}
		for(int j=0;j<N;j++){
			min[j]=sc.nextInt();
			max[j]=sc.nextInt();
			show[j]=sc.nextInt();
		}
		
		
		for(int i=1;i<D;i++){
			for(int j=0;j<N;j++){
				if(min[j]<=temperature[i]&&max[j]>=temperature[i]){
					for(int k=0;k<N;k++){
						if(min[k]<=temperature[i-1]&&max[k]>=temperature[i-1]){
							if(showreminder[i][j]<showreminder[i-1][k]+Math.abs(show[k]-show[j])){
								showreminder[i][j]=showreminder[i-1][k]+Math.abs(show[k]-show[j]);
							}
						}
					}
				}
			}
		}
		for(int i=0;i<N;i++){
			if(ans<showreminder[D-1][i]){
				ans=showreminder[D-1][i];
			}
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 22152
from itertools import accumulate

n, k = list(map(int, input().split()))
s = input()


def solve():
    l = []
    prev = '1'
    cnt = 0
    for c in s:
        if prev == c:
            cnt += 1
        else:
            l.append(cnt)
            cnt = 1
        prev = c
    l.append(cnt)
    if prev == '0':
        l.append(0)

    w = 2 * k + 1

    if len(l) <= w:
        return n

    acc = [0] + list(accumulate(l))
    ans = 0
    for i in range(0, len(l) - w + 1, 2):
        ans = max(ans, acc[i + w] - acc[i])
    return ans


print(solve())


Measured memory_bytes: 8700
def hantei(X):
      if X <= 1:
          return False
      for i in range(2, int(X**0.5)):
          if X%i == 0:
              return False
      return True

X = int(input())

while True:
    if (hantei(X)):
        print(X)
        break
    else:
        X += 1


Measured memory_bytes: 38384
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
#define ordered_set tree < pairs ,  null_type , greater<pairs>,  rb_tree_tag ,  tree_order_statistics_node_update > 
#define ll long long
#define lld long double
#define vc vector<ll>
const ll MOD=(1e9 +7);
typedef pair<ll,ll>pairs;
ll power(ll a, ll b){ll res=1;a=a%MOD;while(b>0){if(b&1){res=(res*a)%MOD;b--;}a=(a*a)%MOD;b>>=1;}
    return res;}

int main() {
	// your code goes here
	std::ios::sync_with_stdio(false);
	ll t,n,i,j,k,l,c,f;
	cin>>i>>j>>k;
	if(k<j)
	    i*=k;
	else
	    i*=(j-1);
	cout<<(i/j);
	return 0;
}


Measured memory_bytes: 3660
#include<iostream>
#include<vector>
#include<cmath>

using namespace std;

const int INF = 1e8;

int main(){
  int N;
  vector<int>vec;
  cin >> N;

  int mini = INF;
  int mini_pos = -1;

  int maxi = -INF;
  int maxi_pos = -1;

  for(int i = 0 ; i < N ; i++){
    int tmp;
    cin >> tmp;
    vec.push_back(tmp);

    if(mini > tmp){
      mini = tmp;
      mini_pos = i+1;
    }

    if(maxi < tmp){
      maxi = tmp;
      maxi_pos = i+1;
    }
  }

  if(abs(mini) < abs(maxi)){
    // +
    cout << 2*N << endl;
    cout << maxi_pos << ' ' << 1 << endl;
    cout << maxi_pos << ' ' << 1 << endl;
    for(int i = 2 ; i <= N ; i++){
      cout << i-1 << ' ' << i << endl;
      cout << i-1 << ' ' << i << endl;
    }
  }
  else {
    // -
    cout << 2*N << endl;
    cout << mini_pos << ' ' << N << endl;
    cout << mini_pos << ' ' << N << endl;
    for(int i = N-1 ; i >= 1 ; i--){
      cout << i+1 << ' ' << i << endl;
      cout << i+1 << ' ' << i << endl;
    }
  }
  return 0;
}


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

int main(){
    int n, k;
    cin >> n >> k;
    int ans = k;
    n--;
    while(n--){
        ans *= k-1;
    }
    cout << ans << endl;
}


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

int main(){
    int L;
    cin >> L;

    int a[1000];
    for(int i=1;i<=L;i++){
        cin >> a[i];
    }

    int b[101]; // 猫のスタック位置
    for(int i=1; i<=100; i++){ 
        b[i] = -1;
    }
    int sp = 0;

    for(int i=1;i<=L;i++){
        if(a[i]>0){
            if(b[a[i]]==-1){
                b[a[i]]=sp;
                sp++;
            }
            else{
                cout << i << endl;
                return 0;
            }
        }
        else{
            if(sp>0 && b[-a[i]]==sp-1){
                b[-a[i]]=-1;
                sp--;
            }
            else{
                cout << i << endl;
                return 0;
            }
        }
    }
    cout << "OK" << endl;
    return 0;
}


Measured memory_bytes: 3128
#include <iostream>
#include <math.h>
#include <string.h>
using namespace std;
string a[4]={"AC","WA","TLE","RE"};
int main(int argc, char const *argv[])
{
	int n;
	string str;
	int ans[4]={0};
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>str;
		for(int j=0;j<4;j++){
			if(str==a[j]){
				ans[j]++;
			}
		}
	}
	for(int i=0;i<4;i++){
		cout<<a[i]<<" x ";
		cout<<ans[i]<<endl;
	}
	return 0;
}

Measured memory_bytes: 3624
#include<iostream>
using namespace std;
int main()
{
    int n,sum=0,arr[100000];
    cin>>n;
    for(int i=1;i<=n;i++)
        cin>>arr[i];
    for(int i=1;i<=n;i++)
    {
        if(arr[i]==i)
        {
            int combo=0;
            for(int j=i;arr[j]==j;j++)
                combo++;
            if(combo%2==0)
                sum+=combo/2;
            else
                sum+=combo/2+1;

            i += combo-1;
        }
    }
    cout<<sum<<endl;
}


Measured memory_bytes: 640
//=template==================================================================//
// include
#include <vector>
#include <list>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <string>

// namespace
using namespace std;

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

// typedef
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef long long LL;

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

//=function prototype========================================================//

//===========================================================================//

//=variables=================================================================//

//===========================================================================//
int main(void)
{
  // Scan begin.
  int d, n, i;
  cin >> d >> n;
  // Scan done.

  // Code begin.
  if (n==100) {
    cout << 101;
  }
  else {
    cout << n;
  }
  FOR (i, 0, d) {
    cout << "00";
  }
  cout << endl;
  // Code done.

  return 0;
}

//=functions=================================================================//

//===========================================================================//

Measured memory_bytes: 768
package main

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

var sc = bufio.NewScanner(os.Stdin)

func oneInt() int {
	var a int
	fmt.Scan(&a)
	return a
}

func oneInt64() int64 {
	var a int64
	fmt.Scan(&a)
	return a
}

func oneStr() string {
	var a string
	fmt.Scan(&a)
	return a
}

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

func scanNums() (nums []int) {
	s := nextLine()
	numStr := strings.Split(s, " ")

	for _, n := range numStr {
		i, _ := strconv.Atoi(n)
		nums = append(nums, i)
	}
	return nums
}

func scanStrings() (strs []string) {
	s := nextLine()
	list := strings.Split(s, " ")
	strs = append(strs, list...)
	return strs
}

func abs(a int) int {
	return int(math.Abs(float64(a)))
}

func pow(p, q int) int {
	return int(math.Pow(float64(p), float64(q)))
}

func min(nums ...int) int {
	if len(nums) == 0 {
		panic("funciton min() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Min(float64(res), float64(nums[i])))
	}
	return res
}

func max(nums ...int) int {
	if len(nums) == 0 {
		panic("funciton max() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Max(float64(res), float64(nums[i])))
	}
	return res
}

func strSearch(a []string, b string) bool {
	for i := 0; i < len(a); i++ {
		if a[i] == b {
			return true
		}
	}
	return false
}

func sortAsc(a []int) []int {
	sort.Ints(a)
	return a
}

func sortDesc(a []int) []int {
	sort.Sort(sort.Reverse(sort.IntSlice(a)))
	return a
}

func gcd(a, b int) int {
	if b == 0 {
		return a
	}
	return gcd(b, a%b)
}

func lcm(a, b int) int {
	if a == 0 && b == 0 {
		return 0
	}
	return a * b / gcd(a, b)
}

func permutation(n int, k int) int {
	v := 1
	if 0 < k && k <= n {
		for i := 0; i < k; i++ {
			v *= (n - i)
		}
	} else if k > n {
		v = 0
	}
	return v
}

func factorial(n int) int {
	return permutation(n, n-1)
}

func combination(n int, k int) int {
	return permutation(n, k) / factorial(k)
}

func homogeneous(n int, k int) int {
	return combination(n+k-1, k)
}

type key struct {
	k1, k2 int
}

var table map[key]int

func main() {
	N := oneInt()
	activity := make(map[key]int)
	table = make(map[key]int)

	for index := 0; index < N; index++ {
		activity[key{index, 0}] = oneInt()
		activity[key{index, 1}] = oneInt()
		activity[key{index, 2}] = oneInt()
	}

	for day := 0; day < N; day++ {
		for k := 0; k < 3; k++ {
			for j := 0; j < 3; j++ {
				if k == j {
					continue
				}
				table[key{day + 1, j}] = max(table[key{day + 1, j}], table[key{day, k}]+activity[key{day, j}])
			}
		}
	}

	res := max(table[key{N, 0}], table[key{N, 1}], table[key{N, 2}])
	fmt.Print(res)
}


Measured memory_bytes: 51968
//#include <bits/stdc++.h>
#include <iostream>
#define ios ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;


int main()
{
    int x; cin >> x;
    if(x == 1) cout << 0 << endl;
    else cout << 1 << endl;
    return 0;
}


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

int main(void){
  char s[101];
  scanf("%s",s);
  for(int i=0;i<strlen(s);i++){
    if(i%2==0 && s[i]=='L'){
      printf("No");
      return 0;
    }
    else if(i%2==1 && s[i]=='R'){
      printf("No");
      return 0;
    }
  }
  printf("Yes");
  return 0;
}
      
      
      
      


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

int main() {
  long N, K;
  cin >> N >> K;
  vector<long> an;
  for (long i = 0; i < N; i++) {
    long tmp = 0;
    cin >> tmp;
    an.push_back(tmp);
  }

  long bitCount[65] = {};
  for (long a : an) {
    long i = 1;
    while (a != 0) {
      long d = a % 2;
      bitCount[i] += d;
      a /= 2;
      i++;
    }
  }

  // 0 <= X <= K
  long K2 = K;
  long kbit = 0;
  while (K2 != 0) {
    K2 /= 2;
    kbit++;
  }
  long X = 0;
  for (long i = kbit; i >= 1; i--) {
    long lastBit = 0;
    if (bitCount[i] <= N / 2) {
      long nextVal = (2 * X + 1) << (i - 1);
      if (nextVal <= K) {
        lastBit = 1;
      }
    }
    X = 2 * X + lastBit;
  }

  long fMax = 0;
  for (long i = 0; i < N; i++) {
    fMax += X ^ an[i];
  }
  cout << fMax << endl;

  return 0;
}

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

template<class T> void vin(vector<T>& v, int n) {
    v.resize(n);
    for (int i = 0; i < n; ++i) {
        cin >> v[i];
    }
}

int H, W;
int dr[] = { 1, 0, -1, 0 };
int dc[] = { 0, 1, 0, -1 };
bool ok(int r, int c) {
    return 0 <= r and r < H and 0 <= c and c < W;
}

int main() {
    cin >> H >> W;
    string b[51], b2[51];;
    rep(i, H) cin >> b[i];
    rep(r, H) {
        string tmp = "";
        rep(c, W) tmp += ".";
        b2[r] = tmp;
    }
    rep(r, H) rep(c, W) {
        if (b[r][c] == '#') {
            rep(d, 4) {
                int nr = r + dr[d], nc = c + dc[d];
                if (!ok(nr, nc)) continue;
                if (b[nr][nc] == '#') {
                    b2[r][c] = b2[nr][nc] = '#';
                }
            }
        }
    }
    bool ok = true;
    rep(r, H) {
        if (b[r] != b2[r]) {
            ok = false;
            break;
        }
    }
    cout << (ok ? "Yes" : "No") << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <math.h> 
#include <string>
#include <iomanip>
using namespace std;
int main(){
   int n;
   string s;
   cin >> n >> s;
   int r = 0;
   int b = 0;
   for(int i = 0; i < n; i++){
       if(s[i] == 'R') r++;
       else b++;      
   }

   if(r > b) cout << "Yes" << endl;
   else cout << "No" << endl;
}

Measured memory_bytes: 256
//#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define trav(x,a) for (const auto& x: a)
#define sz(x) (int)(x).size()
#define mem(a,v) memset((a), (v), sizeof (a))
#define enl printf("\n")
#define case(t) printf("Case #%d: ", (t))
#define ni(n) scanf("%d", &(n))
#define nl(n) scanf("%lld", &(n))
#define nai(a, n) for (int _i = 0; _i < (n); _i++) ni(a[_i])
#define nal(a, n) for (int _i = 0; _i < (n); _i++) nl(a[_i])
#define pri(n) printf("%d\n", (n))
#define prl(n) printf("%lld\n", (n))
#define pii pair<int, int>
#define pll pair<long long, long long>
#define vii vector<pii>
#define vll vector<pll>
#define vi vector<int>
#define vl vector<long long>
#define pb push_back
#define mp make_pair
#define st first
#define nd second
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef cc_hash_table<int,int,hash<int>> ht;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> oset;
const double pi = acos(-1);
const int mod = 1e9 + 7;
const int inf = 1e9 + 7;
const int N = 1e6 + 5;
const double eps = 1e-9;
int a[N], b[N], dp[N][20], p[N];

int f(int i, int j) {
  return (p[i>>(j+1)]+max(0,j+p[i>>(j+1)]-p[i^(1<<j)])) % 2 == 1 ? b[j] : a[j];
}

int main() {
  for (int i = 0; i < (1<<18); i++)
    p[i] = p[i>>1] + (i&1);
  int n; ni(n);
  for (int i = 0; i < n; i++)
    scanf("%d", a+i);
  for (int i = 0; i < n; i++)
    scanf("%d", b+i);
  mem(dp, 0x3f);
  for (int i = 0; i < n; i++)
    dp[1<<i][i] = i;
  for (int i = 0; i < (1<<n); i++) {
    if (p[i] <= 1)
      continue;
    for (int j = 0; j < n; j++) if ((i>>j)&1) {
      int v1 = f(i, j);
      for (int k = 0; k < n; k++) if (k != j && ((i>>k)&1)) {
        if (f(i^(1<<j), k) <= v1)
          dp[i][j] = min(dp[i][j], dp[i^(1<<j)][k] + max(0,j+p[i>>(j+1)]-p[i^(1<<j)]));
      }
    }
  }
  int ans = 0x3f3f3f3f;
  for (int i = 0; i < n; i++)
    ans = min(ans, dp[(1<<n)-1][i]);
  if (ans == 0x3f3f3f3f)
    ans = -1;
  printf("%d\n", ans);
  return 0;
}


Measured memory_bytes: 85248
import java.util.Scanner;

public class Main {

	public static String Y = "Yes";
	public static String N = "No";
	public static long MOD = (long) (Math.pow(10, 9) + 7);
	public static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {

		int h1 = ni();
		int m1 = ni();
		int h2 = ni();
		int m2 = ni();
		int k = ni();

		out(h2 * 60 + m2 - h1 * 60 - m1 - k);

	}

	public static int count(String search, String text) {
		int nsearch = search.length();
		int ntext = text.length();
		int count = 0;

		for (int i = 0; i <= ntext - nsearch + 1; i++) {
			for (int j = i + nsearch - 1; j < ntext; j++) {
				if (search.equals(text.substring(i, j + 1))) {
					count++;
				}
			}
		}

		return count;
	}

	/*
	 * 以下メソッド集
	 */
	static int ni() {
		return sc.nextInt();
	}

	static long nl() {
		return sc.nextLong();
	}

	static double nd() {
		return sc.nextDouble();
	}

	static String n() {
		return sc.next();
	}

	static char[] nc() {
		return sc.next().toCharArray();
	}

	static int kaijo(int n) {
		if (n == 0 || n == 1) {
			return 1;
		} else {
			return n * kaijo(n - 1);
		}
	}

	static int fib(int n) {
		return (n == 1 || n == 0) ? n : fib(n - 2) + fib(n - 1);
	}

	static long lcm(long m, long n) {

		return m * n / gcd(m, n);
	}

	static int lcm(int m, int n) {

		return m * n / gcd(m, n);
	}

	static long gcd(long a, long b) {
		return (b == 0) ? a : gcd(b, a % b);
	}

	static int gcd(int a, int b) {
		return (b == 0) ? a : gcd(b, a % b);
	}

	static void out(String info) {
		System.out.println(info);
	}

	static void out(int info) {
		System.out.println(info);
	}

	static void out(double info) {
		System.out.println(info);
	}

	static void out(long info) {
		System.out.println(info);
	}

	static void out(char info) {
		System.out.println(info);
	}

	static void out(Object obj) {
		System.out.println(obj.toString());
	}

	static void outn(String info) {
		System.out.print(info);
	}

	static void outn(int info) {
		System.out.print(info);
	}

	static void outn(double info) {
		System.out.print(info);
	}

	static void outn(long info) {
		System.out.print(info);
	}

	static void outn(char info) {
		System.out.print(info);
	}

	static int max(int a, int b) {
		return Math.max(a, b);
	}

	static long max(long a, long b) {
		return Math.max(a, b);
	}

	static int min(int a, int b) {
		return Math.min(a, b);
	}

	static long min(long a, long b) {
		return Math.min(a, b);
	}
}

class XY {
	int h;
	int c;

	XY(int h, int c) {
		this.h = h;
		this.c = c;
	}
}


Measured memory_bytes: 35748
n, m, x = map(int, input().split())
c, a = [0] * n, [[] for _ in range(n)]
for i in range(n):
    s = list(map(int, input().split()))
    c[i] = s[0]
    a[i] = s[1:]
# bit全探索
ans = 10 ** 7  # INF
for i in range(2 ** n):
    score = [0] * m
    cost = 0
    for j in range(n):
        if i >> j & 1:
            cost += c[j]
            for k in range(m):
                score[k] += a[j][k]
    if len([i for i in score if i < x]) == 0:
        ans = min(ans, cost)
if ans == 10 ** 7:
    print(-1)
else:
    print(ans)


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

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

#define p_ary(ary,a,b,i) do { cout << "["; for (int (i) = (a);(i) < (b);++(i)) cout << ary[(i)] << ((b)-1 == (i) ? "" : ", "); cout << "]\n"; } while(0)
#define p_map(map,it) do {cout << "{";for (auto (it) = map.begin();;++(it)) {if ((it) == map.end()) {cout << "}\n";break;}else cout << "" << (it)->first << "=>" << (it)->second << ", ";}}while(0)

const ll mod = 1000000007;
// const ll mod = 998244353;

const int MAX_N = 200010;
ll fact[MAX_N],fact_inv[MAX_N],inv[MAX_N];

ll pow(ll a,ll b) {
    ll ret;
    if (b == 0) ret = 1;
    else if (b == 1) ret = a;
    else {
        ll c = pow(a,b/2);
        if (b%2) ret = (c*c)%mod*a%mod;
        else ret = c*c%mod;
    }
    return ret;
}

void create_table(int n) {
    fact[0] = 1;fact[1] = 1;
    for (int i = 2;i <= n;++i) fact[i] = fact[i-1]*i%mod;
    fact_inv[n] = pow(fact[n],mod-2);
    for (int i = n;i > 0;--i) fact_inv[i-1] = fact_inv[i]*i%mod;
    for (int i = 1;i <= n;++i) inv[i] = fact_inv[i]*fact[i-1]%mod;
}

ll combi(ll a, ll b) {
    return fact[a]*fact_inv[b]%mod*fact_inv[a-b]%mod;
}

int main() {
    int h,w,n;
    cin >> h >> w >> n;
    vector<P> b(n+1);
    vector<ll> dp(n+1,0);
    for (int i = 0;i < n;++i) cin >> b[i].first >> b[i].second;
    b[n] = P(h,w);
    sort(b.begin(),b.end());
    create_table(h+w);
    for (int i = 0;i < n+1;++i) {
        dp[i] = combi(b[i].first+b[i].second-2,b[i].first-1);
        for (int j = 0;j < i;++j) if (b[i].first >= b[j].first && b[i].second >= b[j].second) {
            dp[i] -= dp[j]*combi(b[i].first-b[j].first+b[i].second-b[j].second,b[i].first-b[j].first)%mod;
            dp[i] %= mod;
        }
    }
    cout << (dp[n]+mod)%mod << endl;
    return 0;
}

Measured memory_bytes: 4992
/*
DATE   : 17 th July
TASK   : 
STATUS : COMPLETED SUCCESSFULLY :)
LANG   : C++                 
*/


/*
        karmany evadhikaras te
        ma phalesu kadacana 
        ma karma-phala-hetur bhur
        ma re sango'stv akarmani (B.G.-2.47)
 
Translation:
        Lord Krsna to Arjuna.
You have a right to perform your prescribed duty, 
but you are not entitled to the fruits of action. 
Never consider yourself the cause of the results of your activities, 
and never be attached to not doing your duty.    
*/
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
const int N = 200005 + 10;
#define ld long double
#define PI 3.14159265358979323846
const int mod = 1e9+7;

void flash()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cout.setf(ios::fixed);
    cout.setf(ios::showpoint);
    cout.precision(12);
}

//3. Structure or classes
//3. Ends here

//1. Data structures declaration here
//1. Ends here

//2. Extra Functions here
//2. Ends here


void solve();
int32_t main()
{
    flash();
    int t;
    t = 1;
    //cin>>t;
    while(t--){
        solve();
    }
    return 0;
}

void solve()
{
    int n;
    cin>>n;
    int h[n];
    for(int i=0;i<n;i++){
        cin>>h[i];
    }
    //dp[k] = cost of reaching this stone from 0th stone
    vector<int>dp(n,1e9);
    dp[0]=0;
    for(int i=0;i<n;i++){
        if(i+2<n)dp[i+2]=min(dp[i]+abs(h[i+2]-h[i]),dp[i+2]);
        if(i+1<n)dp[i+1]=min(dp[i]+abs(h[i+1]-h[i]),dp[i+1]);
    }
    cout<<dp[n-1];
    return;
}

Measured memory_bytes: 4784
#include <stdio.h>
#include <math.h>

int main(void)
{
    float n, s[1000], m, variance, hensa, sum;
    int i;

    while(1){
        scanf("%f", &n);
        if(n == 0)  break;
        for(i = 0; i < n; i++)  scanf("%f", &s[i]);
        sum = 0;
        for(i = 0; i < n; i++)  sum += s[i];
        m = sum / n;
        variance = 0;
        for(i = 0; i < n; i++)  variance += (pow((s[i] - m), 2)) / n;
        hensa = sqrt(variance);
        printf("%f\n", hensa);
    }

    return (0);
}


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

using namespace std;
using ll =long long;
using db = double;
using vll = vector<long long>;

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
#define che(a,string) cout<<"//"<<string <<"=="<<(a)<<"//" <<endl;
#define SORT(a) sort((a).begin(),(a).end())
#define rSORT(a) reverse((a).begin(),(a).end())
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define leftunique(a) {SORT(a);(a).erase(unique((a).begin(),(a).end()),(a).end());}
//leftuniqueは配列から同じ要素のものを取り除く 例 4 6 2 1 3 4 1 2 なら 1 2 3 4 6 になる
#define debug(x)  cout << #x << " = " << (x) << endl;
bool IsInt(double a){int b = a/1;if(a==b){return true;}else {return false;}}
bool coY() {cout <<"Yes"<<endl;}
bool coN(){cout <<"No"<<endl;}
const int mod = 1e9 + 7;
const ll INF = 1LL << 60;
//ここから書き始める
//素因数分解をしたvecotrを返す。pair<素因数,その素因数の何乗か>  sizeは、素因数の個数
vector<pair<ll,int>> factorize(ll n){
	vector<pair<ll,int>> res;
	for( ll i = 2; i*i <= n; ++i){
		if(n%i) continue ; 
		res.emplace_back(i,0);
		while(n%i == 0){
			n /= i ;
			res.back().second++;
		}
	}
	if ( n != 1) res.emplace_back(n,1);
	return res;
}

int main()
{
	cout <<setprecision(10);
	 ll a, b;
	 cin >> a >> b;
	 ll k = __gcd(a,b);
	 auto V = factorize(k);
	 ll ans =V.size();
	 cout << ans+1 << endl;
}


Measured memory_bytes: 256
# include <iostream>
# include <cstdio>
# include <cstring>
# include <iomanip>
# include <algorithm>
# include <cmath>
# include <cstdlib>
using namespace std;
int d[1005];
int main ()
{
	int n, k, x, y, money;
	cin >> n >> k >> x >> y;
	if (n <= k) money = n * x;
	else if (n > k) money = k * x + (n - k) * y;
	cout << money << endl; 
	return 0;
}

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

int main() {
  vector<int> A(9);
  vector<int> a(9);
  rep(i, 9) cin >> A[i];
  int N;
  cin >> N;
  vector<int> b(N);
  rep(i, N) cin >> b[i];
  
  rep(i, 9){
    rep(j, N){
      if (A[i] == b[j]) a[i]=1;
    }
  }
  
  string ans = "No";
  if (a[0]*a[1]*a[2]==1) ans = "Yes";
  if (a[3]*a[4]*a[5]==1) ans = "Yes";
  if (a[6]*a[7]*a[8]==1) ans = "Yes";
  if (a[0]*a[3]*a[6]==1) ans = "Yes";
  if (a[1]*a[4]*a[7]==1) ans = "Yes";
  if (a[2]*a[5]*a[8]==1) ans = "Yes";
  if (a[0]*a[4]*a[8]==1) ans = "Yes";
  if (a[2]*a[4]*a[6]==1) ans = "Yes";
  
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <functional>
#include <bitset>

using namespace std;
using lint = long long int;
long long int INF = 1001001001001001LL;
int inf = 1000000007;
long long int MOD = 1000000007LL;
double PI = 3.1415926535897932;

template<typename T1,typename T2>inline void chmin(T1 &a,const T2 &b){if(a>b) a=b;}
template<typename T1,typename T2>inline void chmax(T1 &a,const T2 &b){if(a<b) a=b;}

#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()

/* do your best */

struct UnionFind{
    
    vector<int> M_par;
    vector<int> M_rank;
    vector<int> M_size;

private:
    void init(int n = 1){
        M_par.resize(n);
        M_rank.resize(n);
        M_size.resize(n);
        for(int i = 0; i < n; i++){
            M_par[i] = i;
            M_rank[i] = 0;
            M_size[i] = 1;
        }
    }

public:

    UnionFind(size_t n = 1){
        init(n);
    }

    size_t find(size_t x){
        if(M_par[x] == x) return x;
        size_t r = find(M_par[x]);
        return M_par[x] = r;
    }
    
    bool same(size_t x, size_t y){
        return find(x) == find(y);
    }

    bool unite(size_t x, size_t y){
        x = find(x);
        y = find(y);
        if(x == y) return false;
        if(M_rank[x] < M_rank[y]) swap(x, y);
        if(M_rank[x] == M_rank[y]) M_rank[x]++;
        M_par[y] = x;
        M_size[x] = M_size[x] + M_size[y];
        return true;
    }

    size_t size(size_t x){
        return M_size[find(x)];
    }

};

int main() {
  
  int n; cin >> n;
  int m; cin >> m;
  UnionFind uf(n);
  for (int i = 0; i < m; i++) {
    int a, b; cin >> a >> b;
    a--;
    b--;
    uf.unite(a, b);
  }

  size_t ans = 0;
  for (int i = 0; i < n; i++) {
    ans = max(ans, uf.size(i));
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 5152
#include <iostream>

using namespace std;

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

int n;
int a[100005];

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

Measured memory_bytes: 640
n=int(input())
a=55555
def primes(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]]
b=primes(a)
ans=[]
for i in range(len(b)):
  if b[i]%5==2:
    ans.append(b[i])
    if len(ans)==n:
      break
print(*ans)

Measured memory_bytes: 3572
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#pragma warning(disable : 4996)
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<unordered_map>
#include<unordered_set>
#include<time.h>
#include<random>

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-1;i >= n;--i)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end())
#define ll long long
#define pb(a) push_back
#define print(x) cout<<(x)<<'\n'
#define pe(x) cout<<(x)<<" "
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define lb(v,n) lower_bound(v.begin(), v.end(), n)
#define ub(v,n) upper_bound(v.begin(), v.end(), n)
#define int long long
#define all(x) (x).begin(), (x).end()
#define print_space(v) REP(i,v.size())cout << v[i] << ((i == v.size() - 1) ? "\n" : " ")
template<typename T1, typename T2> inline void chmin(T1 & a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
typedef pair<int, int>P;
const int MOD = 1e9 + 7; const int MAX = 2000020;
const double pi = acos(-1); const double EPS = 1e-12;
const ll INF = 1e18;


void solve() {
	bool ok = true;
	int N; cin >> N;
	vector<int>A(N);
	REP(i, N) {
		cin >> A[i];
		if (A[i] % 2 == 0) {
			if (A[i] % 3 != 0 && A[i] % 5 != 0)ok = false;
		}
	}
	if (ok)print("APPROVED");
	else print("DENIED");
}

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	//int q; cin >> q;
	//while (q--)
	solve();
}


Measured memory_bytes: 256
/**
SXR0aXAkI0JwbXptI3FhI3Z3I293bCNqY2IjUG0jMCNicG0jVHFkcXZvLyNCcG0jQW10bjBhY2phcWFicXZvLyNNYm16dml0MSNWdyNhdGN1am16I2tpdiNhbXF9bSNQcXUjVnd6I0F0bW14MSNQcWEjaXptI2l0dCNicHF2b2EjUXYjYnBtI3BtaWRtdmEjaXZsI3d2I21pemJwMSNFcHcjcWEjYnBtem0ja2l2I3F2Ym16a21sbSNRdiNQcWEjeHptYW12a20jbXtrbXhiI0lhI3BtI3htenVxYmJtYnBHI1BtI3N2d2VtYnAjRXBpYiMraXh4bWl6bWJwI2J3I1BxYSNrem1pYmN6bWEjSWEsI0ptbnd6bSN3eiNJbmJteiN3eiNKbXBxdmwjYnBtdTEjVnd6I2FwaXR0I2JwbXwja3d1eGlhYSNJY29wYiN3biNwcWEjc3Z3ZXRtbG9tI017a214YiNpYSNQbSNlcXR0bWJwMSNQcWEjYnB6d3ZtI2x3YnAjbXtibXZsI1dkbXojYnBtI3BtaWRtdmEjSXZsI3d2I21pemJwLyNpdmwjUG0jbm1tdG1icCNWdyNuaWJxb2NtI3F2I29jaXpscXZvI0l2bCN4em1hbXpkcXZvI2JwbXUvI053eiNQbSNxYSNicG0jVXdhYiNQcW9wMSNCcG0jQWN4em11bSMrcXYjb3R3enwsMQ==
*/
#include <cstring>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <queue>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cassert>

#define F first
#define S second
#define endl '\n'
#define deb(x) cout<<#x<<' '<<x<<endl;
#define pb push_back

/*
#ifdef IZI_KATKA
#define int __int64_t
#else
#define int __int64
#endif
*/

const long long MOD = 1e9 + 7;
const long long MAXN = 1e6 + 1;
using namespace std;

typedef long long ll;

long long readInt() {
    bool minus1 = false;
    long long result = 0;
    char ch;
    ch = getchar();
    while (true) {
        if (ch == '-') break;
        if (ch >= '0' && ch <= '9') break;
        ch = getchar();
    }
    if (ch == '-') minus1 = true; else result = ch-'0';
    while (true) {
        ch = getchar();
        if (ch < '0' || ch > '9') break;
        result = result*10 + (ch - '0');
    }
    if (minus1)
        return -result;
    else
        return result;
}

int cnt[MAXN];

int main() {
	#ifdef IZI_KATKA
	assert(freopen("input", "r", stdin));
    assert(freopen("output", "w", stdout));
    #endif
	int n = readInt();
    int mx = 0;
    int mn = MOD;
    for (int i = 1; i <= n; i++) {
    	int x;
    	cnt[x = readInt()]++;
    	mx = max(mx, x);
    	mn = min(mn, x);
    }
    if (mx - mn > 1) {
    	cout << "No";
    	return 0;
    }
	if (mx == mn) {
    	if (mn == n - 1) {
    		cout << "Yes";
    		return 0;
    	}
		if (mn * 2 <= n) {
			cout << "Yes";
		} else {
			cout << "No";
		}
    	return 0;
    }
	if (cnt[mn] + 1 <= mx && mx <= cnt[mn] + (cnt[mx] / 2)) {
		cout << "Yes";		
	} else {
		cout << "No";
	}
    return 0;
}

Measured memory_bytes: 640
#include        <bits/stdc++.h>
#define ll      long long int
#define pb      push_back
#define mp      make_pair
#define F       first
#define S       second
#define MOD     1000000007
#define pii     pair<int,int>
#define vi      vector<int>
#define fio     ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define N       200010
#define M       1000000000000000
#define O       1LL
using namespace std;


int main()
{
    fio;
    int m,n,d;
    cin>>d>>n;
    if(d==0){
        m=1;
    }
    else if(d==1){
        m=100;
    }
    else{
        m=10000;
    }
    
    for(int i=1; i<=10000000; i++){
        if(i%m==0){
            int j=i/m;
            if(j%100==0)continue;
            n--;
            if(n==0){
                cout<<i;
                return 0;
            }
        }
    }
    
    
    
    
    return 0;
}







Measured memory_bytes: 256
extern crate proconio;
use proconio::{fastout, input};

fn main() {
    input![n: usize, d: i64,];

    let mut res = 0;
    for _ in 0..n {
        input![x: i64, y: i64,];
        if x * x + y * y <= d * d {
            res += 1;
        }
    }
    println!("{}", res);
}


Measured memory_bytes: 4888
/*    ####################  */
/*   # I_LOVE_THUY_LINH #  */
/*  ####################  */
#include <bits/stdc++.h>
#define ll long long
#define db double
#define ld long double
#define ii pair<int,int>
#define pb push_back
#define vi vector<int>
#define vii vector<ii>
#define matrix vector<vector<ll>>
#define fir first
#define sec second
#define all(s) s.begin(),s.end()
#define rall(s) s.rbegin(),s.rend()
#define uni(a) (a).erase(unique(all(a)),(a).end())
#define sz(a) int((a).size())
#define ms(s,val) memset(s,val,sizeof(s))
#define bitcount(n) __builtin_popcountll(n)
#define getbit(s,k) ((s >> k)&1)
#define turnbit(s,k) (s | (1<<k))
#define offbit(s,k) (s & ~(1<<k))
#define flipbit(s,k) (s ^ (1<<k))
#define prec(n) fixed<<setprecision(n)
#define sqr(x) (ll)(x)*(ll)(x)
#define lcm(a,b) ((ll)a/__gcd((ll)a,(ll)b)*(ll)(b))
#define gcd(a,b) __gcd(a,b)
using namespace std;
const int INF = int(1e9);
ll memo[100][2][4];
int k;
string s;

ll dp(int pos,bool low,int cnt){
    if (pos == s.size()) return (cnt == k);
    ll &ans = memo[pos][low][cnt];
    if (ans != -1) return ans;
    ans = 0;
    for (int dg = 0; dg <= 9; dg++)
        if (low || (dg <= s[pos] - '0')){
            int newcnt = cnt + (dg != 0);
            if (newcnt <= k) ans += dp(pos + 1,low || (dg < s[pos] - '0'),newcnt);
        }
    return ans;
}

int main(){
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    cin >> s;
    cin >> k;
    memset(memo,-1,sizeof(memo));
    cout << dp(0,0,0);
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fastIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define forN(i, n) for(int i = 0; i <n ; ++i)
#define endl "\n"
typedef long long ll;
using namespace  std;
const ll INF = 1e18;
const ll MOD = 1e9 + 7;
const int N = 1e4 +5 ;
string s;
int main () {
    fastIO
    cin>>s;
    int ans = 0 ;
    int l = 0 , r = s.size()-1;
    while(l<=r){
        if(s[l]!=s[r]){
            ans++;
        }
        l++;
        r--;
    }
    cout<<ans;
}


Measured memory_bytes: 3604
N = gets.to_i
ary = gets.split.map(&:to_i)
MOD = 10**9 + 7
sum = 0
tmp = 0
(N-1).times do |n|
    tmp = (tmp + ary[n]) % MOD
    sum = (sum + ary[n+1]*tmp) % MOD
end
puts sum

Measured memory_bytes: 28252
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int inf = 1e9;


void solve(){
   int n, c = 0;
   cin >> n;
   int a[n];
   for(int i = 1; i <= n; i++){
       cin >> a[i];
   }
   for(int i = 1; i <= n; i+=2){
       if(a[i] % 2 == 1){
           c++;
       }
   }
   cout << c << endl;

}



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


    solve();
    return 0;
}


Measured memory_bytes: 3616
n, m = map(int, input().split())
a = [list(map(int, input().split())) for i in range(n)]
for i in a:
    i.pop(0)
for i in range(n-1):
    a[i+1] = set(a[i]) & set(a[i+1])
print(len(a[n-1]))

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

int main() {

  long long N, A, B;
  cin >> N >> A >> B;

  long long answer = N / (A + B);

  answer *= A;
  
  long long a = N % (A + B);

  answer += min(a, A);

  cout << answer << endl;

  return 0;

}

Measured memory_bytes: 256
#include <iostream>
#include <ccomplex>
#include <vector>
#include <cassert>
#include <utility>
#include <algorithm>
#include <string>
#include <deque>
#include <queue>
#include <functional>
#include <cmath>
#include <iomanip>
#include <map>
#include <numeric>
#include <list>
#include <assert.h>
#include <math.h>
#include <valarray>
#include <stdio.h>
#include <algorithm>
#include <set>
#include <complex>
#include <list>
#include <time.h>
#include <stack>
#include <locale>
#include <clocale>
#include <ctype.h>
#include <wchar.h>

using namespace std;
typedef long long int LL;
typedef pair<long long int, long long int> pii;
typedef pair<double, double> pdd;

#define SORT(c) sort((c).begin(),(c).end())
#define BACKSORT(c) sort((c).begin(),(c).end(),std::greater<LL>())
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

int xcomp(vector<LL>& a, vector<LL>& b) {
	return a[0] < b[0];
}

#define XSORT(c) sort((c).begin(),(c).end(),xcomp)

#define ALL(x) (x).begin(),(x).end()
LL mod = 1000000007;

LL pow2(LL x) {
	if (x == 0) {
		return 1;
	}
	else {
		return pow2(x - 1) * 2;
	}
}

LL ketasu(LL x) {
	if (x == 1) {
		return 1;
	}else
		if (x == 0) {
			return 0;
		}
		else {
			return ketasu(x / 2) + 1;
		}
}

int main() {
	LL N, W;
	cin >> N >> W;
	vector<LL> wi(N, 0);
	vector<LL> vi(N, 0);
	vector<vector<LL>> ww(4, vector<LL>(0));
	vector<vector<LL>> ss(4, vector<LL>(0));
	cin >> wi[0] >> vi[0];
	ww[0].push_back(vi[0]);
	FOR(i, 1, N) {
		cin >> wi[i] >> vi[i];
		ww[wi[i] - wi[0]].push_back(vi[i]);
	}

	BACKSORT(ww[0]);
	BACKSORT(ww[1]);
	BACKSORT(ww[2]);
	BACKSORT(ww[3]);
	ss[0].push_back(0);
	ss[1].push_back(0);
	ss[2].push_back(0);
	ss[3].push_back(0);
	REP(i, 4) {
		REP(j, ww[i].size()) {
				ss[i].push_back(ww[i][j]+ss[i][j]);
			
		}
	}

	LL max = 0;
	REP(a, ss[0].size()) {
		REP(b, ss[1].size()) {
			REP(c, ss[2].size() ) {
				REP(d, ss[3].size()) {
					if (a*(wi[0] + 0) + b*(wi[0] + 1) + c*(wi[0] + 2) + d*(wi[0] + 3)<=W) {
						if (ss[0][a] + ss[1][b] + ss[2][c] + ss[3][d] > max) {
							max = ss[0][a] + ss[1][b] + ss[2][c] + ss[3][d];
						}
											}
				}
			}
		}
	}

	cout << max << endl;

}

Measured memory_bytes: 256
n = int(input())
length = 0
x = []
y = []
for i in range(n):
    xi,yi = map(int,input().split())
    x.append(xi)
    y.append(yi)
for i in range(n):
    for k in range(n):
        length += ((x[i]-x[k])**2+(y[i]-y[k])**2)**0.5
print(length/n)

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>

using namespace std;

int main(){
    string A, B;
    cin >> A >> B;
    vector<int> a, b;
    
    for(int i = 0; i < A.length(); i++){
        a.push_back(A[i] - '0');
    }
    for(int i = 0; i < B.length(); i++){
        b.push_back(B[i] - '0');
    }
    
    if(a.size() < b.size()){
        cout << "LESS\n";
    }
    else if(a.size() > b.size()){
        cout << "GREATER\n";
    }
    else{       // a.size() == b.size()
        for(int i = 0; i < a.size(); ++i){
            if(a[i] < b[i]){
                cout << "LESS\n";
                return 0;
            }
            else if(a[i] > b[i]){
                cout << "GREATER\n";
                return 0;
            }
            else        ;
        }
        cout << "EQUAL\n";
        return 0;
    }
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
	int a=0;
	int b=0;
	int S=0;
	int L=0;
	scanf("%d %d\n", &a, &b);
	S = a*b;
	L = 2*(a+b);
	printf("%d %d\n", S, L);
	return 0;
}


Measured memory_bytes: 2044
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include <tuple>
#include <cassert>
#include <functional>
#include <set>
#include <deque>
using namespace std;
typedef long long ll;
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
const int INF = 1<<29;
#define LNF __LONG_LONG_MAX__
const ll MOD = 1000000007;
const int MAX = 200000;

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

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

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
// 法mでのaの逆元を計算
long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
// a^n mod を計算する
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
//最大公約数
int gcd(int x, int y) { return (x % y)? gcd(y, x % y): y; }
//最小公倍数
int lcm(int x, int y) { return x / gcd(x, y) * y; }
// nが大きく,kが10^7程度の時の二項係数
long long com[200005];
void combination(long long n,long long k){
    com[0] = 1;
    for(int i=1;i<=k;i++){
        com[i] = (com[i-1]*(n-i+1)%MOD)*modinv(i,MOD)%MOD;
    }
}

int main(){
    int N; cin >> N;
    int out=-1;
    int cnt=-1;
    for(int i=1;i<=N;i++){
        int tmp=i;
        int c=0;
        while(tmp%2==0){
            tmp = tmp/2;
            c++;
        }
        if(cnt<c){
            cnt=c;
            out=i;
        }
    }
    cout << out << endl;
    return 0;
}


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

int main() {
    int n; cin >> n;
    vector<int> a(n);
    for (int &ai: a) cin >> ai;
    sort(begin(a), end(a));
    long long ans = 0;
    if (n % 2 == 0) {
        vector<int> b{1, -1};
        int m = n / 2 - 1;
        for (int i = 0; i < m; i++) b.emplace_back(2);
        for (int i = 0; i < m; i++) b.emplace_back(-2);
        sort(begin(b), end(b));
        for (int i = 0; i < n; i++) ans += a[i] * b[i];
    } else {
        vector<int> b{1, 1};
        int m = n / 2;
        for (int i = 1; i < m; i++) b.emplace_back(2);
        for (int i = 0; i < m; i++) b.emplace_back(-2);
        for (int k: {1, -1}) {
            for (int &bi: b) bi *= k;
            sort(begin(b), end(b));
            long long tmp = 0;
            for (int i = 0; i < n; i++) tmp += a[i] * b[i];
            ans = max(ans, tmp);
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1276
#include <iostream>
#include <cstdio>
#include <cmath>

using namespace std;

double ang(double x1, double y1, double x2, double y2) {
    return acos((x1 * x2 + y1 * y2) / (sqrt(x1 * x1 + y1 * y1) * sqrt(x2 * x2 + y2 * y2)));
}

int main (void) {
    while (true) {
        double x1, x2, x3, x4, y1, y2, y3, y4;
        if (scanf("%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf", &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4) == EOF) break;
        double a = 0;
        a += ang(x2 - x1, y2 - y1, x2 - x3, y2 - y3);
        a += ang(x3 - x2, y3 - y2, x3 - x4, y3 - y4);
        a += ang(x4 - x3, y4 - y3, x4 - x1, y4 - y1);
        a += ang(x1 - x4, y1 - y4, x1 - x2, y1 - y2);
        if (abs(M_PI * 2 - a) < 0.01) {
            cout << "YES" << endl;
        } else {
            cout << "NO" << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 1268
K=int(input())

if K<=500:
    print(K)
    for i in range(1,K+1):
        print((str(i)+" ")*K)

else:
    KUP=((K+1)//2+3)//4*4
    print(KUP)

    ANS=[[0]*KUP for i in range(KUP)]

    begin=0
    for i in range(KUP):
        for j in range(KUP):
            if i%2==0:
                ANS[i][(j+begin)%KUP]=j+1
            else:
                ANS[i][(j+begin)%KUP]=j+1+KUP
                
        begin+=1

    for i in range(KUP*2-K):

        for j in range(KUP):
            for l in range(KUP):
                if ANS[j][l]==KUP*2-i:
                    ANS[j][l]=KUP*2-i-KUP

    for ans in ANS:
        print(*ans)

Measured memory_bytes: 12296
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
  
int main(void){
    int n;
    cin >> n;
    
    vector<int> v(n);
    vector<int> c(n);
    
    for(int i=0; i<n; i++) cin >> v[i];
    for(int i=0; i<n; i++) cin >> c[i];
    
    int ans = 0;
    
    for(int i=0; i<n; i++) {
        if (v[i] - c[i] > 0) ans += v[i] -c[i];
    }
    
    cout << ans << endl;
    return 0;
}


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

using lint = long long;

int main() {
    int n, a;
    cin >> n >> a;
    vector<int> x(n + 1);
    for (int i = 1; i <= n; i++) {
        cin >> x[i];
    }

    const int s_max = 3000;
    vector<vector<vector<lint>>> dp(n + 1, vector<vector<lint>>(n + 1, vector<lint>(s_max)));
    dp[0][0][0] = 1;
    // dp[i][j][s]: i までで j 個選んで合計が s
    for (int i = 1; i <= n; i++) {
        for (int j = 0; j <= i; j++) {
            for (int s = 0; s < s_max; s++) {
                // 使わない場合
                dp[i][j][s] += dp[i - 1][j][s];
                // 使う場合
                if (j > 0 and s >= x[i]) {
                    dp[i][j][s] += dp[i - 1][j - 1][s - x[i]];
                }
            }
        }
    }

    lint ans = 0;
    for (int j = 1; j <= n; j++) {
        if (a * j < s_max) {
            ans += lint(dp[n][j][a * j]);
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 62592
#include <iostream>
#include <algorithm>
#include <string.h>
using namespace std;
int w[102] , v[102] , n , b ;
long long dp[102][100002] ;
long long SAAD ( int idx , int bag ) {
	if ( idx == n ) return 0 ;
	if ( dp[idx][bag] != 0 ) return dp[idx][bag] ;
	return dp[idx][bag] = max((bag+w[idx]>b?0:SAAD(idx+1,bag+w[idx])+v[idx]),SAAD(idx+1,bag)) ;
}
int main() {
	cin >> n >> b ;
	for ( int i = 0 ; i < n ; i++ ) {
		cin >> w[i] >> v[i] ;
	}
	cout << SAAD(0,0)  ;
	return 0;
}

Measured memory_bytes: 76416
a,b,c =map(int,input().split())
p=int(input())
 
cnt=0
 
for i in range(1,p+2):
    for j in range(1,p+2):
        for k in range(1,p+2):
            if i+j+k==p+3 and a*2**(i-1) < b*2**(j-1) and b*2**(j-1) < c*2**(k-1):
                cnt+=1
 
if cnt >0:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 9200
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"

using namespace std;

const long long int MOD = 1000000007;

long long int N, M, K, H, W, L, R;

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

	cin >> N;
	vector<int>v(N);
	for (auto &i : v)cin >> i;
	vector<int>dp(N,MOD);
	dp[0] = 0;
	dp[1] = abs(v[1] - v[0]);
	for (int i = 2; i < N; i++) {
		dp[i] = min(dp[i - 1] + abs(v[i] - v[i - 1]), dp[i - 2] + abs(v[i] - v[i - 2]));
	}
	cout << dp.back() << endl;
	return 0;
} 

Measured memory_bytes: 1024