akhauriyash/Code-Regression huggingface dataset:
/*
 * Author:  heyuhhh
 * Created Time:  2020/6/21 20:17:29
 */
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <vector>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <iomanip>
#include <assert.h>
#include <functional>
#include <numeric>
#define MP make_pair
#define fi first
#define se second
#define pb push_back
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
#define INF 0x3f3f3f3f
#define Local
#ifdef Local
  #define dbg(args...) do { cout << #args << " -> "; err(args); } while (0)
  void err() { std::cout << std::endl; }
  template<typename T, typename...Args>
  void err(T a, Args...args) { std::cout << a << ' '; err(args...); }
  template <template<typename...> class T, typename t, typename... A> 
  void err(const T <t> &arg, const A&... args) {
  for (auto &v : arg) std::cout << v << ' '; err(args...); }
#else
  #define dbg(...)
#endif
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
//head
const int N = 1e5 + 5;

void run() {
    int n; cin >> n;
    vector <int> a(n);
    vector <int> cnt(N);
    ll sum = 0;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        ++cnt[a[i]];
        sum += a[i];
    }
    int q; cin >> q;
    while (q--) {
        int x, y; cin >> x >> y;
        sum -= 1ll * cnt[x] * x;
        sum += 1ll * cnt[x] * y;
        cnt[y] += cnt[x];
        cnt[x] = 0;
        cout << sum << '\n';
    }
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    cout << fixed << setprecision(20);
    run();
    return 0;
}

Measured memory_bytes: 3988
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String N = scan.next();
		if(N.substring(0, 1).equals(N.substring(1, 2)) && N.substring(1, 2).equals(N.substring(2, 3))) {
			System.out.println("Yes");
		} else if(N.substring(1, 2).equals(N.substring(2, 3)) && N.substring(2, 3).equals(N.substring(3, 4))) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
		scan.close();

	}

}


Measured memory_bytes: 22740
#include<stdio.h>
#include<algorithm>
#include<string.h>
using namespace std;
int dp[80001][11][2];
char str[131072];
int main(){
	while(scanf("%s",str),str[0]-'0'){
		int len=strlen(str);
		for(int i=0;i<=len;i++)
			for(int j=0;j<11;j++)
				dp[i][j][0]=dp[i][j][1]=0;
		dp[0][str[0]-'0'][0]=1;
		for(int i=1;i<len;i++){
			if(str[i]-'0')dp[i][str[i]-'0'][0]=1;
			for(int j=0;j<11;j++){
				dp[i][j][0]+=dp[i-1][(11+j-str[i]+'0')%11][1];
				dp[i][j][1]+=dp[i-1][(j+str[i]-'0')%11][0];
			}
		}
		int ret=0;
		for(int i=0;i<len;i++)ret+=dp[i][0][0]+dp[i][0][1];
		printf("%d\n",ret);
	}
}

Measured memory_bytes: 7712
#include<stdio.h>
int main()
{
	int n,i;
	long long a=0;
	scanf("%d",&n);
	for(i=1;i<=n;i++){
		if(i%3!=0&&i%5!=0){
			a+=i;
		}
	}
	printf("%lld\n",a);
	return 0;
}


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

#define ll long long
#define scan(x) scanf("%lld",&x)
#define pb push_back
#define mp make_pair

using namespace std;



int main()
{
    ll i,j,k,l,m;
    int a,b,t;
    cin >> a >> b >> t;
    cout << b*(t/a);
}


Measured memory_bytes: 256
#include<stdio.h>

int main(void){
  char s[3];
  scanf("%s",s);
  for(int i=0;i<3;i++){
    if(s[i]=='1'){
      s[i]='9';
    }else if(s[i]=='9'){
      s[i]='1';
    }
  }
  printf("%s\n",s);
  return 0;
}


Measured memory_bytes: 1644
#include <bits/stdc++.h>
#define all(v) (v).begin(), (v).end()
typedef long long int lint;
using namespace std;

int main() {
    int n;
    cin >> n;
    vector<pair<int, int>> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i].first;
        a[i].second = i % 2;
    }
    sort(all(a));
    int ans = 0;
    for (int i = 0; i < n / 2; i++) {
        if (a[2 * i + 1].second == 0) {
            ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 1024
package main

import (
	"fmt"
)

type (
	//   1
	// 4 2 3 5
	//   6
	Dice struct {
		face [6]int
	}
)

func (d *Dice) Rotate(direction rune) int {
	switch direction {
	case 'W':
		d.face[0], d.face[2], d.face[5], d.face[3] =
			d.face[2], d.face[5], d.face[3], d.face[0]
	case 'E':
		d.face[0], d.face[2], d.face[5], d.face[3] =
			d.face[3], d.face[0], d.face[2], d.face[5]
	case 'N':
		d.face[0], d.face[1], d.face[5], d.face[4] =
			d.face[1], d.face[5], d.face[4], d.face[0]
	case 'S':
		d.face[0], d.face[1], d.face[5], d.face[4] =
			d.face[4], d.face[0], d.face[1], d.face[5]
	default:
		panic(fmt.Sprintf("Undefind direction: %c", direction))
	}
	return d.Get()
}

func (d *Dice) Get() int {
	return d.face[0]
}

func (d Dice) String() string {
	return fmt.Sprintf(
		`  %d
%d %d %d %d 
  %d
`, d.face[0], d.face[3], d.face[1], d.face[2], d.face[4], d.face[5])
}

func main() {
	dice := Dice{}
	for i := 0; i < len(dice.face); i++ {
		fmt.Scan(&dice.face[i])
	}

	var n int
	fmt.Scan(&n)

	var a, b int
	for k := 0; k < n; k++ {
		fmt.Scan(&a, &b)
	loop:
		for i := 0; i < 4; i++ {
			for i := 0; i < 4; i++ {
				if dice.face[1] == b {
					break loop
				}
				dice.Rotate('N')
			}
			dice.Rotate('W')
		}
		for i := 0; i < 4; i++ {
			if dice.face[0] == a {
				break
			}
			dice.Rotate('W')
		}
		fmt.Println(dice.face[2])
	}
}



Measured memory_bytes: 1092
#include <bits/stdc++.h>
using namespace std;
int main(){
    int K, A, B, C;
    cin >> K >> A >> B;
    C = K;
    while(1){
        if(A <= K && K <= B) {
            cout << "OK" << endl;
            break;
        }
        if(B < K){
            cout << "NG" << endl;
            break;
        }
        K += C;
    }
    return 0;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
//------------------------------------------------------------------------------
template<typename T, int N, T F(const T& a, const T& b)>
struct SegTree
{
public:
    SegTree()
    {
        dat = vector<T>(N * 2 - 1, 0);
    }

    void update(int i, T x)
    {
        i += N - 1;
        dat[i] = x;
        while (i > 0)
        {
            i = (i - 1) / 2;
            dat[i] = F(dat[i * 2 + 1], dat[i * 2 + 2]);
        }
    }

    T query(int a, int b, int k = 0, int l = 0, int r = N)
    {
        if (r <= a || b <= l) return 0;
        if (a <= l && r <= b) return dat[k];
        else
        {
            T vl = query(a, b, k * 2 + 1, l, (l + r) / 2);
            T vr = query(a, b, k * 2 + 2, (l + r) / 2, r);
            return F(vl, vr);
        }
    }

    vector<T> dat;
};

/*------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧  
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     
　　　　／　　　＼　 　  |　|     
　　　 /　　 /￣￣￣￣/　　|  
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿  
　 　　　＼/＿＿＿＿/　（u　⊃  
------------------------------------------------------------------------------*/











//------------------------------------------------------------------------------
ll N, A, B;
ll h[100010];
//------------------------------------------------------------------------------
bool Enough(ll n)
{
    ll need = 0;
    rep(i, 0, N)
    {
        if (h[i] > B * n)
        {
            need += (h[i] - (B * n) + (A - B - 1LL)) / (A - B);
        }
    }
    return need <= n;
}

void _main()
{
    cin >> N >> A >> B;
    rep(i, 0, N) cin >> h[i];

    ll l = -1LL;
    ll r = INT_MAX;
    while (r - l > 1LL)
    {
        ll m = (l + r) / 2LL;
        if (Enough(m)) r = m;
        else l = m;
    }
    cout << r << endl;
}


Measured memory_bytes: 1024
n = gets.chomp.to_i
ary = gets.chomp.split.map(&:to_i)

n.times do |i|
  ary[i] -= i
end
ary.sort!

b=ary[n/2]
ans = 0
ary.each do |item|
  ans += (item-b).abs
end
puts ans


Measured memory_bytes: 19456
#include <bits/stdc++.h>
#define loop(n, i) for(int i=0;i<n;i++)
#define loop1(n, i) for(int i=1;i<=n;i++)
#define HERE cout << "HERE: " << __LINE__ << endl;
#define INSP(v) cout << v << " at " << __LINE__ << endl;
using namespace std;
using ll = long long;
template <class T>
using V = vector<T>;

void solve(ll N, ll A, ll B, ll C, ll D, string S){
    A--; B--; C--; D--;
    for (int i = A; i <= max(C, D); i++) {
        if (S[i] == '#' && S[i + 1] == '#') {
            cout << "No" << endl;
            return;
        }
    }
    if (C > D) {
        // A < B < D < C
        int mbd = 0;
        int j = 0;
        for (int i = B - 1; i <= min(D + 1, N - 1); i++) {
            if (S[i] == '.') j++;
            else j = 0;
            mbd = max(mbd, j);
        }
        if (mbd < 3) {
            cout << "No" << endl;
            return;
        }
    }
    cout << "Yes" << endl;
}

int main(){
    ll N, A, B, C, D;
    string S;
    cin >> N >> A >> B >> C >> D >> S;
    solve(N, A, B, C, D, S);
    return 0;
}



Measured memory_bytes: 772
#include <bits/stdc++.h>
 
using namespace std;
 
#define FOR(i, n) for(int i = 0; i < (int) n; i++)
#define rall(x) x.rbegin(), x.rend()
#define all(x) x.begin(), x.end()
#define PB push_back
#define F first
#define S second
 
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
 
const ll MOD = 1e9+7;

int main(){
	ios::sync_with_stdio(false); cin.tie(0);
 	
 	int a, b, c, k; cin >> a >> b >> c >> k;

 	int ans = 0;
 	ans += min(a, k);
 	k -= min(a, k);
 	k -= min(b, k);
 	ans -= min(c, k);

 	cout << ans << '\n';

	return 0;
}

Measured memory_bytes: 3648
#include<stdio.h>
int main(){
  int w,h,x,y;
  int cut;
  double ans;
  scanf("%d %d %d %d",&w,&h,&x,&y);
  ans=(double)w*h/2;
  if(w==x*2 && h==y*2){
    cut=1;
  }
  else cut=0;
  printf("%f %d",ans,cut);
  return 0;
}


Measured memory_bytes: 128
package main

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

var sc = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

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

func nextInt() int {
	a, _ := strconv.Atoi(next())
	return a
}

type XorVectorSet struct {
	bases []int
	dim   int
}

func newXorVectorSet() *XorVectorSet {
	return &XorVectorSet{}
}

// asuume s.contain(a) == false
func (s *XorVectorSet) add(a int) {
	s.bases = append(s.bases, a)
	s.dim++

	for j := s.dim - 1; j > 0; j-- {
		if s.bases[j-1] > s.bases[j] {
			break
		}
		s.bases[j-1], s.bases[j] = s.bases[j], s.bases[j-1]
	}

	for i := 1; i < s.dim; i++ {
		if s.bases[i]^s.bases[i-1] < s.bases[i] {
			s.bases[i] = s.bases[i] ^ s.bases[i-1]

			for j := i + 1; j < s.dim; j++ {
				if s.bases[j-1] > s.bases[j] {
					break
				}
				s.bases[j-1], s.bases[j] = s.bases[j], s.bases[j-1]
			}
		}
	}
}

func (s *XorVectorSet) contain(a int) bool {
	x := a
	for i := 0; i < s.dim; i++ {
		if s.bases[i]^x < x {
			x = s.bases[i] ^ x
		}
		if x == 0 {
			return true
		}
	}
	return false
}

func answer(N int, A []int, S string) int {
	s := newXorVectorSet()
	for i := N - 1; i >= 0; i-- {
		switch S[i] {
		case '0':
			if !s.contain(A[i]) {
				s.add(A[i])
			}
		case '1':
			if !s.contain(A[i]) {
				return 1
			}
		}
	}
	return 0
}

func main() {
	buf := make([]byte, 1024*1024)
	sc.Buffer(buf, bufio.MaxScanTokenSize)
	sc.Split(bufio.ScanWords)
	defer out.Flush()

	T := nextInt()
	for t := 0; t < T; t++ {
		N := nextInt()
		A := make([]int, N)
		for i := 0; i < N; i++ {
			A[i] = nextInt()
		}
		S := next()

		fmt.Fprintln(out, answer(N, A, S))
	}
}


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

void amax(int& x,int y){if(x<y)x=y;}

signed main(){
int n,m;cin>>n>>m;
vector<int>a(m);
for(auto&& u:a)cin>>u;
sort(begin(a),end(a),greater<int>());

vector<int>dp(n+15,-1);
dp[0]=0;

vector<int> digit={0,2,5,5,4,5,6,3,7,6};
rep(i,n){
if(dp[i]<0)continue;
for(auto&& u:a){
amax(dp[i+digit[u]],dp[i]+1);
}
}
//rep(i,30)cerr<<dp[i]<<" ";
//cerr<<endl;
int num=dp[n];
int cnt=n;
//cerr<<num;
rep(i,num){
for(auto&& u:a){
if(cnt-digit[u]>=0&&dp[cnt]==dp[cnt-digit[u]]+1){
	cout<<u;cnt-=digit[u];break;
}
}
}
cout<<endl;	
}



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

typedef long long int ll;
typedef vector<int> vi;
typedef set<int> si;
typedef vector<ll> vll;

#define pvec(v) for(auto e: v) cout << e << " ";
#define IO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define forn(s, e) for(int i=s; i<e; ++i)
#define pb push_back
#define INF 1000000000

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

	int freq[n+1] = {0};
	int val;
	for(int i=1; i<n; ++i){
		cin >> val;
		++freq[val];
	}

	for(int i=1; i<=n; ++i){
		cout << freq[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 4432
#include <iostream>
using namespace std;
//C - To Infinity
int main(void){
    string s;
    long long k;
    std::cin >> s >>k;
    int ans=0;
    for (int i = 0; i < 100; i++) {
        int a=int(s[i]-'0');
        if(a==1){
            k--;
            if(k==0){
                ans=1;
                break;
            }
        }else{
            ans=a;
            break;
        }
    }
    std::cout << ans << std::endl;
}


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

typedef long long ll;

template<class T> std::ostream& operator << (std::ostream& os, std::vector< T > v)
{
  for (ll i = 0; i < (ll)v.size(); i++){ os << " [" << i << "]" << v[i]; if (i % 10 == 9) os << std::endl; }
  return os;
}

template<class T, class S> std::ostream& operator << (std::ostream& os, std::map< T, S > m)
{
  ll i = 0; for (auto p : m){ os << " [" << i << "]" << p.first << "->" << p.second; i++;}
  return os;
}

template<class T> std::ostream& operator <<(std::ostream& os, std::vector< std::vector<T> > vv)
{
  for (auto& vec : vv){ os << vec; }
  return os;
}

void print(){ std::cout << std::endl; }
template<typename H> void print(H head) { std::cout << head << std::endl; }
template<typename H, typename... T> void print(H head, T... tail){ std::cout << head << " ", print(tail...); }

int main()
{
  std::cin.tie(nullptr);
  std::cout.tie(nullptr);
  std::ios::sync_with_stdio(false);

  ll r;
  std::cin >> r;

  print((ll)std::pow(r, 2));
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h> 
using namespace std; 
typedef long long int ll;
typedef long double ld;
typedef unsigned long long int ull;
const long long int m=pow(10,9)+7;

int main() 
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    double w,h,x,y;
    cin>>w>>h>>x>>y;
    double ans=(w*h)/2.0;
    cout<<fixed<<setprecision(10)<<ans<<" ";
    if(x==w/2&&y==h/2)
        cout<<"1"<<endl;
    else
        cout<<"0"<<endl;
    return 0;
}

Measured memory_bytes: 3728
/*"Success isn't permanent, failure isn't fatal,
                                      it's the courage to continue that counts"*/
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
using namespace std;
//typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
#define ll long long 
#define scn(n) scanf("%d",&n)
#define lscn(n) scanf("%lld",&n)
#define lpri(n) printf("%lld",n)
#define pri(n) printf("%d",n)
#define pln() printf("\n")
#define priln(n) printf("%d\n",n)
#define lpriln(n) printf("%lld\n",n)
#define rep(i,init,n) for(int i=init;i<n;i++)
#define pb push_back     
#define mp make_pair
#define F first
#define S second
#define gcd __gcd
#define inf INT_MAX
#define ninf INT_MIN
const int mod=1e9+7;         
const int N=2e5+4;

ll fac[N],infac[N];
 
ll me(ll a,ll b)
{
    ll res=1;
 
    while(b)
    {
        if(b&1)
        res=(res*a)%mod;
 
        b>>=1;
 
        a=(a*a)%mod;
    }
 
    return res;
}
 
ll mi(ll a)
{
    return me(a,mod-2);
}
 
void factorial()
{
   fac[0]=1;
 
   for(ll i=1;i<N;i++)
   fac[i]=(i*fac[i-1])%mod;
 
   infac[N-1]=mi(fac[N-1]);
 
   for(ll i=N-1;i>=1;i--)
   infac[i-1]=(i*infac[i])%mod;
}
 
ll ncr(ll n,ll r)
{
    if(n<r)
    return 0;
 
    ll val=fac[n];
 
    val=(val*infac[r])%mod;
 
    val=(val*infac[n-r])%mod;
 
    return val;
}

ll sz[N],dp[N];

int n;

vector<int> v[N];

void dfs(int node,int par)
{
	sz[node]=1;

	int sum=n-1;

	for(int it:v[node])
	if(it!=par)
	{
		dfs(it,node);

		sum-=sz[it];

		sz[node]+=sz[it];
	}

	dp[node]=fac[sz[node]-1];

	for(int it:v[node])
	if(it!=par)
	{
		dp[node]=(dp[node]*infac[sz[it]])%mod;
		
		dp[node]=(dp[node]*dp[it])%mod;
	}
}
 
ll ans[N];

void dfs1(int node,int par)
{
	//ans[node]=dp[node];

	for(int it:v[node])
	if(it!=par)
	{
		ll temp=dp[node];

		temp=(temp*fac[sz[it]])%mod;

		temp=(temp*fac[n-1-sz[it]])%mod;

		temp=(temp*infac[n-1])%mod;

		temp=(temp*mi(dp[it]))%mod;

		dp[it]=(dp[it]*fac[n-1])%mod;

		dp[it]=(dp[it]*infac[sz[it]-1])%mod;

		dp[it]=(dp[it]*infac[n-sz[it]])%mod;

		dp[it]=(dp[it]*temp)%mod;

		dfs1(it,node);
	}
}

int main()
{
	factorial();

	scn(n);

	rep(i,0,n-1)
	{
		int a,b;

		scn(a); scn(b);

		v[a].pb(b); v[b].pb(a);
	}

	dfs(1,-1);

	dfs1(1,-1);

	//ans[1]=dp[1];

	rep(i,1,n+1)
	lpriln(dp[i]);

    return 0;
}

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

// GCD, LCM
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}
 
int main()
{
    int S,h,m,s;
    cin>>S;

    h=S/(60*60);
    S%=60*60;
    m=S/60;
    s=S%60;

    cout<<h<<":"<<m<<":"<<s<<endl;
 
    return 0;
}


Measured memory_bytes: 3120
#include <bits/stdc++.h>
#define sz(c)      int(c.size())
#define rep(i,a,b) for (int i=a; i<(b); ++i)
#define per(i,a,b) for (int i=(b)-1; i>=(a); --i)
using namespace std;
using ll = long long;

int a[220000];

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

	string s;
	cin>>s;
	per(i,0,sz(s)) {
		a[i]+=a[i+1];
		if (s[i]=='W') ++a[i];
	}

	ll res=0;
	rep(i,0,sz(s)) if (s[i]=='B') res+=a[i];
	cout<<res<<"\n";
}


Measured memory_bytes: 1300
using static System.Console;

class Program
{
  static void Main(string[] args)
  {
    string S = ReadLine();
    string N = ReadLine();
    int count =0;
    for(int i = 0;i < 3;i++)
    {
      if(S[i] == N[i])count++;
    }
    WriteLine(count);
  }
}

Measured memory_bytes: 13140
a,b,c,d,e,f=list(map(int,input().split()))
val=0
lst=[0,0]
for i in range(31):
	for j in range(31):
		for k in range(101):
			for l in range(101):
				wtr=100*i*a+100*j*b
				sgr=k*c+l*d
				if wtr==0 or wtr>f or sgr>f or wtr+sgr>f:
					break
				else:
					if sgr/(sgr+wtr)<=e/(e+100) and sgr/(sgr+wtr)>val:
						val=sgr/(sgr+wtr)
						lst[0]=sgr
						lst[1]=sgr+wtr
if lst[0]==0:
	print(100*a,0)
else:
	print(lst[1],lst[0])

Measured memory_bytes: 3188
import java.util.Scanner;

public class Main {
    public static void main(String args[]) {
        try (Scanner in = new Scanner(System.in)) {
            String X = in.next();
            String Y = in.next();

            if (X.equals(Y)) {
                System.out.println("=");
            } else if (X.charAt(0) > Y.charAt(0)) {
                System.out.println(">");
            } else {
                System.out.println("<");
            }
        }
    }
}


Measured memory_bytes: 21844
N = int(input())
a = list(map(int, input().split()))
#a = [list(map(int, list(input()))) for i in range(N + 1)]
# L, R, d = map(int, input().split())
cnt = 0
for i in range(0, N, 2):

    if a[i] % 2 != 0:
        cnt += 1
print(cnt)
        


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

using namespace std;

#define DUMP(x) std::cerr << (#x) << " = " << (x) << "\n"
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define REP(i, k, n) for (int i = (k); i < (int)(n); ++i)
#define ALL(r) r.begin(), r.end()
#define YES puts("YES")
#define Yes puts("Yes")
#define NO puts("NO")
#define No puts("No")
#define IMP puts("IMPOSSIBLE")
#define Imp puts("Impossible")
#define imp puts("impossible")
#define M1 puts("-1")
#define pb push_back

template <typename T>
T dup(T x, T y)
{
    return (x + y - 1) / y;
};
template <typename A, size_t N, typename T>
inline void arrayFill(A (&array)[N], const T &val) { std::fill((T *)array, (T *)(array + N), val); }

using ll = int64_t;
using vint = vector<int32_t>;
using vvint = vector<vint>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pint = pair<int32_t, int32_t>;
using pll = pair<ll, ll>;
using setint = set<int32_t>;
using setstr = set<string>;
using qint = queue<int32_t>;
using qpint = queue<pint>;

constexpr std::int32_t INF = 1001001001;
constexpr std::int64_t LINF = 1001001001001001001;

vector<vector<pint>> g(100005);
bool seen[100005];
vint x(100005, 0);
bool is_ok = true;

void dfs(int a)
{
    for (auto to : g[a])
    {
        if (!seen[to.first])
        {
            seen[to.first] = true;
            x[to.first] = x[a] + to.second;
            dfs(to.first);
        }
        else
        {
            if (x[to.first] != x[a] + to.second)
            {
                is_ok = false;
            }
        }
    }
    return;
}

void Main()
{
    arrayFill(seen, false);
    int n, m;
    cin >> n >> m;

    rep(i, m)
    {
        int l, r, d;
        cin >> l >> r >> d;
        g[l].emplace_back(r, d);
        g[r].emplace_back(l, -d);
    }

    rep(i, n)
    {
        if (seen[i])
            continue;
        dfs(i);
    }
    if (is_ok)
        Yes;
    else
        No;
}

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


Measured memory_bytes: 11136
#include <stdio.h>
#include<iostream>
#include<algorithm>
#include<string.h>
#define inf 0x3f3f3f3f
using namespace std;
//long long a[inf]
int da(int i)
{
    if(i%3==0||i%5==0)
        return 1;
    else
        return 0;
}
int main()
{
    long long  sum=0;
    long long n;
    scanf("%lld",&n);
    int m,p;
    for(int i=1;i<=n;i++)
    {
        m=da(i);
        p=da(i);
        if(m==0&&p==0)
            sum+=i;
    }
    printf("%lld\n",sum);
    return 0;
}


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

using namespace std;

const int maxn = 2e5 + 5;
int n, k, a[maxn], maxl = 0;
bool judge(int x)
{
    int cnt = 0;
    for(int i = 1; i <= n; ++i)
    {
        if(cnt + (a[i] - 1) / x > k) return false;
        else cnt += (a[i] - 1) / x;
    }
    return true;
}

int main()
{
    scanf("%d%d", &n, &k);
    for(int i = 1; i <= n; ++i)
    {
        scanf("%d", &a[i]);
        maxl = max(maxl, a[i]);
    }
    int l = 1, r = maxl, mid = 0, ans = -1;
    while(l <= r)
    {
        mid = (l + r) / 2;
        if(judge(mid)) ans = mid, r = mid - 1;
        else l = mid + 1;
    }
    printf("%d", ans);
    return 0;
}

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

int main() {
  int n;
  cin >> n;
  vector<int> w(n);
  double sum = 0;
  for(int i = 0; i < n; i++) {
    cin >> w.at(i);
    sum += w.at(i);
  }
  double x = sum / 2;
  double mins;
  for(int i = 0; i < n; i++) {
    int a = 0;
    for (int j = 0; j <= i; j++) {
      a += w.at(j);
    }
    double y = x - a;
    if (y == 0) {
      mins = 0;
      break;
    }
    if (y < 0) {
      y *= -1;
      mins = min(y, mins);
      break;
    }
    if (i == 0) {
      mins = y;
    }
    mins = min(y, mins);
  }
  cout << 2 * mins << endl;
}


Measured memory_bytes: 256
import itertools

N = int(input())
P = list(map(int, input().split()))
Q = list(map(int, input().split()))
l = []
for i in range(N):
    l.append(i + 1)

# 重複なしのあらゆる並び(itertools.permutations)
l = list(map(list, itertools.permutations(l)))
print(abs(l.index(P) - l.index(Q)))


Measured memory_bytes: 10228
#include <string>
#include <vector>
#include <iostream>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <functional>
#include <utility>
#include <numeric>
#include <map>
using namespace std;


#define prec(i) cout << fixed << setprecision(i)

void outPut_YN(bool isYes) {
	if(isYes)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}

const long long MOD = 1000000007;

long long fact(long long k) {
	long long sum = 1;
	for (long long i = 2; i <= k; i++)
		sum *= i;

	return sum;
}

long long fact_mod(long long k) {
	long long sum = 1;
	for (long long i = 2; i <= k; i++)
		sum = (sum * i) % MOD;

	return sum;
}

int ctoi(char c) {
	if (c >= '0' && c <= '9')
		return c - '0';
	else
		return -1;
}

long long pow_mod(int a, int b) {
	long long ans = 1;
	for (int i = 0; i < b; i++)
		ans = (ans * a) % MOD;

	return ans;
}

long long powll(long long a, long long  b) {
	long long ans = 1;
	for (long long i = 0; i < b; i++)
		ans = ans * a;

	return ans;
}

long long modinv(long long a) {

	long long b = MOD, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= MOD;
	if (u < 0) u += MOD;

	return u;
}

long long _gcd(long long a, long long b)
{
	if (a < b)
		swap(a, b);

	if (a % b == 0)
		return b;
	else
		return _gcd(b, a % b);
}

int main()
{
	long long h, sum = 1;

	cin >> h;

	long long d = 1;
	while ((d = (d * 2)) <= h) {
		sum += d;
	}

	cout << sum << endl;

	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
	      Scanner sc = new Scanner(System.in);
	      int n = sc.nextInt();
	      int a = sc.nextInt();
	      String ans = "No";
	      if(n%500 <= a ) {
	    	  ans = "Yes";
	      }
	      System.out.println(ans);
	}
}

Measured memory_bytes: 21844
#pragma GCC optimize("O3")
#pragma GCC target("avx")
#include <bits/stdc++.h>
#define rep(i ,n) for(int i=0;i<(int)(n);++i)
#define repr(i ,n) for(int i=n;i>(int)(n);--i)
#define rep1(i ,n) for(int i=1;i<=(int)(n);++i)
#define ALL(a) a.begin(), a.end()
#define RSORT(a) sort(ALL(a),greater<>())
#define SORT(a) sort(ALL(a))
#define bit_check(bit, i) ((bit>>(i)) & 1)
#define PRINT(x) printf("%d\n",(x));
#define ENDL printf("\n");
using namespace std;
typedef long long int i64;
typedef unsigned long long u64;
template<class T> using V = vector<T>;
using VI = V<int>;
const int INF = 2e9;
const i64 MOD = 1e9 + 7;

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;}
struct Init_On{
    Init_On(){
        cin.tie(nullptr);
        ios_base::sync_with_stdio(false);
        cout << fixed << setprecision(16);
    }
};

signed main(){
    Init_On s;
    int a , b , c , d;
    cin >> a >> b >> c >> d;

    bool takahashi_win = false;

    for(int i = 0; ;++i ){
        if( i % 2 == 0) c -= b;
        else if ( i % 2 != 0) a-= d;

        if(c<=0 && a >0) { takahashi_win = true; break;}
        else if (a<=0 && c >0 ) break;
        }
        cout << (takahashi_win ? "Yes" : "No") << endl;
}

Measured memory_bytes: 3652
import sys
sys.setrecursionlimit(1000000) # 再帰上限を増やす

def main():
    input = sys.stdin.readline  # 文字列に対してinputした場合は、rstripするのを忘れずに！
    N, K = map(int, input().split())
    H = list(map(int, input().split()))

    dp = [float("inf")] * (N)
    dp[0] = 0

    for i in range(1, N):
        min_value = dp[i]
        for k in range(1, K+1):
            if i - k < 0:
                break
            min_value = min(dp[i-k] + abs(H[i] - H[i-k]), min_value)
        dp[i] = min_value
    print(dp[N-1])

if __name__ == '__main__':
    main()

Measured memory_bytes: 53596
#include <iostream>
#include <string>
#define llt long long int

using namespace std;
int main()
{
    string c;
    cin >> c;

    if(c[2] == c[3] && c[4] == c[5]) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
}


Measured memory_bytes: 256
A, B, O, AB = 0, 0, 0, 0
while True :
    try    : 
        number, blood = input().split(',')
        if   blood == 'A' : A += 1
        elif blood == 'B' : B += 1
        elif blood == 'O' : O += 1
        else : AB += 1
    except : break
print(A)
print(B)
print(AB)
print(O)

Measured memory_bytes: 7412
#include<bits/stdc++.h>
using namespace std;
#define next Next
#define gc getchar
struct node{
	double x,y;
}a,b;
node operator - (node a,node b)
{
	return (node){a.x-b.x,a.y-b.y};
}
double DJ(node a,node b)
{
	return a.x*b.x+a.y*b.y;
}
/*char buf[1<<21],*p1=buf,*p2=buf;
inline int gc(){return p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++;}*/
inline int read()
{
    int ret=0,f=0;char c=gc();
    while(!isdigit(c)){if(c=='-')f=1;c=gc();}
    while(isdigit(c)){ret=ret*10+c-48;c=gc();}
    if(f)return -ret;return ret;
}
signed main()
{
	a=(node){read(),read()};
	b=(node){read(),read()};
	int n=read();
	while(n--)
	{
		node x=(node){read(),read()};
		double xu=DJ(b-a,x-a);
		double jia=DJ(b-a,b-a);
		double hao=xu/jia;
		double c=a.x+(b.x-a.x)*hao,d=a.y+(b.y-a.y)*hao;
		printf("%.10lf %.10lf\n",c+c-x.x,d+d-x.y);
	}
	return 0;
}


Measured memory_bytes: 3232
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int n = stdIn.nextInt();

		System.out.println(cnt(n));

		stdIn.close();
	}

	private static int cnt(int n) {
		if(n >= 195) {
			return 5;
		}
		if(n >= 189) {
			return 4;
		}
		if(n >= 165) {
			return 3;
		}
		if(n >= 135) {
			return 2;
		}
		if(n >= 105) {
			return 1;
		}
		return 0;
	}
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
#include<iostream>
using namespace std;
 
int main() {
    int a,c,ans,tmp;
    string s;
 
    ans = tmp = 0;
     cin >> a;
    vector<int>v(a);
    vector<int>b(a);
    for(int i = 0;i < a;i++){
        cin >> v[i];
    }
    b = v;     

   
    sort(v.begin(),v.end());
    for(int i = 0;i < a;i++){
        if(b[i] != v[i]){
            tmp++;
        }
    }
    if(tmp <=2){
        cout << "YES";
    }else{
        cout <<"NO";
    }
}


Measured memory_bytes: 3576
N, M = map(int, input().split())
edges = [list(map(int, input().split())) for _ in range(M)]

graph = [[False] * N for _ in range(N)]
for u, v in edges:
    graph[u - 1][v - 1] = True
    graph[v - 1][u - 1] = True

visited = [False] * N
visited[0] = True

def dfs(s):    
    if all(visited):
        return 1

    cnt = 0
    for i in range(N):
        if visited[i]:
            continue
            
        if not graph[s][i]:
            continue
            
        visited[i] = True
        cnt += dfs(i)
        visited[i] = False
        
    return cnt

print(dfs(0))

Measured memory_bytes: 43100
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;
import java.util.stream.Collectors;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int input = sc.nextInt();
		ArrayList<String> arr = new ArrayList<>();
		long count = 0;
		sc.nextLine();
		for(int i = 0;i<input;i++) {
			char[] temp = sc.nextLine().toCharArray();
			Arrays.sort(temp);
			String out = new String(temp);
			arr.add(out.toString());
		}
		Collections.sort(arr);
		long dif = 0;
		int curr = 0;
		for(int i = 1;i<arr.size();i++) {
			if(!(arr.get(curr).equals(arr.get(i)))) {
				dif = i - curr;
				count += dif*(dif-1)/2;
				curr = i;
			}
		}
		dif = input-curr;
		count += dif*(dif-1)/2;
		System.out.println(count);
	}

}


Measured memory_bytes: 98856
#ifndef LOCAL
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#else
#include <iostream>
#include <iomanip> 
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <memory>
#include <cctype>
#include <cstring>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
#endif
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; }; sim > rge<c> range(c i, c j) { return rge<c>{i, j}; } sim > auto dud(c* x) -> decltype(cerr << *x, 0); sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; } eni(!=) cerr << boolalpha << i; ris; } eni(==) ris << range(begin(i), end(i)); } sim, class b dor(pair < b, c > d) { ris << "(" << d.first << ", " << d.second << ")"; } sim dor(rge<c> d) { *this << "["; for (auto it = d.b; it != d.e; ++it) *this << ", " + 2 * (it == d.b) << *it; ris << "]"; }
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

// #include <ext/pb_ds/assoc_container.hpp> 
// #include <ext/pb_ds/tree_policy.hpp> 
// using namespace __gnu_pbds; 
// #define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 

template<typename T> void setmax(T& x, T y) {x = max(x, y);}
template<typename T> void setmin(T& x, T y) {x = min(x, y);}
#define fix(a) fixed << setprecision(a)
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define rep(i, a, b) for (int i = int(a); i < int(b); i++)
#define all(V) V.begin(), V.end()
#define rall(V) V.rbegin(), V.rend()
#define len(V) (int)V.size()
#define ll long long
#define ld long double
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define endl '\n'


void solve(){
  ll x, k;
  cin >> x >> k;
  ll n = x;
  x = n % k;
  do {
    n = x;
    debug() << imie(n);
    x = abs(x - k);
  } while (x < n);
  cout << n;
}

int main() {
  ios::sync_with_stdio(false);
  int t = 1;
  // cin >> t;
  forn(i, t){
    solve();
  }
}

/* 

1
322123


n - 1
0 ... (n-1) [res ... res] S - (n-1) ... S


 */

Measured memory_bytes: 3664
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
 
/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
*/

int main(){
    map<int,int> mp;
    int id=2;
    int s; cin >> s;
    mp[s]++;

    int tmp = s;
    while(1){
        if(tmp%2 == 0){
            tmp /= 2;
            if(mp[tmp] == 1){
                cout << id << endl;
                return 0;
            }
            else{
                mp[tmp]++;
            }
        }
        else{
            tmp = 3*tmp+1;
            if(mp[tmp] == 1){
                cout << id << endl;
                return 0;
            }
            else{
                mp[tmp]++;
            }
        }

        id++;
    }
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
 
int main() {
	while(1){
		int n, k, ans = -1000000, sum = 0;
		cin >> n >> k;
		if (n == 0 && k == 0){
			return 0;
		}
		int yj[200008] = {};
			for(int i = 0; i < n; i++){
				cin >> yj[i];
			}
		for(int i = 0; i < k; i++){
			sum += yj[i];
		}
		for(int i = 0; i < n - k; i++){
			sum += yj[i+k];
			sum -= yj[i];
			ans = max(sum, ans);
		}
		cout << ans << endl;
	}
	return 0;
}

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

int A[ 20 ];

int main()
{
int i;
int N;
int iSum;
char S[ 100 ];

	ios::sync_with_stdio( false );
	cin.tie( 0 );

	cin >> N;

	iSum = 0;
	for( i = 0; i < N; i++ )
	{
		cin >> A[ i ];
		iSum += A[ i ];
	}

	sort( A, A + N );
	iSum -= A[ N - 1 ] / 2;

	cout << iSum << endl;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
#include <list>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>

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

using namespace std;
typedef vector<int> vi;
typedef pair<int, int> pii;

const int INF = 1 << 30;
const int MOD = 1000000007;
const int MAX = 100000;
const int N = 100;

vector<pii> G[N];
int d[N];

int main() {
	int n; cin >> n;
	rep(i, n) {
		int _, n2; cin >> _ >> n2;
		rep(j, n2) {
			int v, c; cin >> v >> c;
			G[i].push_back(pii(c, v));
		}
	}
	rep(i, n) d[i] = INF;

	priority_queue<pii, vector<pii>, greater<pii>> Q;
	d[0] = 0;
	Q.push(pii(0, 0));
	while (!Q.empty()) {
		pii p = Q.top(); Q.pop();
		for (auto i : G[p.second]) {
			if (d[i.second] <= d[p.second] + i.first) continue;
			d[i.second] = d[p.second] + i.first;
			Q.push(i);
		}
	}
	rep(i, n) cout << i << ' ' << d[i] << endl;
}



Measured memory_bytes: 3152
#include<bits/stdc++.h>
using namespace std;
void print_err() {
	cerr << "\n";
}
template <class T, class... Arg>
void print_err(T x, Arg&&... args) {
	cerr << x << " ";
	print_err(args...);
}
#ifdef local
#define debug(...) print_err(__VA_ARGS__)
#else
#define debug(...)
#endif
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// #define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define mod 1000000007
#define ll long long int
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define pll pair<ll,ll>
#define vl vector<ll>
#define vpll vector<pair<ll,ll>>
#define mll map<ll,ll>
#define mllrev map<ll,ll,greater<int>>
#define ps(x,y) fixed<<setprecision(y)<<x
#define w(t) ll t;cin>>t;while(t--)
#define fo(i,n) for(ll i=0;i<n;++i)
#define foab(i,a,b) for(ll i=a;i<b;++i)
#define inp cin>>
#define pr cout<<
#define fastio ios_base::sync_with_stdio(NULL);cin.tie(NULL);cout.tie(NULL);
class Graph {
public:
	list<ll> *adj_list;
	ll v;
	Graph(ll v) {
		this->v = v;
		adj_list = new list<ll>[v];
	}
	void add_edge(ll u, ll v, bool bidirectional = true) {
		adj_list[u].push_back(v);
		if (bidirectional) {
			adj_list[v].push_back(u);
		}
	}
	void print();
	void connected_compo();
	void dfs(ll v, bool visited[]);
	void bfs(ll v, bool visited[]);
};
void solve() {
	// // http://codeforces.com/problemset/problem/445/A
	// inp n >> m;
	// fo(i, n) {
	// 	fo(j, m) {
	// 		inp ch[i][j];
	// 	}
	// }
	ll n, k, temp;
	inp n >> k;
	vl vect;
	ll dp[n];
	fo(i, n) {
		inp temp;
		dp[i] = 0;
		vect.pb(temp);
	}
	dp[0] = 0; dp[1] = abs(vect[1] - vect[0]);
	if (k >= n) {
		for (ll i = 2; i < n; i++) {
			temp = INT_MAX;
			for (ll j = i - 1; j >= 0; j--) {
				temp = min(dp[j] + abs(vect[i] - vect[j]), temp);
			}
			dp[i] = temp;
		}
	} else {
		for (ll i = 2; i < k; i++) {
			temp = INT_MAX;
			for (ll j = i - 1; j >= 0; j--) {
				temp = min(dp[j] + abs(vect[i] - vect[j]), temp);
			}
			dp[i] = temp;
		}
		for (ll i = k; i < n; i++) {
			temp = INT_MAX;
			for (ll j = i - 1; j >= i - k; j--) {
				temp = min(dp[j] + abs(vect[i] - vect[j]), temp);
			}
			// cout << temp << " ";
			dp[i] = temp;
		}
		// fo(i, n) {
		// 	cout << dp[i] << " ";
		// }
	}
	cout << dp[n - 1] << endl;
	return ;
}
int main() {
	fastio
#ifdef local
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	freopen("error.txt", "w", stderr);
#endif
	solve();
	return 0;
}
// ll n, m;
// char ch[100][100];
// bool istrue = false;
// ll dx[] = { -1, 1, 0, 0}, dy[] = {0, 0, -1, 1};
// void dfs(ll row, ll col, char ch) {
// 	if (ch[row][col] == 'B' or ch[row][col] == 'W' or ch[row][col] == '-' or istrue) {
// 		return;
// 	}
// 	fo(i, 4) {
// 		if (isvalid(ch, row + dx[i], col + dy[i])) {
// 			if (ch == 'B') {
// 				dfs(row + dx[i], col + dy[i], 'W');
// 			} else if (ch == 'W') {
// 				dfs(row + dx[i], col + dy[i], 'B');
// 			}
// 		}
// 	}
// }

Measured memory_bytes: 5072
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(x,n) for(int i=x;i<n;i++)
#define REP(y,n) for(int j=y;j<n;j++)
#define vi vector<int>
#define vvi vector<vector<int>>
signed main(){
  int r,c,count=0,total=0;
  cin>>r>>c;
  int hyou[r][c];
  rep(0,r)REP(0,c)cin>>hyou[i][j];
  rep(0,r){
    REP(0,c){
      count+=hyou[i][j];
      cout<<hyou[i][j]<<' ';
    }
    cout<<count<<endl;
    count=0;
  }
  rep(0,c){
    REP(0,r){
      count+=hyou[j][i];
      total+=hyou[j][i];
    }
    cout<<count<<' ';
    count=0;
  }
  cout<<total<<endl;
}



Measured memory_bytes: 3172
#include <iostream>
using namespace std;
int main(){
	int N;
	int array[100010] = {0};
	int count=0;
	cin >> N;
	
	for(int i=1;i<=N;i++){
		cin >> array[i];
	}
	int j=1;
	while(array[j]){
		if(j==2){
			cout << count << endl;
			return 0;
		}
		count++;
		int memo=array[j];
		array[j]=0;
		j=memo;
	}
	
	cout << -1 << endl;
	return 0;
}


Measured memory_bytes: 768
import itertools
S = input()
N = len(S)
#演算子
oper = ['+','']
# 合計値
num = 0
#デカルト積,operatorの組み合わせの集合
oper_set = list(itertools.product(oper,repeat=N-1))
#オペレーターの組み合わせ分だけ回す
for i in range(len(oper_set)):
  x = ''
  for j in range(N-1):
    x += S[j] + oper_set[i][j]
  x += S[N-1]
  num += eval(x)


print(num)
    
  

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

#define rep(i, n) for(long long i=0;i<(long long)(n);i++)
#define rep2(i, s, n) for(long long i=(s);i<(long long)(n);i++)
#define repi(i, n) for(int i=0;i<(int)(n);i++)
#define rep2i(i, s, n) for(int i=(s);i<(int)(n);i++)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define chmax(s, t) s=max(s,t);
#define chmin(s, t) s=min(s,t); 

#define deg2rad(deg) (((deg)/360)*2*M_PI)
#define rad2deg(rad) (((rad)/2/M_PI)*360)

using ll = long long;
using ld = long double;
using vll = vector<ll>;
using vvll = vector<vll>;
using P = pair<ll, ll>;
using vi = vector<int>;
using vvi = vector<vi>;

const ll INF = (1LL<<60);
const int INFi = (1<<29);

/*素数判定*/
bool is_prime(ll n){
    if(n==1) return false;
    for(ll i=2;i*i<=n;i++){
        if(n%i==0) return false;
    }
    return true;
}

/*約数列挙*/
vll enum_divisors(ll n){
    vll l;
    for(ll i=1;i*i<=n;i++){
        if(n%i==0){
            l.push_back(i);
            if(n/i != i) l.push_back(n/i);
        }
    }
   sort(all(l));
   return l;
}

/*素因数分解*/
vector<P> prime_factorize(ll n){
    vector<P> l;
    for(ll i=2;i*i<=n;i++){
        if(n%i!=0) continue;
        ll e = 0;
        while(n%i==0){
            e++;
            n /= i;
        }
        l.push_back({i, e});
    }
    if(n!=1) l.push_back({n, 1});
    return l;
}

/*最小公倍数*/
ll lcm(ll a, ll b){
    return a*b/__gcd(a,b);
}

/*最大公約数*/
ll gcd(ll a, ll b){
    return __gcd(a,b);
}

/*組み合わせ(Combination)*/
const ll CMAX = 1010000;
const ll CMOD = 1e9+7;
ll fac[CMAX], finv[CMAX], inv[CMAX];
// テーブルを作る前処理
void combinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (ll i = 2; i < CMAX; i++) {
		fac[i] = fac[i - 1] * i % CMOD;
		inv[i] = CMOD - inv[CMOD%i] * (CMOD / i) % CMOD;
		finv[i] = finv[i - 1] * inv[i] % CMOD;
	}
}
// 二項係数計算
ll comb(ll n, ll k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % CMOD) % CMOD;
}

/*階乗*/
ll factorial(ll n){
    const ll FMOD = 1e9+7;
    ll ret = n;
    for(ll i=n-1;i>0;i--){
        ret*=i;
        ret%=FMOD;
    }
    return (ret?ret:1);
}


int main(){

    ll n; cin >> n;

    ll ans = 0;
    rep2(i, 1, n+1) if(to_string(i).size()%2!=0) ans++;

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3696
#include <bits/stdc++.h>
//#include <atcoder/all>
#define rep(i, a) for (int i = (int)0; i < (int)a; ++i)
#define rrep(i, a) for (int i = (int)a - 1; i >= 0; --i)
#define REP(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define RREP(i, a, b) for (int i = (int)a - 1; i >= b; --i)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define popcount __builtin_popcount
using ll = long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 60;

// #pragma GCC target("avx2")
// #pragma GCC optimize("O3")
// #pragma GCC optimize("unroll-loops")
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;
}

ll gcd(ll n, ll m)
{
	ll tmp;
	while (m != 0)
	{
		tmp = n % m;
		n = m;
		m = tmp;
	}
	return n;
}

ll lcm(ll n, ll m)
{
	return abs(n) / gcd(n, m) * abs(m); //gl=xy
}

using namespace std;
//using namespace atcoder;

void solve(){
	ll n,x,m;
	cin>>n>>x>>m;
	vector<ll>a(m+5),sum(m+5),used(m+5);
	ll ans=0;
	a[1]=x;
	sum[1]=x;
	ll loop=1;
	int pos=0;
	for(int i=2;i<=n;++i){
		x*=x;
		x%=m;
		a[i]=x;
		sum[i]=sum[i-1]+a[i];

		if(n==i){
			cout<<sum[n];
			return;
		}

		if(used[a[i]]>0){
			pos=used[a[i]];
			loop=i-used[a[i]];
			break;
		}
		used[a[i]]=i;
	}
	ll len=(n-pos)/loop;
	ans+=len*(sum[pos+loop]-sum[pos]);
	ans+=sum[n-len*loop];
	cout<<ans;
}


int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(15);
	solve();
	return 0;
}


Measured memory_bytes: 5548
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <cmath>
#include <queue>
#include <deque>
#include <set>
#include <iomanip>
#include <utility>
using namespace std;
#define ll long long

int main() {
	int A, B; cin >> A >> B;
	if(A>=13) cout << B << endl;
	else if(A>=6) cout << B/2 << endl;
	else cout << 0 << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;++i)
#include<string>
using namespace std;
typedef long long ll;
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; };
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; };

int main() {
	int a, b, c;
	cin >> a >> b >> c;
	int ans = a * b / 2;
	cout << ans << endl;
}

Measured memory_bytes: 256
#pragma GCC optimize ("O3")

#include <bits/stdc++.h>
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> Pin;

ll INF = 1e16;
int inf = 1e9;
ll MOD = 1e9+7;

template<typename T>
ostream& operator << (ostream& os, const vector<T>& vec) {
    os << "{ ";
    REP(i, vec.size()) {
        os << vec[i] << " ";
    }
    os << "}";

    return os;
}

ll pow_mod(ll a, ll p) {
    ll res = 1;
    while(p) {
        if (p & 1) res = (res * a) % MOD;
        a = (a * a) % MOD;
        p >>= 1;
    }

    return res;
}


ll mod_inv(ll a, ll m) {
    ll b = m, u = 0, v = 1;
    while(a) {
        ll t = b / a;
        swap(b -= t * a, a);
        swap(u -= t * v, v);
    }

    return (u % m + m) % m;
}

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

void d_err() {
    cerr << endl;
}

template <typename H, typename... T>
void d_err(H h, T... t) {
    cerr << h << " ";
    d_err(t...);
}

#ifdef LOCAL
#define debug(...)  cerr << "[" << #__VA_ARGS__ << "]: ", d_err(__VA_ARGS__);
#else
#define debug(...) 83;
#endif

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    
    int N;
    cin >> N;

    map<string, vector<pair<int, int>>> m;

    REP(i, N) {
        string s;
        int p;
        cin >> s >> p;

        m[s].pb(make_pair(p, i+1));
    }

    for (auto it=m.begin(); it != m.end(); ++it) {
        auto ss = it->se;
        sort(ss.begin(), ss.end(), greater<pair<int, int>>());

        REP(i, ss.size()) {
            cout << ss[i].se << endl;
        }
    }

}


Measured memory_bytes: 256