akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPS(i, _s, n) for(int i = _s, i##_len = (n); i < i##_len; ++i)
#define ALL(x) (x).begin(), (x).end()
using namespace std;

#define repi(itr, ds) for(auto itr = ds.begin(); itr != ds.end(); itr++)
// vector
template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
  for(T &x : vec) is >> x;
  return is;
}
// pair
template <typename T, typename U>
ostream &operator<<(ostream &os, pair<T, U> &pair_var) {
  os << "(" << pair_var.first << ", " << pair_var.second << ")";
  return os;
}
// vector
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
  os << "{";
  for(int i = 0; i < vec.size(); i++) {
    os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
  }
  os << "}\n   ";
  return os;
}
// map
template <typename T, typename U>
ostream &operator<<(ostream &os, map<T, U> &map_var) {
  os << "{";
  repi(itr, map_var) {
    os << *itr;
    itr++;
    if(itr != map_var.end()) os << ", ";
    itr--;
  }
  os << "}";
  return os;
}
// set
template <typename T>
ostream &operator<<(ostream &os, set<T> &set_var) {
  os << "{";
  repi(itr, set_var) {
    os << *itr;
    itr++;
    if(itr != set_var.end()) os << ", ";
    itr--;
  }
  os << "}";
  return os;
}

#define DUMPOUT cerr

void dump_func() { DUMPOUT << endl; }
template <class Head, class... Tail>
void dump_func(Head &&head, Tail &&... tail) {
  DUMPOUT << head;
  if(sizeof...(Tail) > 0) {
    DUMPOUT << ", ";
  }
  dump_func(std::move(tail)...);
}
#ifdef DEBUG_
#define DEB
#define dump(...)                                                             \
  DUMPOUT << "  " << string(#__VA_ARGS__) << ": "                             \
          << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]" << endl \
          << "    ",                                                          \
      dump_func(__VA_ARGS__)
#else
#define DEB if(false)
#define dump(...)
#endif

typedef long long int ll;
const int MOD = 1e9 + 7;
const int INF = 1e9;

int main() {
  int N, A, B, C, D;
  string S;
  cin >> N >> A >> B >> C >> D >> S;
  A--;
  B--;
  C--;
  D--;

  auto has_rock = [&](int l, int r) {
    REPS(i, l, r + 1) {
      if(S[i] == '#' && S[i + 1] == '#') {
        return true;
      }
    }
    return false;
  };

  auto has_space = [&](int l, int r) {
    REPS(i, l, r + 1) {
      if(S[i - 1] == '.' && S[i] == '.' && S[i + 1] == '.') {
        return true;
      }
    }
    return false;
  };
  bool res = false;
  if(C < D) {
    if(has_rock(A, C) || has_rock(B, D)) {
      res = false;
    } else {
      res = true;
    }
  } else {
    if(has_rock(A, C) || has_rock(B, D)) {
      res = false;
    } else if(has_space(B, D)) {
      res = true;
    } else {
      res = false;
    }
  }
  if(res) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}


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

int main(){
		long long a, b, m, n, r;
		while(cin >> a >> b){
				if(a == b){
						cout << a << " " << a << endl;
				}
				else if(a > b){
						m = a;
						n = b;
						while(r = m % n){
								m = n;
								n = r;
						}
						cout << n << " " << (a * b) / n << endl;
				}
				else if(a < b){
						m = b;
						n = a;
						while(r = m % n){
								m = n;
								n = r;
						}
						cout << n << " " << (a * b) / n << endl;
				}
		}
		return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
#define ull unsigned long long
#define MOD (int)(1e9+7)
#define ceil(x, y) (x%y==0? (x/y) : (x/y+1))
#define FOR(i, N) for(int i = 0; i < N; ++i)
#define FOR1(i, N) for(int i = 1; i <= N; ++i)
#define vi vector <int>
#define pii pair <int, int>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define mset(a, v) memset(a, v, sizeof(a))
#define all(v) (v).begin(), (v).end()
#define INF 2e9
#define EPS 1e-9
#define MAX 200009
#define int long long
void __print(int x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define dbg(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define dbg(x...)
#endif
using namespace std;
int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
    	freopen("in.txt", "r", stdin);
    	freopen("out.txt", "w", stdout);
    #endif

	int T=1;
	//cin >> T;
	FOR1(tp, T)
	{
		//cout << "Case #" << tp << ": ";
		int x, n; cin >> x >> n;
		set<int> a;
		FOR1(i, n) {int num; cin >> num; a.insert(num);}
		//for(int i : a) cout << i << " ";
		int left = x;
		while(a.find(left) != a.end()){
			left--;
		}
		int right = x;
		while(a.find(right) != a.end()){
			right++;
		}
		if(x-left == right-x) cout << left;
		else if(x-left < right-x) cout << left;
		else cout << right;
		cout<<'\n';
	}
	return 0;
}


Measured memory_bytes: 3648
#include <iostream>
#include <stdio.h>
#include <cstring>
using namespace std;
#define MAX 100005
int fa[MAX],arr[MAX];
int gfa(int x){
	if (x!=fa[x]){
		fa[x]=gfa(fa[x]);
	}
	return fa[x];
}

void sfa(int x,int y){
	int fx=gfa(x),fy=gfa(y);
	if (fx!=fy){
		fa[fx]=fy;
	}
}
int main(){
	int n,m,u,v;
	while (scanf("%d%d",&n,&m)!=EOF){
		int ans=0;
		for (int i=1;i<=n;i++){
			scanf("%d",&arr[i]);
			fa[i]=i;
		}
		for (int i=0;i<m;i++){
			scanf("%d%d",&u,&v);
			sfa(u,v);
		}
		for (int i=1;i<=n;i++){
			if (gfa(arr[i])==gfa(i)){
				ans++;
			}
		}
		printf("%d\n",ans);
	}
	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <queue>
#include <vector>

using namespace std;

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

    priority_queue<double, vector<double>, greater<double>> pq;
    double value;
    for (int i = 0; i < n; ++i) {
        cin >> value;
        pq.push(value);
    }

    for (int i = 0; i < n - 1; ++i) {
        double v1 = pq.top();
        pq.pop();
        double v2 = pq.top();
        pq.pop();
        pq.push((v1 + v2) / 2.0);
    }

    cout << pq.top() << '\n';
}


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

int main(){
  string s;
  cin >> s;
  for(int i = 0; i < s.size()-1; i++){
    if(s[i] == s[i+1]){
      cout << i+1 << " " << i+2 << endl;
      return 0;
    }
  }

  for(int i = 0; i < s.size()-1; i++){
    if(s[i] == s[i+2]){
      cout << i+1 << " " << i+3 << endl;
      return 0;
    }
  }
  cout << "-1 -1" << endl;
}


Measured memory_bytes: 512
package main

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

var alpha = "abcdefghijklmnopqrstuvwxyz"

func main() {
	N := nextInt64() - 1
	name := ""

	for N >= 0 {
		n := N % 26

		name = fmt.Sprintf("%c%s", alpha[n], name)
		N = N/26 - 1
	}

	fmt.Println(name)
}

var stdin = initStdin()

func initStdin() *bufio.Scanner {
	bufsize := 1 * 1024 * 1024 // 1 MB
	var stdin = bufio.NewScanner(os.Stdin)
	stdin.Buffer(make([]byte, bufsize), bufsize)
	stdin.Split(bufio.ScanWords)
	return stdin
}

func nextString() string {
	stdin.Scan()
	return stdin.Text()
}

func nextBytes() []byte {
	stdin.Scan()
	return stdin.Bytes()
}

func nextInt() int {
	i, _ := strconv.Atoi(nextString())
	return i
}

func nextInt64() int64 {
	i, _ := strconv.ParseInt(nextString(), 10, 64)
	return i
}

func debug(args ...interface{}) {
	fmt.Fprintln(os.Stderr, args)
}


Measured memory_bytes: 1808
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
using namespace std;
int a[200005];
vector<int> path;
long long ind[200005] = {};

bool check_cycle(int cur_index){
    if(ind[cur_index])
        return true;
    return false;
}


int main(){
    long long n,k;
    cin >> n >> k;
    for(int i = 1; i <= n ; ++i){
        cin >> a[i];
    }
    long long temp_k = 0, cur_index = 1;
    while(!ind[cur_index] && temp_k < k){
        ind[cur_index] = temp_k++;
        path.push_back(cur_index);
        cur_index = a[cur_index];
    }
    if(temp_k == k){
        cout << cur_index;
    }
    else{
        cout << path[((k-ind[cur_index]) % (path.size()-ind[cur_index]))+ind[cur_index]];
    }

    return 0;
}

Measured memory_bytes: 6592
# -*- coding: utf-8 -*-

N, A, B = map(int, input().split())
# print(N,A,B)

flg = True
if A == 0:
    print(0)
    flg = False

if B == 0:
    print(N)
    flg = False

if flg:

    zentai_num = N // (A + B)
    zentai_b = zentai_num * A

    # print(zentai_b)
    amari_num = N % (A + B)


    amari_b = 0
    if amari_num >= A:
        amari_b = A
        # print(amari_num,A,amari_b)
    else:
        amari_b = amari_num

    # print(amari_b)

    # amari_b = max(amari_num - B,0)

    # print(amari_num,amari_b)

    print(zentai_b + amari_b)

Measured memory_bytes: 3064
package main

import (
	"fmt"
)

func COM(n, k int64) int64 {
	r := int64(1)
	for i := int64(0); i < k; i++ {
		r = ModMul(r, n-i)
		r = ModDiv(r, i+1)
	}

	return r
}

const (
	MOD = 1000000000 + 7
)

func ModAdd(a, b int64) int64 {
	return (a + b) % MOD
}

func ModMul(a, b int64) int64 {
	return a * b % MOD
}

func ModSub(a, b int64) int64 {
	r := (a%MOD - b%MOD) % MOD
	if r < 0 {
		r += MOD
	}
	return r
}

func ModDiv(a, b int64) int64 {
	return a % MOD * ModInv(b) % MOD
}

func ModPow(a, n int64) int64 {
	var r int64 = 1
	for n > 0 {
		if n&1 == 1 {
			r = r * a % MOD
		}
		a = a * a % MOD
		n >>= 1
	}
	return r
}

func ModInv(a int64) int64 {
	var b, u, v int64 = MOD, 1, 0
	for b > 0 {
		t := a / b
		a -= t * b
		a, b = b, a
		u -= t * v
		u, v = v, u
	}
	u %= MOD
	if u < 0 {
		u += MOD
	}
	return u
}

type Q struct {
	value int
	index int
	A, B  int
}

type QS []*Q

func (p QS) Len() int           { return len(p) }
func (p QS) Less(i, j int) bool { return p[i].value > p[j].value }
func (pq QS) Swap(i, j int) {
	pq[i], pq[j] = pq[j], pq[i]
	pq[i].index = i
	pq[j].index = j
}

func (pq *QS) Push(x interface{}) {
	n := len(*pq)
	item := x.(*Q)
	item.index = n
	*pq = append(*pq, item)
}

func (pq *QS) Pop() interface{} {
	old := *pq
	n := len(old)
	item := old[n-1]
	old[n-1] = nil  // avoid memory leak
	item.index = -1 // for safety
	*pq = old[0 : n-1]
	return item
}

func FactoredPrimeNumber(num int) map[int]int {
	m := map[int]int{}
	return factor(m, num, 2)
}

func factor(result map[int]int, num, pnum int) map[int]int {
	if pnum*pnum > num {
		if num != 1 {
			result[num] += 1
		}
		return result
	}

	if num%pnum == 0 {
		num /= pnum
		result[pnum]++
	} else {
		pnum++
	}
	return factor(result, num, pnum)
}

func GCD(a, b int64) int64 {
	if b == 0 {
		return a
	}
	return GCD(b, a%b)
}

func LCM(a, b int64) int64 {
	return a * b / GCD(a, b)
}

func main() {
	var N, M int
	fmt.Scanf("%d %d\n", &N, &M)
	fmt.Println((3*N + M) / 2)
}

func Reverse(runes []rune) []rune {
	for i, j := 0, len(runes)-1; i < j; i, j = i+1, j-1 {
		runes[i], runes[j] = runes[j], runes[i]
	}
	return runes
}


Measured memory_bytes: 512
# import math
# import statistics
# import itertools
a=int(input())
#b,c=int(input()),int(input())
# c=[]
# for i in a:
#     c.append(int(i))
# e1,e2,e3,e4 = map(int,input().split())
f = list(map(int,input().split()))
# g = [int(input()) for _ in range(a)]

f.sort()
ma =[]
count=1
for i in range(len(f)-1):
    if f[i]==f[i+1] and f[i]!=0:
        count+=1
    elif f[i]!=f[i+1] and count>=2 :
        ma.append(f[i])
        count=1
    elif  f[i]!=f[i+1] and count==1 :
        count=1
    else:
        count=1

if count>=4:
    ma.append(f[-1])
    ma.append(f[-1])
elif count>=2:
    ma.append(f[-1])


if ma==[]:
    print(0)
else:
    print(ma[-1]*ma[-2])



Measured memory_bytes: 20020
#include <stdio.h>
int main()
{

    int i,a,b,c,d,j,n,m,k,l,h,r;
    scanf("%d%d",&b,&c);
    i=b-1;
    j=c-1;
    n=i*j;
        printf("%d\n",n);
    return 0;
}



Measured memory_bytes: 128
#include<stdio.h>
int main()
{
	int a,b,c,d,n;
	while(~scanf("%d",&n))
	{a=n/1000;
	 d=n%10;
	 b=n%1000/100;
	 c=n%100/10;
	 if(a==b||b==c||c==d)printf("Bad\n");
	 else printf("Good\n");
	}
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <numeric>
#include <queue>

using namespace std;

int main(){
    int N,M;
    cin>>N>>M;
    priority_queue<long long> A;
    for(int i=0;i<N;i++){
        int a;
        cin>>a;
        A.push(a);
    }
    for(int i=1;i<=M;i++){
        int a=A.top();
        A.pop();
        a=floor(a/2);
        A.push(a);
    }
    long long ans=0;
    for(int i=0;i<N;i++){
        ans+=A.top();
        A.pop();
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 1400
from time import time
from random import randint

from numba import njit
from numpy import int64

@njit('i8(i8[:],i8[:])')
def func(s,x):
    last=[0]*26
    score=0
    for i,v in enumerate(x,1):
        last[v]=i
        c=0
        for j in range(26):
            c+=s[j]*(i-last[j])
        score=score+s[i*26+v]-c
    return score

def main():
    start=time()
    d,*s=map(int,open(0).read().split())
    s=int64(s)
    x=int64(([*range(26)]*15)[:d])
    M=func(s,x)
    while time()-start<1:
        y=x.copy()
        if randint(0,1):
            y[randint(0,d-1)]=randint(0,25)
        else:
            i=randint(0,d-15)
            j=randint(i,i+14)
            y[i],y[j]=y[j],y[i]
        t=func(s,y)
        if t>M:
            M=t
            x=y
    print(*x+1,sep='\n')

main()

Measured memory_bytes: 111540
#include <iostream>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <cstring>
#include <map>
#include <algorithm>
#include <math.h>
#include <iostream>     // std::cout, std::fixed
#include <iomanip>
#include<queue>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <iostream>
#include <sstream>
using namespace std;
typedef long long ll;
pair<int, pair<ll, ll> > extendedEuclid(ll a, ll b)
{
    ll x = 1, y = 0;
    ll xLast = 0, yLast = 1;
    ll q, r, m, n;
    while (a != 0)
    {
        q = b / a;
        r = b % a;
        m = xLast - q * x;
        n = yLast - q * y;
        xLast = x;
        yLast = y;
        x = m;
        y = n;
        b = a;
        a = r;
    }
    return make_pair(b, make_pair(xLast, yLast));
}
int main () {
    ios_base::sync_with_stdio(false);
    ll n,m;
    cin>>n>>m;
    int count=0;
    while (n<=m) {
        count++;
        n*=2;
    }
    cout<<count;
    
    return 0;
}


Measured memory_bytes: 256
n = gets.to_i
s = Array.new
hash = Hash.new(0)
max = 0
n.times{|i|
  s = gets.chomp
  hash[s] += 1
  if hash[s] > max
    max = hash[s]
  end
}

puts hash.select{|key,value| value==max}.keys.sort

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

// types
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;

// macros
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define REP1(i,n) for(int i=1;i<((int)n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int mod = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  
  //b,a
  ll n, k;
  cin >> n >> k;
  
  vector<ll> x(n);
  REP(i, n)
    cin >> x[i];
  ll nowtime = x[k-1] - x[0] + min(abs(x[0]), abs(x[k-1]));
  ll mintime = nowtime;
  
  REP(i, n-k){
    nowtime -=  min(abs(x[i]), abs(x[k+i-1])) + (x[i+1] - x[i]);
    nowtime +=  (x[k+i] - x[k+i-1]) + min(abs(x[i+1]), abs(x[k+i]));
    //cout << x[k+i] << endl;
    if(mintime > nowtime)
      mintime = nowtime;
  }
  
  cout << mintime << "\n";

}

Measured memory_bytes: 1024
#include <iostream>

using namespace std;

int w, h;
int c[50][50];
char dx[] = {-1,-1,-1,0,1,1,1,0};
char dy[] = {-1,0,1,1,1,0,-1,-1};

void dfs(int x, int y){
	c[x][y] = 0;
	for(int i=0;i<8;i++){
		int nx = x+dx[i], ny = y+dy[i];
		if(nx<0||h<=nx||ny<0||w<=ny||!c[nx][ny]) continue;
		dfs(nx,ny);
	}
}

int main(){
	while(cin >> w >> h, w){
		for(int i=0;i<h;i++)
			for(int j=0;j<w;j++)
				cin >> c[i][j];
		int ans = 0;
		for(int i=0;i<h;i++)
			for(int j=0;j<w;j++)
				if(c[i][j]) ans++, dfs(i,j);
		cout << ans << endl;
	}
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
#define f1(a,b,c) for(int c=a;c<=b;c++)
#define f2(a,b,c) for(int c=a;c>=b;c--)
#define f3(a,b,c) for(int c=a;c;c=b)
#define so1(a,n) sort(a+1,a+n+1,mycmp);
#define so2(a,n) sort(a+1,a+n+1);
#define ll long long
#define itn int
#define ubt int 
const int twx=100000+100;
const int inf=0x3f3f3f3f;
ll read()
{
    ll sum=0;
    ll flag=1;
    char c=getchar();
    while(c<'0'||c>'9')
    {
        if(c=='-')
        {
            flag=-1;
        }
        c=getchar();
    }
    while(c>='0'&&c<='9')
    {
        sum=((sum*10)+c-'0');
        c=getchar();
    }
    return sum*flag;
}
int n,m,l;
struct LV
{
    int y;
    int Next;
    int v;
}a[twx<<1];
int Link[twx];
int len;
int d[twx];
int v[twx];
int f[301][301];
priority_queue<pair<int,int> > q;
void dijkstra(int s)
{
    memset(v,0,sizeof v);
    memset(d,0x3f,sizeof d);
    q.push(make_pair(0,s));
    d[s]=0;
    while(!q.empty())
    {
        int x=q.top().second;
        q.pop();
        if(v[x])
        {
            continue ;
        }
        v[x]=1;
        f3(Link[x],a[i].Next,i)
        {
            int y=a[i].y;
            int v=a[i].v;
            if(d[y]>d[x]+v&&d[x]+v<=l)
            {
                d[y]=d[x]+v;
                f[s][y]=0;
                q.push(make_pair(-d[y],y));
            }
        }
    }
}
void floyed()
{
    f1(1,n,k)
    {
        f1(1,n,i)
        {
            f1(1,n,j)
            {
                f[i][j]=min(f[i][j],f[i][k]+f[k][j]+1);
            }
        }
    }
}
void Insert(int x,int y,int z)
{
    a[++len].y=y;
    a[len].v=z;
    a[len].Next=Link[x];
    Link[x]=len;
}
void init()
{
	n=read();
    m=read();
    l=read();
    f1(1,m,i)
    {
        int x=read();
        int y=read();
        int z=read();
        Insert(x,y,z);
        Insert(y,x,z);
    }
    memset(f,0x3f,sizeof f);
    f1(1,n,i)
    {
        dijkstra(i);
    }
    int qq=read();
    floyed();
    while(qq--)
    {
        int x=read();
        int y=read();
        printf("%d\n",f[x][y]==inf?-1:f[x][y]);
    }
}
void work()
{
	
}
void print()
{
	
}
int main()
{
    init();
	return 0;
}

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

int main(){
	int n;
	cin >> n;
	vector<int> p(n);
	rep(i,n) cin>>p[i];
	int count=0;
	for(int i=1; i<n-1; i++)if((p[i-1]<=p[i] && p[i] < p[i+1]) || (p[i-1]>p[i] && p[i] >= p[i+1])) count++;
	cout << count << endl;
	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define INF (1<<30)
#define INFLL (1ll<<60)
typedef pair<int, int> P;
typedef pair<int, P> E;
#define MOD (1000000007ll)
#define l_ength size

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

void add_mod(ll& a, ll b){
	b += MOD;
	a += b;
	a %= MOD;
}

int b[22],a;

int main(void){
	int n,m,c,i,j,t,ans=0;
	cin >> n >> m >> c;
	for(j=0; j<m; ++j){
		cin >> b[j];
	}
	for(i=0; i<n; ++i){
		t = c;
		for(j=0; j<m; ++j){
			cin >> a;
			t += a*b[j];
		}
		if(t>0){
			++ans;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <cmath>
#include <climits>
#include <iomanip>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
int main(){
  ll n = 0;
  cin >> n;
  map<ll,ll> count;
  for(int i = 0;i < n;i++){
    ll num = 0;
    cin >> num;
    count[num]++;
  }
  vector<ll> can;
  for(auto& item:count){
    if(item.second >= 2)can.push_back(item.first);
    if(item.second >= 4)can.push_back(item.first);
  }
  sort(can.begin(),can.end());
  ll res = 0;
  if(can.size() >= 2)res = can[can.size() - 1] * can[can.size() - 2];
  cout << res << endl;
}

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

int main() {
    int n, cnt = 0;
    int flag = 0;
    cin >> n;
    int a[n];
    for(int i = 0; i < n; i++) {
        cin >> a[i];
    }
    while(true){
        for(int i = 0; i < n ; i++) {
            if(a[i] % 2 != 0)flag=1;
            a[i] = a[i] / 2;
        }
        if(flag==1)break;
        cnt++;
    }
    cout << cnt << endl;
}


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


def solve(n: int, p: "List[int]"):
    ans = 0
    for i in range(1,n-1):
        if (p[i-1] > p[i]) ^ (p[i] < p[i+1]):
            ans +=1
    print(ans)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    n = int(next(tokens))  # type: int
    p = [int(next(tokens)) for _ in range(n)]  # type: "List[int]"
    solve(n, p)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
import math
import collections
N = int(input())
A = list(map(int, input().split()))

def trial_division(n):
  #素因数を格納するリスト
  counter = 0
  while n % 2 == 0:
      n //= 2
      counter += 1
  return counter

result = 0

for a in A:
  if a % 2 != 0: continue
  if a == 2:
    result += 1
  else:
    result += trial_division(a)

print(result)

Measured memory_bytes: 4524
import java.util.*;
class Main {
    public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);
	long N = sc.nextLong();
	long M = sc.nextLong();
	if(N>=M/2) System.out.println(M/2);
	else System.out.println(N+(M/2-N)/2);
    }
}

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

using namespace std;

#define REP(i, n)   for(int i = 0; i < (n); i++)
#define REPS(i, n)  for(int i = 1; i <= (n); i++)
#define RREP(i, n)  for(int i = (n)-1; i >= 0; i--)
#define RREPS(i, n) for(int i = (n); i > 0; i--)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define mp make_pair
#define mt make_tuple
#define pb push_back

using ll  = long long;
using pi  = pair<int, int>;
using pl  = pair<ll, ll>;
using vi  = vector<int>;
using vl  = vector<ll>;
using vs  = vector<string>;
using vb  = vector<bool>;
using vvi = vector<vi>;
using vvl = vector<vl>;

const int MOD = 1e9 + 7;
const int INF = 1e9 + 7;
const ll  INFL = 1e18;
const double PI = 3.141592653589793;
const double EPS = 1e-9;

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

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

    ll N; cin >> N;

    vl factor(N+1);
    for(ll i = 2; i <= N; i++)
    {
        ll tmp = i;
        for(ll j = 2; j * j <= i; j++)
        {
            while(tmp % j == 0)
            {
                factor[j]++;
                tmp /= j;
            }
        }
        if(tmp != 1) factor[tmp]++;
    }

    ll ans = 1;
    REP(i, (int)factor.size())
    {
        ans *= factor[i] + 1;
        ans %= MOD;
    }
    cout << ans << endl;
}


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

int main(){
int N, s, ansnum;
  cin >> N;
int cnt, ans;  
  ans = 0;
  
  for(int i = 1;i <= N;i++){
  cnt = 0;  
  if(i == 1) ansnum = 1;
  s = i;  
  while(s % 2 == 0){
  cnt++;
  s /= 2;  
  } 
  if(cnt > ans){
  ans = cnt;
  ansnum = i;  
    }
  }
  
  cout << ansnum << endl;
  
  return 0;
  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n)  for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
typedef long long ll;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> PP;
typedef priority_queue<ll> PQ;
typedef priority_queue<ll,vector<ll>,greater<ll>> SMALLPQ;
using vi=vector<ll>;
using vvi=vector<vector<ll>>;
using vc=vector<char>;
using vvc=vector<vector<char>>;
ll inf=10000000000007;
const int mod=1000000007;
void chmin(auto &a,auto b){if(b<a)a=b;}
void chmax(auto &a,auto b){if(a<b)a=b;}
int main(){
  int n,m;cin>>n>>m;
  vvi v(n,vi(3,inf));
  vector<vector<vector<P>>> g(n,vector<vector<P>>(3));
  rep(i,m){
    ll a,b;cin>>a>>b;a--;b--;
    g[a][0].push_back(P(b,1));
    g[a][1].push_back(P(b,2));
    g[a][2].push_back(P(b,0));
  }
  ll s,t;cin>>s>>t;s--;t--;
  v[s][0]=0;
  queue<P> q;
  q.push(P(s,0));
  while(!q.empty()){
    ll a=q.front().first,b=q.front().second;
    q.pop();
    for(auto i:g[a][b]){
      if(v[i.first][i.second]==inf){
        v[i.first][i.second]=v[a][b]+1;
        q.push(i);
      }
    }
  }
  if(v[t][0]==inf)cout<<-1<<endl;
  else cout<<v[t][0]/3<<endl;
}


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

int C[1001][1001];
string N1, N2;

int lcs()
{
	int m = N1.size();
	int n = N2.size();
	int maxl = 0;

	N1 = " " + N1;
	N2 = " " + N2;

	for (int i = 1; i <= m; i++)
		C[i][0] = 0;
	for (int i = 1; i <= n; i++)
		C[0][i] = 0;

	for (int i = 1; i <= m; i++)
	{
		for (int j = 1; j <= n; j++)
		{
			if (N1[i] == N2[j])
				C[i][j] = C[i - 1][j - 1] + 1;
			else
				C[i][j] = max(C[i - 1][j], C[i][j - 1]);

			maxl = max(maxl, C[i][j]);
		}
	}

	return maxl;
}

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

	int q;

	cin >> q;
	for (int i = 0; i < q; i++)
	{
		cin >> N1 >> N2;
		cout << lcs() << endl;
	}
		
	return 0;                                                                            
}


Measured memory_bytes: 7128
#include<iostream>

int main(){
    int a, b, sum = 1, ans = 0;

    std::cin >> a >> b;

    while(1){
       if(sum >= b){
           break;
       }else{
           sum = sum + a - 1;
           ans++;
       }
    }
    
    std::cout << ans << std::endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <cmath>
#include <climits>
#include <iomanip>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
int main(){
  string s;
  cin >> s;
  string t = s;
  reverse(s.begin(),s.end());
  if(s == t)cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
import std.stdio, std.string, std.conv, std.algorithm, std.numeric;
import std.range, std.array, std.math, std.typecons, std.container, core.bitop;

alias Pair = Tuple!(long, "p", int, "r");


void main() {
    int n;
    scan(n);

    auto x = new long[](n + 1);
    auto s = new int[](n + 1);

    foreach (i ; 1 .. n + 1) {
        scan(x[i], s[i]);
    }

    auto mh = MaxHeap!(Pair)(n);
    long d;
    long p = s[1];
    long ans = p;

    mh.push(Pair(s[1], 1));

    foreach (i ; 2 .. n + 1) {
        p += s[i] - (x[i] - x[i-1]);
        mh.push(Pair(p, i));
        ans = max(ans, p);
    }

    foreach (i ; 1 .. n) {
        d += x[i + 1] - x[i] - s[i];

        while (mh.front.r <= i) {
            mh.pop;
        }

        debug {
            writeln(d);
            writeln(mh.front);
        }

        ans = max(ans, mh.front.p + d);
    }

    writeln(ans);
}


struct MaxHeap(T) {
    private {
        int N, last;
        T[] data;
    }

    this(int n) {
        N = n;
        data = new T[](N);
        last = 0;
    }

    bool empty() {
        return last == 0;
    }

    bool full() {
        return last == N;
    }

    T front() {
        return data[0];
    }

    void heapUp(int x) {
        while (x > 0) {
            if (data[x] > data[(x - 1) / 2]) {
                swap(data[x], data[(x - 1) / 2]);
                x = (x - 1) / 2;
            }
            else {
                break;
            }
        }
    }

    void heapDown(int x) {
        while (2*x + 1 < last) {
            int ch = 2*x + 1;

            if (2*x + 2 < last && data[2*x + 2] > data[2*x + 1]) {
                ch = 2*x + 2;
            }

            if (data[ch] > data[x]) {
                swap(data[ch], data[x]);
                x = ch;
            }
            else {
                break;
            }
        }
    }

    void push(T x) {
        assert(!full);
        data[last++] = x;
        heapUp(last - 1);
    }

    void pop() {
        assert(!empty);
        data[0] = data[last - 1];
        last--;
        heapDown(0);
    }

    T[] array() {
        return data[0 .. last];
    }
}

unittest {
    auto mh = MaxHeap!(int)(5);

    mh.push(3);
    mh.push(1);
    mh.push(4);
    mh.push(5);
    mh.push(1);

    assert(mh.full);
    assert(mh.front == 5);

    mh.pop;
    mh.pop;
    mh.pop;

    assert(mh.front == 1);
}

void scan(T...)(ref T args) {
    string[] line = readln.split;
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}


void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}

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

int main() {
    int d, g;
    cin >> d >> g;

    vector<int> p(d), c(d);
    rep(i, 0, d) cin >> p[i] >> c[i];

    int ans = 1e9;
    rep(bit, 0, 1 << d) {
        int sum = 0, cnt = 0;
        rep(i, 0, d) {
            if (bit >> i & 1) {
                sum += (i + 1) * 100 * p[i] + c[i];
                cnt += p[i];
            }
        }

        if (sum >= g) ans = min(ans, cnt);
        else {
            for (int i = d - 1; i >= 0; i--) {
                if (sum >= g) break;
                if (bit >> i & 1) continue;
                rep(j, 0, p[i]) {
                    if (sum >= g) break;
                    sum += (i + 1) * 100;
                    cnt++;
                    if (j + 1 == p[i]) sum += c[i];
                }
            }
            ans = min(ans, cnt);
        }
    }

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

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<map>
#include<set>
#include<vector>
#include<queue>
#include<list>
#include<stack>
//#include<unordered_map>
using namespace std;
#define ll long long
#define dd cout<<endl
const long long int inf = 1e18+7;
const int mod = 998244353;

using namespace std;

inline ll int max(ll int a,ll int b) { return a>b?a:b; }
inline ll int min(ll int a,ll int b) { return a<b?a:b; }

const int maxn=2e5+10;

int a[maxn];

int b[maxn];

int main()
{
	int n,m,k;
	scanf("%d%d%d",&n,&m,&k);
	
	for(int i=0;i<n;i++)
		scanf("%d",&a[i]);
	
	for(int i=0;i<m;i++)
		scanf("%d",&b[i]);
	
	int maxx=-1,cnt=0,now=0,mark=-1;
	
	for(int i=0;i<n;i++)
	{
		if(now+a[i]<=k)
		{
			now+=a[i];
			cnt++;
			mark=i;
		}
		else
		{
			break;
		}
	}
	
	maxx=max(maxx,cnt);
	
	for(int i=0;i<m;i++)
	{
		if(now+b[i]<=k)
		{
			now+=b[i];
			cnt++;
			
			maxx=max(maxx,cnt);
		}
		else
		{
			while(now+b[i]>k && mark!=-1)
			{	
				now-=a[mark];
				mark--;
				cnt--;
			}
			
			if(now+b[i]<=k)
			{
				now+=b[i];
				cnt++;
				maxx=max(maxx,cnt);
				continue; 
			}
			else
			{
				break;
			}
		}
	}
	
	
	printf("%d\n",maxx);
	
	return 0;
}


Measured memory_bytes: 5324
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) (x).begin(),(x).end()
#define uniq(x) (x).erase(unique(ALL(x)),(x).end())
#define SORT(x) sort(ALL(x))
#define REV(x) reverse(ALL(x))
#define foreach(it,x) for(__typeof((x).begin()) it=(x).begin();it!=(x).end();it++)
#define debug(x) cerr<<#x<<"="<<(x)<<endl
#define gett() cerr<<"Time:"<<clock()<<"ms."<<endl
#define ri(x) scanf("%d",&x)
#define rl(x) scanf("%lld",&x)
#define rlcfpoj(x) scanf("%I64d",&x)
#define pi(x) printf("%d",x)
#define pl(x) printf("%lld",x)
#define plcfpoj(x) printf("%I64d",x)
#define lfd() printf("\n")
#define sp() printf(" ")
#define inrep(x) int x;scanf("%d",&x);while(x--)
#define testbit(mask,i) (((mask)>>(i))&1)
#define setbit(mask,i) ((mask)|(1<<i))
#define delbit(mask,i) ((mask)^(1<<i))
int a,b;
int main(){
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cin>>a>>b;
	int cur=1;
	int res=0;
	while(cur<b){
		res++;
		cur+=a-1;
	}
	cout<<res<<endl;
	return 0;
}



Measured memory_bytes: 256
require 'pp'

A,B = readline.chomp.split.map(&:to_i)

def calc(x)
  return 0 if x < 0
  sum = 0
  50.times do |d|
    t = 2**(d+1)
    count = (x+1)/t * t/2
    count += [0, (x+1)%t - t/2].max
    #pp [d,t,count]
    if count % 2 == 1
      sum += (1 << d)
    end
  end
  sum
end

puts calc(B) ^ calc(A-1)



Measured memory_bytes: 4092
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
using namespace std;
// using namespace __gnu_pbds;
#define lli long long int
#define llu unsigned long long int
#define pb push_back
#define rt return 0
#define endln "\n"
#define all(x) x.begin(), x.end()
#define sz(x) (lli)(x.size())
const lli MOD = 1e9 + 7;
// cout << fixed << setprecision(0) << pi <<endl;
// typedef tree<int, null_type, less<int>, rb_tree_tag,
//              tree_order_statistics_node_update>
//     new_data_set;
// for multiset
// typedef tree<int, null_type, less_equal<int>, rb_tree_tag,
//              tree_order_statistics_node_update>
//     new_data_set;
// order_of_key(val): returns the number of values less than val
// find_by_order(k): returns an iterator to the kth largest element (0-based)

void solve() {
    lli n, a;
    char ch;
    cin >> ch;
    lli val = ch - 'a';
    if (val >= 0 && val <= 25) {
        cout << "a" << endl;
    } else {
        cout << "A" << endl;
    }
}

int main(void) {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    // lli t; cin >> t; while(t--)
    solve();
    rt;
}

Measured memory_bytes: 3608
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def S(): return input().rstrip()
def LS(): return S().split()
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float("INF")

#solve
def solve():

    N, X = LI()

    def dfs(n, x):
        if x == 1 and n > 0:
            return 0
        elif x < 2 ** (n + 1) - 1:
            return dfs(n - 1, x - 1)
        elif x == 2 ** (n + 1) - 1:
            return 2 ** n
        elif x == 2 ** (n + 2) - 3:
            return 2 ** (n + 1) - 1
        else:
            return dfs(n - 1, x - 2 ** (n + 1) + 1) + 2 ** n
    print(dfs(N, X))
    return


#main
if __name__ == '__main__':
    solve()


Measured memory_bytes: 39024
#include <stdio.h>
int main()
{
    long int N,a,b,i;
    long long int K,c[100001]={};
    scanf("%ld%lld",&N,&K);
    for(i=0;i<N;i++){
        scanf("%ld%ld",&a,&b);
        c[a]+=b;
    }
    for(i=1;i<100001;i++){
        K-=c[i];
        if(K<=0){
            printf("%ld\n",i);
            break;
        }
    }
    return 0;
}

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

int main() {
  int n;
  cin >> n;
  vector<ll> a(n);
  rep(i, n) cin >> a[i];
  ll l = 0;
  rep(i, n) l += a[i];
  ll c = 0;
  ll ans = l;
  rep(i, n) {
    c += a[i];
    ans = min(ans, abs(l - 2 * c));
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 4828
h, w, n = map(int, input().split())
sy, sx = map(int, input().split())
l, r = 1, w
d, u = 1, h
for a, b in zip(input()[::-1], input()[::-1]):
	r = min(r + (b == "L"), w) - (a == "R")
	l = max(l - (b == "R"), 1) + (a == "L")
	u = min(u + (b == "D"), h) - (a == "U")
	d = max(d - (b == "U"), 1) + (a == "D")
	if l > r or d > u:break
print("YES" if l <= sx <= r and d <= h - sy + 1 <= u else "NO")

Measured memory_bytes: 3820
#include<iostream>
using namespace std;
typedef long long int ll;
static const int MAX_N = 100100;
static const int MOD = 1000000007;

ll N, K;

ll memo_fact_mod[MAX_N + 1];
ll memo_fact_inverse_mod[MAX_N + 1];
ll mod_pow(ll x, ll n){
	if(n == 0) return 1;
	ll res = mod_pow(x * x % MOD, n / 2);
	if(n % 2 == 1) res = res * x % MOD;
	return res;
}
ll fact_mod(ll n){
	ll res = 1;
	for(ll i = 1; i <= n; i++){
		res *= i;
		res %= MOD;
	}
	return res;
}
ll fact_inverse_mod(ll n){
	ll res = mod_pow(fact_mod(n), MOD - 2);
	return res;
}
ll combination(ll n, ll r){
	return (((fact_mod(n) * fact_inverse_mod(r)) % MOD) * fact_inverse_mod(n - r)) % MOD;
}
ll combination_with_memo(ll n, ll r){
	if(r == 0 || r == n) return 1;
	else return (((memo_fact_mod[n] * memo_fact_inverse_mod[r]) % MOD) * memo_fact_inverse_mod[n - r]) % MOD;
}
 
int main(){
	memo_fact_mod[0] = 0; memo_fact_mod[1] = 1LL;
	for(int i = 2; i <= MAX_N; i++){
		memo_fact_mod[i] = (memo_fact_mod[i - 1] * i) % MOD;
	}
	for(int i = 0; i <= MAX_N; i++){
		memo_fact_inverse_mod[i] = mod_pow(memo_fact_mod[i], MOD - 2);
	}
	cin >> N >> K;
	ll ans = 1;
	for(int i = 2; i * i <= K; i++){
		int cnt = 0;
		while(K % i == 0){
			cnt++;
			K /= i;
		}
		ans *= combination_with_memo(cnt + N - 1, cnt);
		ans %= MOD;
	}
	if(K != 1){
		ans *= N;
		ans %= MOD;
	}
	cout << ans << endl;
	return 0;
}


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

int main(){
    int n;
    cin >> n;
    bool flag = true;
    vector<string> words(n);
    for (int i = 0; i < n; i++){
        cin >> words[i];
        if (i != 0){
            int w1 = words[i-1].size();
            if (words[i][0] != words[i-1][w1-1]){
                flag = false;
            }
        }
    }
    if (!flag){
        cout << "No" << endl;
        return 0;
    }
    sort(words.begin(),words.end());
    for (int i = 0; i < n - 1; i++){
        if (words[i] == words[i+1]){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
}

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

int main() {
	string c1, c2;
	cin >> c1 >> c2;
	if (c1[0] == c2[2] && c1[1] == c2[1] && c1[2] == c2[0]) cout << "YES";
	else cout << "NO";
	return 0;
}
/*
31536000のコメント解説欄
ここテンプレで用意してるから、A問題とかだとこの先空欄の危険あり

180度回転させた時に一致するならば、C_11==C_23、C_12==C_22、C_13==C_21が成り立つ
よってこの3つが同時に成立しているか比較すれば良い
*/

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <string>
using namespace std;

int main(void)
{
    string S;
    //char S[5];                                                                
    cin >> S;
    //scanf("%s",S);                                                            
    if((S[0]==S[1]&&S[1]!=S[2]&&S[2]==S[3])||
       (S[0]==S[2]&&S[1]==S[3]&&S[2]!=S[3])||
       (S[0]==S[3]&&S[1]!=S[3]&&S[2]==S[1]))cout << "Yes" << endl;
    else cout << "No" << 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++)
#define ll long long
const ll INF = 2LL<<60;

int main()
{
    const int mod = 1000000007;

    int N;
    cin >> N;

    /*動的計画法*/

    int dp[101][4][4][4] = {0};

    //長さ0の文字列は1つ
    dp[0][3][3][3] = 1;

    //文字列の文字数
    rep(ln, N)
    {
        rep(i, 4)
        {
            rep(j, 4)
            {
                rep(k, 4)
                {
                    if(dp[ln][i][j][k] == 0) continue;
                    
                    rep(add, 4)
                    {
                        //ダメな条件
                        if(add == 2 && i == 1 && j == 0)    continue;
                        if(add == 2 && i == 0 && j == 1)    continue;
                        if(add == 1 && i == 2 && j == 0)    continue;
                        if(add == 2 && i == 1 && k == 0)    continue;
                        if(add == 2 && j == 1 && k == 0)    continue;

                        //文字列を作る
                        dp[ln + 1][add][i][j] += dp[ln][i][j][k];

                        //定数で割る
                        dp[ln + 1][add][i][j] %= mod;
                    }
                }
            }
        }
    }

    int ans = 0;
    rep(i, 4)
    {
        rep(j, 4)
        {
            rep(k, 4)
            {
                ans += dp[N][i][j][k];
                ans %= mod;
            }
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
s=input()
if s[0]!='A' or s[-1]=='C':
    print('WA')
    exit()
elif s[2:-1].count('C') !=1:
    print('WA')
    exit()
s=s[1:]
r='qazwsxeCdcrfvtgbyhnujmikolp'
for c in s:
    if c not in r:
        print('WA')
        exit()
print('AC')

Measured memory_bytes: 3060
package main

import (
	"fmt"
)

func main() {
	var (
		n     int
		count int
	)
	fmt.Scan(&n)
	nums := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&nums[i])
	}

	flag := true
	for flag {
		for i := 0; i < n; i++ {
			if nums[i]%2 == 0 {
				nums[i] /= 2
			} else {
				flag = false
			}
		}
		if flag {
			count++
		}
	}
	fmt.Println(count)
}


Measured memory_bytes: 512
#include<stdio.h>
#include<algorithm>
#include<functional> 
 
using namespace std;
   
int main(){
   
 int i, height[10];
 for(i=0;i<10;i++){
  scanf("%d", &height[i]);
 }
 sort(height, height+10, greater<int>());
   
 for(i=0;i<3;i++){
  printf("%d\n", height[i]);
 }

 return 0;
}

Measured memory_bytes: 1044
package main

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

func abs(x int64) int64 {
	if x < 0 {
		return -x
	}
	return x
}

func binarySearch(ng, ok int64, f func(int64) bool) int64 {
	for abs(ok-ng) > 1 {
		mid := (ng + ok) / 2
		if f(mid) {
			ok = mid
		} else {
			ng = mid
		}
	}
	return ok
}

func main() {
	var n, a, b int64
	fmt.Scan(&n, &a, &b)
	h := make([]int, n)
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	for i := int64(0); i < n; i++ {
		sc.Scan()
		h[i], _ = strconv.Atoi(sc.Text())
	}
	f := func(k int64) bool {
		var x int64
		for _, e := range h {
			rem := int64(e) - b*k
			if rem > 0 {
				x += (rem + a - b - 1) / (a - b)
			}
		}
		return x <= k
	}
	ans := binarySearch(0, 1e9*2, f)
	fmt.Println(ans)
}


Measured memory_bytes: 3072
#include <bits/stdc++.h>
#define all(x) x.begin(), x.end()
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define nav(...) "[ " << #__VA_ARGS__ ": " << (__VA_ARGS__) << " ] "
#define oo INT_MAX/2
using namespace std;
typedef pair<int, int> pii;
typedef long long ll;
template<class T> struct rge { T b, e; };
template<class T> rge<T> range(T i, T j) { return rge<T>{i, j}; }
struct debug {
#ifdef LOCAL
	~debug() {cerr<<endl;}
	template<class T> debug& operator<<(T x) {cerr<<boolalpha<<x; return *this;}
	template<class B, class C> debug& operator<< (pair<B, C> x){return *this<<"("<<x.first<<", "<<x.second<<")";}
	template<class T> debug& operator<<(rge<T> x) {
		*this<<"[";for(auto it=x.b;it!=x.e;it++){*this<<", "+2*(it==x.b)<<*it;}return *this<<"]";}
	template<class T> debug& operator<<(vector<T> x){ return *this<<range(all(x));}
#else
	template<class T> debug& operator <<(const T&) {return *this;}
#endif
};


bool solve(void) {

	int n, k;
	cin>>n>>k;
	vector<double> arr(n);
	for(double& x : arr) cin>>x;
	double ans = 0;

	double sum = 0;
	for(int i = 0; i < k; i++)
		sum += 0.5*(arr[i]+1);
	ans = sum;
	
	for(int i = k; i < n; i++) {
		sum += 0.5*(arr[i]+1) - 0.5*(arr[i-k]+1);
		ans = max(ans, sum);
	}

	cout << ans << endl;
	return true;
}

int main(int argc, char* argv[]) {
	
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout << fixed << setprecision(10);
	solve();
	return 0;
}


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

long long m = 998244353;

int main(void){

    long long N, K;

    scanf("%lld%lld", &N, &K);

    long long L[K], R[K];

    for(int i = 0; i < K; i++){
        scanf("%lld%lld", &L[i], &R[i]);
    }

    long long c[N];

    for(int i = 0; i < N; i++){
        c[i] = 0;
    }
    c[0] = 1;

    for(int i = 1; i < N; i++){
        c[i] = c[i-1];
        for(int j = 0; j < K; j++){
            if(i - L[j] < 0){
                continue;
            }else if(i - R[j] <= 0){
                c[i] = (c[i] + c[i - L[j]]) % m;
            }else{
                c[i] = (c[i] + c[i - L[j]] - c[i - R[j] - 1]) % m;
            }
        }
    }

    long long t = c[N-1] - c[N-2];

    while(t < 0){
        t += m;
    }

    printf("%lld\n", t % m);

    return 0;
}

Measured memory_bytes: 3276
import java.util.Scanner;

class Main{
	public static void main(String arg[]) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		sc.nextLine();
		String str = sc.nextLine();
		sc.close();
		String[]S = str.split(" "); 
		int[] n = new int[N];
		int count = 0;
		
		for(int i = 0; i < N; i++) {
			n[i] = Integer.valueOf(S[i]);
		}
		for(int i = 0; i < 10000; i++) {
			for ( int j = 0; j< n.length; j++) {
				if(n[j] % 2 == 0) {
					n[j]= n[j]/2;
				}else {
					System.out.println(count);
					System.exit(0);
				}
			}
			count++;
		}
	}
}

Measured memory_bytes: 23892
S = input()
T = input()
candidates = []
for i in range(0,len(S)-len(T)+1):
    cnt = 0
    for j in range(len(T)):
        if S[i+j] == "?" or S[i+j] == T[j]:
            cnt += 1
    if cnt == len(T):
        candidate = S[:i] + T + S[i+len(T):]
        candidates.append(candidate)
#print(candidates)

if len(candidates) == 0:
    ans = "UNRESTORABLE"
else:
    candidates.sort()
    ans = candidates[0].replace("?","a")
print(ans)


Measured memory_bytes: 3060