akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#define MP make_pair
#define PB push_back
#define ALL(x)      (x).begin(),(x).end()
#define REP(i,n)    for(int i=0;i<(n);i++)
#define REP1(i,n)   for(int i=1;i<(n);i++)
#define REP2(i,d,n) for(int i=(d);i<(n);i++)
#define RREP(i,n)   for(int i=(n);i>=0;i--)
#define CLR(a)      memset((a),0,sizeof(a))
#define MCLR(a)     memset((a),-1,sizeof(a))
#define RANGE(x,y,maxX,maxY) (0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY))

typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI > VVI;
typedef vector<string> VS;
typedef vector<LL> VLL;
typedef pair<int,int> PII;

const int INF = 0x3f3f3f3f;
const LL INFL = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-9;

const int DX[]={1,0,-1,0},DY[]={0,-1,0,1};

void solve(std::string S){
    LL ans = 0;
    LL b = 0;
    REP(i, S.size()) {
        if(S[i] == 'B') {
            b++;
        } else {
            ans += b;
        }
    }

    cout << ans << endl;
}

int main(){
    std::string S;
    std::cin >> S;
    solve(S);
    return 0;
}


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

using namespace std;

const int maxn = 500010;
const int mod = 998244353;

int n, m, s, ans;
int fac[maxn<<1], ifac[maxn<<1], inv[maxn<<1], pw[maxn<<1];

int qpow(int x, int y) {
	int ret = 1;
	while (y) {
		if (y & 1) ret = 1LL * ret * x % mod;
		x = 1LL * x * x % mod;
		y >>= 1;
	}
	return ret;
}

int binom(int n, int m) {
	if (n < 0 || m < 0 || m > n) return 0;
	return 1LL * fac[n] * ifac[m] % mod * ifac[n - m] % mod;
}

int cal(int k) {
	if (k >= 0) return pw[k];
	else return 0;
}

int main() {
	scanf("%d%d", &n, &m); s = n + m;
	if (n < m) swap(n, m);
	fac[0] = ifac[0] = inv[1] = pw[0] = 1;
	for (int i = 2; i <= s; i++) inv[i] = mod - 1LL * (mod / i) * inv[mod % i] % mod;
	for (int i = 1; i <= s; i++) fac[i] = 1LL * fac[i-1] * i % mod, ifac[i] = 1LL * inv[i] * ifac[i-1] % mod, pw[i] = 2 * pw[i-1] % mod;
	int h = 0, g = binom(n + m - 1, n - 1);
	for (int k = 0; k < s; k++) {
		ans = (ans + h) % mod;
		ans = (ans + g) % mod;
		int l =  (n - m + k) / 2;
		h = ( h + 1LL * binom( k, l ) * binom( n + m - 1 - k - 1, n - l - 1 ) % mod ) % mod;
		g = ( g + mod - 1LL * binom( k, l ) * binom( n + m - 1 - k - 1, n - 1 - l - 1 ) % mod ) % mod;
		if ( (n - m + k + 1) / 2 > (n - m + k) / 2 ) {
			h = (h + mod - 1LL * binom( k + 1, l + 1 ) * binom( n + m - 1 - k - 1, n - l - 1) % mod ) % mod;
			g = (g + 1LL * binom( k + 1, l + 1 ) * binom( n + m - 1 - k - 1, n - 1 - l - 1 ) % mod ) % mod;
		}
	}
	ans = 1LL * ans * qpow(binom(n + m, n), mod - 2) % mod;
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 15872
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int sum1 = a + b;
        int sum2 = a - b;
        int sum3 = a * b;
        
        if(sum1 >= sum2 && sum1 >= sum3){
            System.out.print(sum1);            
        }
        else if(sum2 >= sum1 && sum2 >= sum3){
            System.out.print(sum2);
        }
        else if(sum3 >= sum1 && sum3 >= sum2){
            System.out.print(sum3);
        }
        
    }
}

Measured memory_bytes: 21844
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#define endl "\n"
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define prt(x) cout << (x)
#define prtl(x) cout << (x) << endl
#define rep(i,a,b) for(ll i=a; i<b; i++)
#define rrep(i,a,b) for(ll i=a; i>b; i--)
#define mp(a, b) make_pair(a, b)
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;
using vi = vector<int>;
using vll = vector<long long int>;
using vb = vector<bool>;
using vvb = vector<vector<bool>>;
using vc = vector<char>;
using vvi = vector<vector<int>>;
using vvll = vector<vector<long long int>>;
using vvc = vector<vector<char>>;
using ll = long long int;
using P = pair<long long int, long long int>;
using Map = map<long long int, long long int>;
ll INF = 1LL<<60;
ll M = 1000000007;


int main(){
    ll N; cin >> N;
    string S; cin >> S;
    ll Q; cin >> Q;
    vector<set<ll>> sg(26);
    rep(i, 0, 26){
        sg[i].insert(INF);
    }
    rep(i, 0, N){
        ll d = S[i] - 'a';
        sg[d].insert(i);
    }
    rep(i, 0, Q){
        ll a; cin >> a;
        if(a == 1){
            ll x; char q;
            cin >> x >> q;
            x--;
            if(q == S[x]){
                continue;
            }
            ll e = S[x] - 'a', f = q - 'a';
            S[x] = q;
            sg[e].erase(x); sg[f].insert(x);
        }else{
            ll l, r; cin >> l >> r;
            l--; r--;
            ll c = 0;
            rep(j, 0, 26){
                if(*sg[j].lower_bound(l) <= r){
                    //char t = 'a' + j;
                    //prtl(t);
                    c++;
                }
            }
            prtl(c);
        }
    }
}


Measured memory_bytes: 27252
#include<cstring>
#include<string>
#include<vector>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<stack>
#include<queue>
#include<cmath>
#include<algorithm>
#include<list>
#include<set>
#include<map>
#include<sstream>
#include<climits>
#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define rrep(X,Y) for (int (X) = (Y)-1;(X) >=0;--(X))
#define all(X) (X).begin(),(X).end()
#define fi first
#define sc second
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

int main() {
  int N, Y;
  cin >> N >> Y;

  for (int x = 0; x <= N; ++x) {
    for (int y = 0; y <= N-x; ++y){
      if (9000 * x + 4000 * y == Y - 1000 * N) {
        cout << x << ' ' << y << ' ' << N - (x+y) << endl;
        return 0;
      }
    }
  }

  cout << -1 << ' ' << -1 << ' ' << -1 << endl;
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#define MAX 10
int n;
int s;
int ans;

int dfs(int i, int sum, int n){
	if(s == sum && n == 0){
		ans++;
		return;
	}
	
	if(i == MAX || n == 0)	return;
	
	
	
	dfs(i+1, sum+i, n - 1);
	dfs(i+1, sum, n);
	
}

int main(void){
	while(1){
		ans = 0;
		scanf("%d %d", &n, &s);
		if(n == 0 && s == 0)	return 0;
		dfs(0,0,n);
		printf("%d\n", ans);
	}
	return 0;
}

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

int m, n;
int w[110];

bool judge(ll x) {
    int cnt = 1;
    ll acc = 0;
    
    for (int i=0; i<n; i++) {
        if (acc+w[i]>x) {
            cnt++;
            if (w[i]>x) return false;
            else acc = w[i];
        }
        else acc += w[i];
    }
    
    return cnt<=m;
}

ll binary_search() {
    ll l=0, r=1000000*n;
    
    while (l<=r) {
        ll mid = (l+r)/2;
        
        if (judge(mid)) r = mid-1;
        else l = mid+1;
    }
    
    return l;
}

int main() {
    while (true) {
        cin >> m >> n;
        if (m==0) break;
        for (int i=0; i<n; i++) cin >> w[i];
        cout << binary_search() << endl;
    }
}


Measured memory_bytes: 3116
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
int in() {int x; cin>>x; return x;}
ll lin() {ll x; cin>>x; return x;}
string sin() {string x;cin>>x;return x;}
using graph = vector<vector<int>>;
using graph2 = vector<vector<pair<int, int>>>;

int main(){
    string s;
    cin>>s;
    if(s.at(2)==s.at(3)&&s.at(4)==s.at(5)){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pint pair<int, int>
#define pll pair<ll, ll>
#define vint vector<int >
#define vll vector<ll >
#define ALL(x) (x).begin(), (x).end()
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i,n) for (int i = 0; i < (n); ++i)
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    int a,b,c;
    cin >> a >> b;
    cout << 6-a-b << "\n";
    return 0;
}

Measured memory_bytes: 256
MOD=10**9+7
cnt=0; sum=0; prev=nil; can=true; h=Hash.new(0)
def gs() gets.chomp end
def gi() gets.to_i end
def gsmi() gets.chomp.split.map(&:to_i) end

def desc(ar) ar.sort!{|x,y|y<=>x} end
def min(a,b) a<=b ? a : b end
def max(a,b) a>=b ? a : b end
def sum(ar) ar.inject(:+) end

def C(a,b) b==0||a==b ? 1 : (b=a-b if a/2<b;(a-b+1..a).inject(:*)/(1..b).inject(:*)) end

def puts_yesno(can) puts(can ? 'Yes' : 'No') end
def putsend(s) puts s; exit end
def debug(k,v) puts "#{k}:#{v}" end
########### ( ˘ω˘ )ｽﾔｧ… ###########
n=gi
s=gs

putsend 'No' if n==1

s1=s[0..(n/2-1)]
s2=s[(n/2)..-1]

puts_yesno s1==s2

Measured memory_bytes: 1788
using System;
using System.Collections.Generic;
using System.Linq;

class Procon
{
    public Procon() { }
    static void Main(string[] agrs)
    {
        new Procon().Do();
    }

    Scanner cin;

    public void Do()
    {
        cin = new Scanner();

        int A = cin.nextInt();

        int B = cin.nextInt();

        if (A%2 == 0 || B %2 ==0) {
            Console.WriteLine("No");
            return;
        }
        Console.WriteLine("Yes");
    }
}

class Scanner
{
    string[] s;
    int i;
    int max_i;

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

    public string nextString()
    {
        if (i >= s.Length)
        {
            s = Console.ReadLine().Split(' ');
            max_i = s.Length;
            i = 0;
            if (max_i == 0)
            {
                return "";
            }
            return s[i++];
        }
        else
        {
            return s[i++];
        }
    }

    public int nextInt()
    {
        return int.Parse(nextString());
    }


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

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

    public string[] arrayString()
    {
        return Console.ReadLine().Split(' ');
    }

    public int[] arrayInt()
    {
        string[] str = Console.ReadLine().Split(' ');
        int[] array = new int[str.Length];
        for (int i = 0; i < str.Length; i++)
        {
            array[i] = int.Parse(str[i]);
        }
        return array;
    }

    public long[] arrayLong()
    {
        string[] str = Console.ReadLine().Split(' ');
        long[] array = new long[str.Length];
        for (int i = 0; i < str.Length; i++)
        {
            array[i] = long.Parse(str[i]);
        }
        return array;
    }

    public double[] arrayDouble()
    {
        string[] str = Console.ReadLine().Split(' ');
        double[] array = new double[str.Length];
        for (int i = 0; i < str.Length; i++)
        {
            array[i] = double.Parse(str[i]);
        }
        return array;
    }
}


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

//関数
//main関数
int main() {
    
    
    //入力
    long N;
    cin>>N;
    //計算
    long R=1;
    while(R*R<N){//rootN以上の最小整数
        R++;
    }
    
    long ans=0;
    for(int i=1;i<R+2;i++){
        long t=(N/i)-1;
        if(N%i==0 && i<t) {
            ans+=t;
          //  cout<<(N/R)-1<<endl;
        }
    
    }

    
    
    

    //出力
    cout<<ans<<endl;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
#include <algorithm> 
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<endl
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define mp make_pair
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define sz(x) (ll)(x).size()
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pll = pair<ll, ll>;
using vc = vector<char>;
using vvc = vector<vc>;
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; 
}
ll dx[4]={0,1,0,-1};
ll dy[4]={1,0,-1,0};
int main(){
  ll n,m;
  cin>>n>>m;
  COUT(n*m);
}

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

using ll = long long;
using ld = long double;
using pii = pair<int, int>;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))

int dx4[4] = {1,0,-1,0}, dy4[4] = {0,1,0,-1};



int main()
{
    int n;
    ll t,ans=0;
    cin>>n>>t;
    vector<ll> v(n);
    
    for(int i = 0; i < n; i++)
    {
        cin>>v[i];
    }
    
    for(int i = 0; i < n-1; i++)
    {
        ans+=min(v[i+1]-v[i], t);
    }
    ans+=t;
    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 1792
#include<cstdio>
#include<iostream>
#include<cmath>
using namespace std;
int n,sum,ans;
int main(){
        scanf("%d",&n);
        for(int i=1;i<=n;i+=2){
                for(int j=1;j<=floor(sqrt(i));j++)
                        if(i%j==0)
                                sum++;
                if(sum==4) ans++;
                sum=0;
        }
        printf("%d",ans);
}

Measured memory_bytes: 256
var GET=(function(){function f(s){return new g(s);}function g(s){this._s=s.trim().split("\n");this._y=0;}g.prototype.a=function(f){var s=this._s, y=this._y, r;if(typeof s[y]==="string")s[y]=s[y].split(" ").reverse();r=s[y].pop();if(!s[y].length)this._y++;return f?r:+r;};g.prototype.l=function(f){var s=this._s[this._y++].split(" ");return f?s:s.map(a=>+a);};g.prototype.m=function(n,f){var r=this._s.slice(this._y,this._y+=n).map(a=>a.split(" "));return f?r:r.map(a=>a.map(a=>+a));};g.prototype.r=function(n,f){var r=this._s.slice(this._y,this._y+=n);return f?r:r.map(a=>+a);};return f;})();
var o=GET(require("fs").readFileSync("/dev/stdin","utf8"));

console.log(main());
function main(){
  var n = o.a();
  var a = o.m(n);
  var dp = [[0,0,0]];
  for(var i = 1; i <= n; i++){
    dp[i] = [];
    var t = a[i-1];
    dp[i][0] = t[0] + Math.max(dp[i-1][1], dp[i-1][2]);
    dp[i][1] = t[1] + Math.max(dp[i-1][0], dp[i-1][2]);
    dp[i][2] = t[2] + Math.max(dp[i-1][0], dp[i-1][1]);
  }
  return Math.max(...dp[n]);
}

Measured memory_bytes: 82488
#include <cmath>
#include <iostream>
#include <functional>
#include <string>
#include <sstream>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <iomanip>
#include <math.h>
#include <list>
#include <numeric>
using namespace std;

long long combi(long long n, long long k) {
  if (n == k || k == 0)
    return 1;
  else {
    return combi(n - 1, k - 1) + combi(n - 1, k);
  }
}

int main(){    
  long long K,N;
  cin >> K >> N;
  long long A[N],minn1,minn2,u=0,j;
  for(int i=0;i<N;i++){
    cin >> A[i];
    if(i>0){
      long long z = A[i]-A[i-1];
      if(u<z){
	u = z;
	j=i;
      }
    }
  }
 
  if(u<K-A[N-1]+A[0]){
    cout << A[N-1]-A[0]  << endl;
  }
  else{
     cout << K-A[j]+A[j-1] << endl;
  }
}


Measured memory_bytes: 1792
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE BinaryLiterals #-}
{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE NumDecimals #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TupleSections #-}

import Control.Applicative
import Control.Arrow
import Control.Monad
import Control.Monad.ST

import Data.Char
import Data.List
import Data.Maybe

import qualified Data.ByteString.Char8 as B

import Data.Array.ST.Safe
import Data.STRef

import Debug.Trace
import Text.Printf

readInt = readLn :: IO Int
readInteger = readLn :: IO Integer
readInts = map ( fst . fromJust . B.readInt ) . B.words <$> B.getLine
readIntegers = map ( fst . fromJust . B.readInteger ) . B.words <$> B.getLine

which a b f = if f then a else b
mp [ a, b ] = ( a, b )

modifyArray a i f = writeArray a i =<< f <$> readArray a i

main = getLine >>= putStrLn . uncurry ( flip (++) ) . mp . words

Measured memory_bytes: 508
#include <fstream>
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <sstream>
#include <map>
#include <set>
#include <vector>
#include <stack>
#include <cmath>
#include <queue>
#include <random>

using namespace std;
struct XX{
int s;
    int e;
};

class xxGreater {
public:
bool operator()(const XX& riLeft, const XX& riRight) const {
        //第2条件
if((riLeft.s) == (riRight.s)){
return riLeft.e < riRight.e;//<:昇順(小さいものから順番)、>:降順(大きいものから順番)
           //プライオリティキューの場合は > で、top()すると値の小さいものがとれる
        }
        //第1条件
        return (riLeft.s) > (riRight.s);
    }
};


int main(int argc, const char * argv[])
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    long long a,b,c,d;
    cin >> a>> b>>c>>d;
long long ans=a*c;
ans=max(ans,a*d);
ans=max(ans,b*c);
ans=max(ans,b*d);


cout << ans <<endl;

}


//cout << "Hello World" << endl;


Measured memory_bytes: 3208
N = int(input())
A = list(map(int, input().split()))
dic = {}
for a in A:
  if a in dic:
    dic[a] += 1
  else:
    dic[a] = 1
  if a-1 in dic:
    dic[a - 1] += 1
  else:
    dic[a - 1] = 1
  if a + 1 in dic:
    dic[a + 1] += 1
  else:
    dic[a + 1] = 1
m = 0
for v in dic.values():
  if m < v:
    m = v
print(m)

Measured memory_bytes: 19756
#include<bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define sz(a) int(a.size())
#define clr(a) memset(a,0,sizeof(a))
#define all(a) a.begin(),a.end()
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,int> pli;
const int inf=1e9;
const ll Inf=1e18;
const int N=5e5+10;
const int mod=0;
int gi() {
    int x=0,o=1;char ch=getchar();
    while((ch<'0'||ch>'9')&&ch!='-') ch=getchar();
    if(ch=='-') o=-1,ch=getchar();
    while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
    return x*o;
}
template<typename T> bool chkmax(T &a,T b) { return a<b?a=b,1:0; };
template<typename T> bool chkmin(T &a,T b) { return a>b?a=b,1:0; };
int add(int a,int b) { return a+b>=mod?a+b-mod:a+b; }
int sub(int a,int b) { return a-b<0?a-b+mod:a-b; }
void inc(int &a,int b) { a=(a+b>=mod?a+b-mod:a+b); }
void dec(int &a,int b) { a=(a-b<0?a-b+mod:a-b); }
int to[N<<1],ww[N<<1],nxt[N<<1],h[N],dep[N],cur[N],s,t,tot=1;
void adde(int u,int v,int w) {
    to[++tot]=v,ww[tot]=w,nxt[tot]=h[u],h[u]=tot;
    to[++tot]=u,ww[tot]=0,nxt[tot]=h[v],h[v]=tot;
}
int bfs() {
    memset(dep,0,sizeof(dep));
    queue<int> q;q.push(s);dep[s]=1;
    while(!q.empty()) {
        int u=q.front();q.pop();
        for(int i=h[u];i;i=nxt[i]) {
            int v=to[i];
            if(!dep[v]&&ww[i]) {
                dep[v]=dep[u]+1,q.push(v);
                if(v==t) return 1;
            }
        }
    }
    return 0;
}
int dfs(int u,int flow) {
    if(u==t) return flow;
    int ret=0;
    for(int &i=cur[u];i;i=nxt[i]) {
        int v=to[i];
        if(dep[v]==dep[u]+1&&ww[i]) {
            int d=dfs(v,min(flow,ww[i]));
            ww[i]-=d,ww[i^1]+=d,ret+=d,flow-=d;
            if(!flow) break;
        }
    }
    if(!ret) dep[u]=0;
    return ret;
}
int dinic() {
    int ret=0;
    while(bfs()) {
        memcpy(cur,h,sizeof(h));
        ret+=dfs(s,inf);
    }
    return ret;
}
int n,mat[N],vis[N],fa[N],cnt=0;
vector<int> pos[N];
void insert(int u) {
    vis[u]=1,++cnt;
    for(int i:pos[u])
        if(mat[i]&&!vis[mat[i]]) fa[mat[i]]=u,insert(mat[i]);
}
int main() {
    n=gi(),s=0,t=2*n+1;
    for(int i=1;i<n;i++) {
        int c=gi(),w;
        adde(s,i,1);
        for(int j=1;j<=c;j++) w=gi(),pos[w].pb(i),adde(i,w+n,1);
    }
    for(int i=2;i<=n;i++) adde(i+n,t,1);
    if(dinic()!=n-1) return puts("-1"),0;
    for(int u=1;u<=n;u++) {
        for(int i=h[u];i;i=nxt[i]) {
            int v=to[i];
            if(n+2<=v&&v<=n+n&&!ww[i]) mat[u]=v-n;
        }
    }
    insert(1);
    if(cnt!=n) return puts("-1"),0;
    for(int i=1;i<=n;i++) if(mat[i]) printf("%d %d\n",fa[mat[i]],mat[i]);
    return 0;
}


Measured memory_bytes: 41172
#include <cstdio>
char s[100100];
int main() {
	scanf("%s", s+1);
	for(int i = 1; s[i]; i ++ ) if(s[i] == s[i+1] || s[i] == s[i+2]) return printf("%d %d\n", i, s[i+2]?i+2:i+1), 0;
	puts("-1 -1");
}


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

using namespace std;

string s;
int mod = 1e9 + 7;
int mem[100005][15];
int fact[100005];

int solve(int ind, int rem){
    if(ind == s.size()) return rem == 5;
    int &ret = mem[ind][rem];
    if(~ret) return ret;
    ret = 0;
    if(s[ind] != '?')
        return ret = solve(ind+1, (rem + fact[ind] * (s[ind]-'0')) % 13);

    for(int i=0; i<10; i++){
        ret += solve(ind + 1, (rem + fact[ind] * i) % 13);
        ret %= mod;
    }
    return ret;
}


int main() {
#ifndef ONLINE_JUDGE
//	freopen("input.in", "r", stdin);
//	freopen("output.out", "w", stdout);
#endif
    cin >> s;
    memset(mem, -1, sizeof(mem));
    fact[s.size()-1] = 1;
    for(int i=(int)s.size()-2; i>=0; i--){
        fact[i] = fact[i+1] * 10;
        fact[i] %= 13;
    }
    printf("%d", solve(0, 0));
    return 0;
}


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

int main(int argc, const char * argv[]) {
    int i, j, k;
    int n, x;
    int count;
    
    
    while(1){
        count=0;
        cin >> n >> x;
        if(n==0 && x==0){
            break;
        }else{
            for(i=1;i<=n;i++){
                for(j=1;j<=n;j++){
                    if(j==i){
                        break;
                    }else{
                        for(k=1;k<=n;k++){
                            if(k==i || k==j){
                                break;
                            }else{
                                if(i+j+k==x){
                                    count++;
                                }
                            }
                        }
                    }
                }
            }
        }
        cout << count << endl;
    }
    
    return 0;
}



Measured memory_bytes: 3108
package main

import "fmt"

const mod = 998244353

var memo [3005][3005]int
var visited [3005][3005]bool

func solve(n, s int, a []int) int {
	if s < 0 {
		return 0
	}
	if visited[n][s] {
		return memo[n][s]
	}
	if n == 1 {
		if s == a[0] {
			return 1
		} else if s == 0 {
			return 2
		}
		return 0
	}
	memo[n][s] = (solve(n-1, s-a[n-1], a) + solve(n-1, s, a)*2) % mod
	visited[n][s] = true
	return memo[n][s]
}

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


Measured memory_bytes: 81988
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define f first
#define s second
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<pii>
#define vll vector<pll>
#define all(v) v.begin(),v.end()
#define mp make_pair

using namespace std;

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(NULL);
    int n,x,y;
    cin>>n>>x>>y;
    vector<int> v[n+1];
    for(int i=1;i<n;i++){
        v[i].pb(i+1);
        v[i+1].pb(i);
    }
    v[x].pb(y);
    v[y].pb(x);
    int ans[n]={0};
    for(int i=1;i<=n;i++){
        int dis[n+1]={0};
        queue<int> q;
        q.push(i);
        int vis[n+1] = {0};
        vis[i]=1;
        while(q.size()){
            int node = q.front();
            for(int j=0;j<v[node].size();j++){
                if(vis[v[node][j]]) continue;
                vis[v[node][j]]=1;
                q.push(v[node][j]);
                dis[v[node][j]] = dis[node] + 1;
                //cout<<node<<' '<<v[node][j]<<' '<<dis[v[node][j]]<<'\n';
            }
            q.pop();
        }
        for(int j=i+1;j<=n;j++){
            ans[dis[j]]++;
        }
    }
    for(int i=1;i<n;i++){
        cout<<ans[i]<<'\n';
    }
	return 0;
}


Measured memory_bytes: 384
# -*- coding: utf-8 -*-
"""
Set - Set: Range Search
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP2_7_C&lang=jp

"""
from bisect import insort, bisect_right, bisect_left

class Multi_set:
    def __init__(self):
        self.total = 0
        self.ms = dict()
        self.lr = []

    def insert(self, x):
        if x in self.ms:
            if self.ms[x] == 0:
                self.ms[x] = 1
                self.total += 1
        else:
            self.total += 1
            self.ms[x] = 1
            insort(self.lr, x)
        print(self.total)

    def find(self, x):
        print(self.ms.get(x, 0))

    def delete(self, x):
        if x in self.ms:
            self.total -= self.ms[x]
            self.ms[x] = 0

    def dump(self, l, r):
        lb = bisect_left(self.lr, l)
        ub = bisect_right(self.lr, r)
        for i in range(lb, ub):
            k = self.lr[i]
            v = self.ms[k]
            print(f'{k}\n' * v, end='')


ms = Multi_set()
for _ in range(int(input())):
    op, x, y = (input() + ' 1').split()[:3]
    if op == '0':
        ms.insert(int(x))
    elif op == '1':
        ms.find(int(x))
    elif op == '2':
        ms.delete(int(x))
    else:
        ms.dump(int(x), int(y))




Measured memory_bytes: 27716
//
// Created by Myabu on 2020/01/18.
//

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <utility>
#include <math.h>
#include <stack>
#include <queue>
#include <cstdio>
#include <numeric>

using namespace std;


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

    int ans = 0;
    for(char c: S){
        if(c == '+'){
            ans++;
        }else{
            ans--;
        }
    }

    cout<<ans<<endl;


    return 0;
}

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

int main() {
  int N;
  cin >> N;
  
  int dmin = 100; 
  for (int i = 0; i < N; i++) {
    int a;
    cin >> a;
    
    int dc = 0;
    while (a % 2 == 0) {
      dc++;
      a /= 2;
    }
    dmin = min(dmin, dc);
  }
  cout << dmin << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
const long long INF = numeric_limits<long long>::max();
typedef long long ll;
int main()
{
    ll h,w;
    cin >> h >> w;
    ll ans = 0;
    ll odd_line, even_line;

    if (h != 1 && w != 1){
        ans = (h*w+1) / 2;
    }
#if 0
    if (h != 1 && w != 1){
        odd_line = (w+1) / 2;
        even_line = w / 2;
        ans = odd_line * (h+1)/2 + even_line * h / 2;
    }
#endif 
    else ans = 1;
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for(int i=a; i<n; i++)
#define repq(i,a,n) for(int i=a; i<=n; i++)
#define repr(i,a,n) for(int i=a; i>=n; i--)
typedef long long ll;
typedef pair<int, int> pii;
#define int ll
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
constexpr ll INF = 1001001001001001LL;
constexpr ll MOD = 1000000007LL;
 
#define X real()
#define Y imag()
typedef complex<double> P;
typedef vector<P> Poly;
 
signed main() {
    int n,dx[4] = {1,0,-1,0}, dy[4] = {0,1,0,-1};
    while(cin >> n, n){
        int m0, m;
        double x, y;
        cin >> m0;
        Poly o;
        for(int i = 0; i < m0; ++i){
            cin >> x >> y;
            o.push_back(P(x,y));
        }
        for(int i = 0; i < n; ++i){
            cin >> m;
            Poly p;
            for(int j = 0; j < m; ++j){
                cin >> x >> y;
                p.push_back(P(x,y));
            }
            if(m == m0){
                for(int j = 0; j < 4; ++j){
                    bool f = true;
                    for(int k = 0; k < m; ++k){
                        P a = o[k]-o[0], b = p[k] - p[0];
                        if(b != P(a.X*dx[j]-a.Y*dy[j], a.X*dy[j]+a.Y*dx[j])){
                            f = false;
                            break;
                        }
                    }
                    if(f){
                        cout << i+1 << endl;
                        break;
                    }
                    f = true;
                    for(int k = m-1; k >= 0; --k){
                        P a = o[m-1-k] - o[0], b = p[k] - p[m-1];
                        if(b != P(a.X*dx[j]-a.Y*dy[j], a.X*dy[j]+a.Y*dx[j])){
                            f = false;
                            break;
                        }                        
                    }
                    if(f){
                        cout << i+1 << endl;
                        break;
                    }                    
                }
            }
        }
        cout << "+++++" << endl;
    }
    return 0;
}

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

int a[100005];

int main(){
 	int n;
 	cin>>n;
    for(int i=0;i<n;i++){
 	    cin>>a[i];
 	}
 	
 	sort(a, a+n);
 	for(int i=0;i<n-1;i++){
 	    if(a[i]+a[i+1]<0){
 	        a[i]*=(-1);
 	        a[i+1]*=(-1);
 	        i++;
 	    } else break;
 	}
 	
 	cout<<accumulate(a, a+n, 0LL)<<endl;
 }

Measured memory_bytes: 640
n,m = map(int,input().split())
sc = [[i for i in map(int,input().split())] for j in range(m)]
start = 0
goal = 0
if n==1:
  start = 0
  goal = 9
elif n==2:
  start = 10
  goal = 99
elif n==3:
  start = 100
  goal = 999

flag = 1
ans = -1
for num in range(start,goal+1):
  flag = 1
  for i in range(m):
    if str(num)[sc[i][0]-1] != str(sc[i][1]):
      flag = 0
  if flag == 1:
    ans = num
    break

print(ans)

Measured memory_bytes: 3064
#define _USE_MATH_DEFINES
#include <math.h>
#include <bits/stdc++.h>
#define MOD 1000000007
using namespace std;
int main()
{
    string s,t = "CODEFESTIVAL2016";
    cin >> s;
    int ans = 0;
    for(int i = 0;i < s.size();i++)
    {
        if(s[i] != t[i])
        {
            ans++;
        }
    }
    cout << ans << "\n";
    
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
#define Priq priority_queue<int,vi,greater<int>>
#define pb push_back
#define mp make_pair
#define INF (1ll<<60)
signed main(){
  int N,A,B; cin>>N>>A>>B;
  string S; cin>>S;
  int C=0,D=0;
  rep(i,0,N){
    string ans="No";
    if(S[i]=='a'){
      if(C+D<A+B){
        ans="Yes";
        C++;
      }
    }
    else if(S[i]=='b'){
      if(C+D<A+B&&D<B){
        ans="Yes";
        D++;
      }
    }
    cout<<ans<<endl;
  }
  }



Measured memory_bytes: 896
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val i1 = sc.nextInt()
    val i2 = sc.nextInt()

    if (i1 > i2) {
        println("a > b")
    } else if (i2 > i1) {
        println("a < b")
    } else {
        println("a == b")
    }
}



Measured memory_bytes: 25540
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <stack>
#include <numeric>
#include <algorithm>
#include <bitset>
#include <complex>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef long long int llint;
#define MM 1000000000
#define MOD MM+7
#define pi pair<int,int>
#define pl pair<ll,ll>
#define chmax(a,b) (a<b ? a=b:0)
#define chmin(a,b) (a>b ? a=b:0)
const long double PI = acos(-1);
const long long INF = 1e15;
int dx[8] = {-1,0,1,0,-1,-1,1,1};
int dy[8] = {0,-1,0,1,-1,1,1,-1};
template<typename T>
T GCD(T u,T v){
    return v ? GCD(v,u%v) : u;
}
char s[22][22];
bool visited[22][22];
void init(int H, int W){
    for(int i = 0; i < H; i++){
        for(int j = 0; j < W; j++){
            s[i][j] = 'a';
            visited[i][j] = false;
        }
    }
}
void bfs(int sh, int sw, int h, int w){
    queue<pair<int,int> > que;
    que.push(make_pair(sh,sw));
    while(que.size()){
        pair<int,int> F = que.front();
        visited[F.first][F.second] = true;
        que.pop();
        for(int i = 0; i < 4; i++){
            int ny = F.first + dy[i];
            int nx = F.second + dx[i];
            if (s[ny][nx] == '#') continue;
            if (visited[ny][nx] == false && 0 <= nx && 0 <= ny && nx < w && ny < h && (s[ny][nx] == '.' || s[ny][nx] == '@')){
                que.push(make_pair(ny,nx));
                visited[ny][nx] = true;
            }
        }
    }
}
int check(int h, int w){
    int cnt = 0;
    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            if (visited[i][j] == true && (s[i][j] == '.' || s[i][j] == '@')){
                cnt++;
            }
        }
    }
    return cnt;
}
void display(int h, int w){
    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            cout << visited[i][j] << " ";
        }
        cout << endl;
    }
}


int main(){
    vector<int> v(0);
    while(true){
        int h,w; cin >> w >> h;
        if (h == 0 && w == 0) break;
        init(h,w);
        pair<int,int> start;
        for(int i = 0; i < h; i++){
            for(int j = 0; j < w; j++){
                cin >> s[i][j];
                if (s[i][j] == '@'){
                    start.first = i;
                    start.second = j;
                }
            }
        }
        bfs(start.first, start.second, h, w);
        v.push_back(check(h, w));
        //display(h,w);
    }
    for(int i = 0; i < v.size(); i++){
        cout << v[i] << endl;
    }
}



Measured memory_bytes: 3160
package main

// .->white , #->black, *-> red

import (
	"fmt"
	"math"
	"strings"
)

type (
	ciType []string
)

//任意のビット位置の値を参照する
func refbit(i int, b uint) int {
	// iByte := fmt.Sprintf("%b", i)
	// bビット文だけ右シフトさせて1とANDを取ることで、その桁の数値(0or1)が取得できる
	// fmt.Printf("iは%b, %T, シフト数は%d,%T, 右シフトした結果は%b, その方は%T\n", iByte, iByte, b, b, iByte>>b, iByte>>b)

	// bビット分右シフト
	iShift := i >> b & 1
	return iShift
}

// 文字列、対象インデックスを受け取って、固定文字列に変換して返す関数
func replaceAtIndex(in string, i int) string {
	// fmt.Printf("置換対象文字列は%s\n", in)
	if strings.TrimRight(in, "\n") == "*" {
		// fmt.Println("既に赤字列になっているので対象外、そのまま返す")
		return in
	}
	// fmt.Printf("置き換わる前の文字列%s\n", in)
	out := []rune(in)
	out[i] = []rune("*")[0] // 本当であれば*のruneにしたいけど、今回は何でもOKなのでパス
	// fmt.Printf("置き換わった後の文字列%s\n", string(out))
	return string(out)
}

// cijは状態行列、望ましいkは黒の数
func colorToRed(cij []string, k int, h int, w int) int {
	res := 0

	// 色を反転するためのビットの最高値を取得する
	searchInt := math.Pow(2, float64(h+w)) - 1.0
	// fmt.Printf("searchIntは> %b\n", byte(searchInt))

	// 0になるまで調べ続ける
	for ii := 0; ii <= int(searchInt); ii++ {

		// testCij := cij
		testCij := make([]string, len(cij))
		copy(testCij, cij)
		// fmt.Printf("searchIntは> %b\n", byte(searchInt))
		// fmt.Printf("★★iiは %b だよ\n\n", byte(ii))
		// fmt.Print("調査対象の行列は")
		// fmt.Println(testCij)
		// cijAfter := cij
		// jは行、列
		for j := 0; j < (h + w); j++ {
			// fmt.Printf("jは%d, hは%d\n", j, h)

			// 該当桁の値を取得する(0or1)
			val := refbit(ii, uint(j))
			// fmt.Printf("valは%d\n", val)
			// 該当桁が1の時、該当行列の値を赤にする
			// 該当桁が1かつ対象が行
			if val == 1 && j < h {
				// fmt.Println("１行赤にするよ")
				for p := 0; p < len(testCij[j]); p++ {
					testCij[j] = "*"
				}

				// 該当列が1かつ対象が列
			} else if val == 1 && j >= h {
				// fmt.Println("一列赤にするよ")
				for p := 0; p < len(testCij); p++ {
					testCij[p] = replaceAtIndex(testCij[p], j-h)
					// fmt.Printf("反転結果は%s\n", testCij)
				}
			}
		}

		// fmt.Printf("testCijの反転結果       >>%s\n", testCij)
		// fmt.Print("cij変わってないことの確認>>")
		// fmt.Println(cij)

		/* この時の行列の黒の値を調べる */
		blackNum := 0
		for p := 0; p < h; p++ {
			blackNum += strings.Count(testCij[p], "#")
		}
		// fmt.Printf("blackNumは：%d\n", blackNum)
		if blackNum == k {
			// fmt.Printf("望んだ黒の数でした ii=%b, testCij=%s\n", ii, testCij)
			// fmt.Printf("iiは%d、searchIntは%d\n", ii, int(searchInt))
			// fmt.Printf("一致したときのii>>%b\n", byte(ii))
			// fmt.Printf("その時の行列>>%s\n", testCij)
			res++
		}

	}

	// fmt.Printf("resの数は：%d\n", res)
	return res

}

func main() {
	/* 標準入力から値を受け取る*/
	var h, w, k int
	fmt.Scan(&h, &w, &k)
	// fmt.Printf("h:%d, w:%d, k:%d\n", h, w, k)

	/* 標準入力の二行目以降の値を受け取る */
	// 配列にはconstantしか渡せない。可変長配列にはスライスを使う
	// fmt.Println("行列を入力してください")
	cij := make([]string, h, h)
	for i := 0; i < h; i++ {
		// fmt.Println("行を入力してください")
		fmt.Scan(&cij[i])
	}
	// fmt.Print("行列：")
	// fmt.Println(cij)

	/* 色の反転を行い、結果を確認する箇所 */
	resultInt := colorToRed(cij, k, h, w)

	fmt.Println(resultInt)
}


Measured memory_bytes: 5288
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <climits>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <cmath>
#include <list>
#include <set>
#include <map>
#define F first
#define S second
#define pb push_back
#define sz(c) (int)c.size()
#define len(c) (int)c.length()
#define hcf(a, b) __gcd(a, b)
#define all(c) c.begin(), c.end()
#define vint vector<int>
#define vLL vector<LL>
using namespace std;
typedef long long LL;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    LL n, ans = 0;
    cin >> n;
    vLL a(n);
    map<LL, LL> M;
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
        M[a[i]]++;
    }
    map<LL, LL>::iterator it;
    for (it = M.begin(); it != M.end(); it++)
    {
        LL val = (*it).S;
        if (val >= 2)
        {
            ans += (val * (val - 1)) / 2;
        }
    }
    for (int i = 0; i < n; i++)
    {
        if (M[a[i]] >= 2)
        {
            cout << ans - M[a[i]] + 1 << "\n";
        }
        else
        {
            cout << ans << "\n";
        }
    }
    return 0;
}

Measured memory_bytes: 11136
n,k=map(int,input().split())
c=list(map(int,input().split()))
a=[]
for x in range(n):
  s=c[x]
  t=(s+1)/2
  a.append(t)
  
ans=0
b=[]
b.append(a[0])

for y in range(n-1):
  c=b[y]
  d=b[y]+a[y+1]
  b.append(d)
  
dd=b[k-1]
for z in range(1,n+1-k):
  e=b[z+k-1]-b[z-1]
  
  dd=max(dd,e)

print(dd)

Measured memory_bytes: 31804
#include<bits/stdc++.h>
using namespace std;
int main ()
{
	int n,i;
	string s;
	cin>>n;
	cin>>s;
	if(s.size()<=n)
	{
		cout<<s;
	}
	else
	{
		for(i=0;i<n;i++)
		cout<<s[i];
		
		cout<<"...";
	}
	return 0;
}

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

#ifdef DEBUG
#define debug(x) cout << #x << ": " << x << endl
#else
#define debug(x)
#endif

#define REP(i, n) for(int i = 0; i < (n); i++)
#define REPS(i, n) for(int i = 1; i <= (n); i++)
#define ALL(v) (v).begin(), (v).end()

#define pb push_back
#define mp make_pair
#define mt make_tuple

using namespace std;

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 ll INF = 1e+18;
const ll MOD = 1e+9+7;

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

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

    ll N; cin >> N;
    vl A(N), B(N); REP(i, N) cin >> A[i] >> B[i];
    ll ans = 0;
    for(int i = N-1; i >= 0; i--)
    {
        A[i] += ans;
        if(A[i] % B[i] == 0) continue;
        ans += (A[i]/B[i]+1)*B[i]-A[i];
    }
    cout << ans << endl;
}

Measured memory_bytes: 1792
#include<iostream>
#include<string>

using namespace std;

int main()
{
    int a, b;
    cin >> a >> b;
    string s;
    if(a>b)
        s=">";
    else if(a==b)
        s="==";
    else
        s="<";
    cout << 'a' << ' ' << s << ' ' << 'b' << endl;
    return 0;
}

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

int main() {
	double W, H, x, y;
	cin >> W >> H >> x >> y;
	double ans = W * H / 2.0;
	int ok = 0;
	if (x == W / 2 && y == H / 2) ok = 1;
	printf("%.10f %d\n", ans, ok);
	return 0;
}


Measured memory_bytes: 3764
N, M, Q = map(int, input().split())
a = [0] * Q
b = [0] * Q
c = [0] * Q
d = [0] * Q
for i in range(Q):
    a[i], b[i], c[i], d[i] = map(int, input().split())
    a[i] -= 1
    b[i] -= 1

# スコア計算
def score(A):
    tmp = 0
    for ai, bi, ci, di in zip(a, b, c, d):
        if A[bi] - A[ai] == ci:
            tmp += di
    return tmp

# DFS
res = 0 # とりあえずグルーバルに置いておく
def dfs(A):
    global res # res をグルーバルで使えるように
    if len(A) == N:
        res = max(res, score(A))
        return
    prev_last = A[-1] if len(A) > 0 else 0
    for v in range(prev_last, M):
        A.append(v)
        dfs(A)
        A.pop()

dfs([])
print(res)



Measured memory_bytes: 9184
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
inline ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
inline ll lcm(ll a, ll b) { return a / gcd(a, b)*b; }
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T>& V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> >& Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T>& mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }
template<typename T>vector<T> make_v(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>auto make_v(size_t a,Ts... ts){return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));}
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type fill_v(T &t,const V &v){t=v;}
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type fill_v(T &t,const V &v){for(auto &e:t) fill_v(e,v);}
/*
 <url:>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */

template<class Type>
Type solve(Type res = Type()){
    string S; cin >> S;
    if(S == "ABC") return "ARC";
    else return "ABC";
    return res;
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    // solve(0);
    cout << fixed << setprecision(15) << solve<string>() << endl;
    return 0;
}


Measured memory_bytes: 3652
#include <iostream>
#include <string>

void solve() {
    int n;
    std::string s;
    std::cin >> n >> s;

    int i = 0, ans = 0;
    while (i + 1 < n) {
        if (s[i] != s[i + 1]) {
            ++ans;
            i += 2;
        } else {
            i += 1;
        }
    }

    std::cout << ans << "\n";
}

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

    solve();

    return 0;
}



Measured memory_bytes: 3344
N = int(input())
A = list(map(int, input().split()))

sum_dai = 0
for i in range(1, N):
    diff = A[i] - A[i - 1]
    if diff < 0:
        sum_dai += -diff  # 前の人と高さを一緒にする
        A[i] = A[i - 1]
print(sum_dai)

Measured memory_bytes: 32236
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  string a;
  cin>>n>>a;
  for(int i = 0;i<a.size();i++)
  {
    int h = int(a[i]);
    h+=n;
    h-=65;
    h%=26;
    h+=65;
    cout<<char(h);
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define piii pair<int,pii>
#define pll pair<ll,ll>
#define plii pair<ll,pii>
#define vi vector<int>
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define SORT(x) sort(x.begin(), x.end())
#define GSORT(x) sort(x.begin(), x.end(), greater<int>())
#define mx 100001
#define eps 0.00000000001
#define mod 1000000007
#define pi acos(-1)
#define inf 100000000
#define loop(i,b,n) for(int i=b;i<n;++i)
#define rev_loop(i,b,n) for(int i=b;i>=n;--i)
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
bool isprime(int n)
{
    if(n == 1) return false;
    if(n == 2 || n == 3) return true;
    if(n%2 == 0 || n%3 == 0) return false;
    for(int i=5; i*i<=n; i+=6){
        if((n%i == 0)||(n%(i+2) == 0)) return false;
    }
    return true;
}
int main()
{
    fio;
    int n;
    cin>>n;
    int a1;
    vi v1(n);
    ll sum = 1000,p=0;
    loop(i,0,n)
    {
        cin>>v1[i];
    }
    //int k = 0,r = 200;
    loop(i,0,n-1)
    {
      if(v1[i]<v1[i+1] )
      {
          p = sum/v1[i];
          sum = sum - (v1[i]*p);
          sum += (v1[i+1]*p);
      }


    }
    cout<<sum<<endl;
    return 0;
}



Measured memory_bytes: 3648
import math

n,h=map(int,input().split())
b=[]
max=1
for i in range(n):
    x,y=map(int,input().split())
    b.append(y)
    if max<x:
        max=x
b.sort()
b.reverse()
sum=0
ans=0
for x in b:
    if x>max:
        sum+=x
        ans+=1
        if sum>=h:
            print(ans)
            break
if sum<h:
    ans+=math.ceil((h-sum)/max)
    print(ans)

Measured memory_bytes: 7512
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;
using MethodImplAttribute = System.Runtime.CompilerServices.MethodImplAttribute;
using MethodImplOptions = System.Runtime.CompilerServices.MethodImplOptions;

public static class P
{
    public static void Main()
    {
        var bingo = Enumerable.Repeat(0, 3).Select(_ => Console.ReadLine().Split().Select(int.Parse).ToArray()).ToArray();
        int n = int.Parse(Console.ReadLine());
        for (int i = 0; i < n; i++)
        {
            int a = int.Parse(Console.ReadLine());
            for (int j = 0; j < 3; j++)
            {
                for (int k = 0; k < 3; k++)
                {
                    if (bingo[j][k] == a) bingo[j][k] = -1;
                }
            }
        }
        for (int i = 0; i < 3; i++)
        {
            if (Enumerable.Range(0, 3).All(j => bingo[i][j] == -1) ||
                Enumerable.Range(0, 3).All(j => bingo[j][i] == -1))
            {
                Console.WriteLine("Yes");
                return;
            }
        }
        if (Enumerable.Range(0, 3).All(j => bingo[j][j] == -1) ||
            Enumerable.Range(0, 3).All(j => bingo[j][2 - j] == -1))
        {
            Console.WriteLine("Yes");
            return;
        }
        Console.WriteLine("No");
    }
}


Measured memory_bytes: 13524
program strings_with

 implicit none
 integer::n,i
 character::s*100,t*100,ans*200
 
 read*,n
 read*,s,t
! print*,s,t

 do i=1,n 
  ans(2*i-1:2*i-1)=s(i:i)
  ans(2*i:2*i)=t(i:i)
 end do
 
 print*,ans(1:2*n)

end program strings_with


Measured memory_bytes: 256