akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define int long long
#define ll long long
using ull = unsigned long long;
using namespace std;
const int INF = 1e10;
const int MOD = 1e9 + 7;
#define dump(x)                             \
    if (dbg) {                              \
        cerr << #x << " = " << (x) << endl; \
    }
#define overload4(_1, _2, _3, _4, name, ...) name
#define FOR1(n) for (ll i = 0; i < (n); ++i)
#define FOR2(i, n) for (ll i = 0; i < (n); ++i)
#define FOR3(i, a, b) for (ll i = (a); i < (b); ++i)
#define FOR4(i, a, b, c) for (ll i = (a); i < (b); i += (c))
#define FOR(...) overload4(__VA_ARGS__, FOR4, FOR3, FOR2, FOR1)(__VA_ARGS__)
#define FORR(i, a, b) for (int i = (a); i <= (b); ++i)
#define bit(n, k) ((n >> k) & 1) /*nのk bit目*/
template <class T>
bool chmin(T& a, const T& b) {
    if (a > b) {
        a = b;
        return 1;
    } else
        return 0;
}
template <class T>
bool chmax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return 1;
    } else
        return 0;
}
void Yes(bool flag = true) {
    if (flag)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}
void No(bool flag = true) {
    Yes(!flag);
}
void YES(bool flag = true) {
    if (flag)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
}
void NO(bool flag = true) {
    YES(!flag);
}
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(), (v).end()
#define SZ(x) ((int)(x).size())
#define P pair<int, int>
//#define V vector<int>
//#define S set<int>
#define itn int
bool dbg = false;
int h, w;

void solve() {
}

signed main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cin >> h >> w;
    if (h > 1 && w > 1) {
        cout << (h * w + 1) / 2 << endl;
    } else {
        cout << 1 << endl;
    }


    solve();
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <fstream>
#include <algorithm>
#include <cmath>
#include <deque>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <map>
#include <stack>
#include <set>
#include <sstream>
#define IOS ios_base::sync_with_stdio(0); cin.tie(0);
#define ll long long
#define INF 0x3f3f3f3f 
#define MEM(x,y) memset(x,y,sizeof(x))
#define int long long
#define rep(i , a , b) for(int i = a ; i <= b ; i ++)
#define P pair<int,int>
#define  sc(a) scanf("%lld",&a)
#define pf(a) printf("%lld ",a)
using namespace std;
int n;
string s;
void dfs(ll x)
{
	if (x == n)
	{
		cout << s << endl;
		return;
	}
	else
	{
		char c = 'a';
		rep(i, 0, x - 1)
			c = max(s[i], c);
		rep(i, 0, c + 1 - 'a')
		{
			s[x] = i+'a';
			dfs(x + 1);
		}
	}
}
signed main()
{
	int  a;
	s = "a               ";
	cin >> n;
	dfs(1);
}











Measured memory_bytes: 2176
#include <bits/stdc++.h>
#include <string>
#include <sstream>
using namespace std;
#define ll long long
#define ff first
#define ss second
#define clr(a) memset(a, 0, sizeof(a))
#define set(a) memset(a, -1, sizeof(a))
#define pb push_back
#define sz(a) ((ll)a.size())
#define all(a) a.begin(), a.end()
#define mp make_pair
#define rep(i, a, y) for (ll i = a; i <= y; i++)
#define rep2(i, b) for (int i = 0; i < b; i++)
#define repl(i, a, b) for (ll i = a; i <= b; i++)
#define ppi pair<int, int>
#define scl(x) scanf("%d", &x)
#define pcl(x) printf("%d", x)
#define FastRead                  \
    ios_base::sync_with_stdio(0); \
    cin.tie(0)
/*

     ██╗██╗   ██╗██╗  ██╗ █████╗ ███╗   ██╗
     ██║██║   ██║██║  ██║██╔══██╗████╗  ██║
     ██║██║   ██║███████║███████║██╔██╗ ██║
██   ██║██║   ██║██╔══██║██╔══██║██║╚██╗██║
╚█████╔╝╚██████╔╝██║  ██║██║  ██║██║ ╚████║
 ╚════╝  ╚═════╝ ╚═╝  ╚═╝╚═╝  ╚═╝╚═╝  ╚═══╝

*/
map<string,ll>p;
int main()
{
    FastRead;
    ll n,i=1;
    cin>>n;
    string s;
    for(i=1;i<=n;i++)
    {
        cin>>s;
        p[s]++;
    }
    vector<string>v={"AC","WA","TLE","RE"};
    for(int i=0;i<v.size();i++)
    {
        auto it=p.find(v[i]);
        if(it!=p.end())
        {
            cout<<v[i]<<" x "<<it->ss<<endl;
        }
        else
        {
            cout<<v[i]<<" x "<<"0"<<endl;
        }
    }
    return 0;
}

Measured memory_bytes: 3660
#include<bits/stdc++.h>
#define all(v) v.begin(),v.end()
using namespace std;
int main(){
	cin.tie(0);
    ios::sync_with_stdio(false);
    int n,k,ans=1;
    cin>>n>>k;
    for(int i=0;i<n;i++){
        ans=min(ans*2,ans+k);
    }
    cout<<ans<<endl;
    return(0);
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  string a="No";
  int ans=0;
  int x=n;
  while(n){
    ans+=n%10;
    n=n/10;
  }
  if(x%ans==0){a="Yes";}
  cout<<a;
}

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

#############
# Libraries #
#############

import sys
input = sys.stdin.readline

import math
from collections import deque
from fractions import gcd
from functools import lru_cache


#############
# Constants #
#############

MOD = 10**9 +7
INF = float('inf')

#############
# Functions #
#############

######INPUT######
def inputI(): return int(input().strip())
def inputS(): return input().strip()
def inputIL(): return list(map(int,input().split()))
def inputSL(): return list(map(str,input().split()))
def inputILs(n): return list(int(input()) for _ in range(n))
def inputSLs(n): return list(input().strip() for _ in range(n))
def inputILL(n): return [list(map(int, input().split())) for _ in range(n)]
def inputSLL(n): return [list(map(str, input().split())) for _ in range(n)]

#####Inverse#####
def inv(n): return pow(n, MOD-2, MOD)

######Combination######
kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

######Factorization######
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])
    return arr

#####LCM#####
def lcm(a, b):
    return a * b // gcd (a, b)

#############
# Main Code #
#############

N = inputI()
l = []
for i in range(N):
  a = inputI()
  l.append(inputILL(a))

best = 0
for i in range(pow(2,N)):
  OKAY = True
  count = 0
  temp = i
  while temp:
    temp &= temp -1
    count += 1
  for n in range(N):
    if ((pow(2,n)&i )>> n) & 1:
      for statement in l[n]:
        if ((pow(2,statement[0]-1)&i)>>(statement[0]-1) ) != statement[1]:
          OKAY = False
  if OKAY == True:
    best = max(best,count)

print(best)


Measured memory_bytes: 69608
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll; // [9,223,372,036,854,775,807 to -9.....808] 19 digits
typedef long double ld;
#define inc(i, a, b) for (long long int i = a; i <= b; i++)
#define dec(i, a, b) for (long long int i = a; i >= b; i--)
#define fast                      \
    ios_base::sync_with_stdio(0); \
    cin.tie(NULL);                \
    cout.tie(NULL);
#define pb push_back
#define all(c) (c).begin(), (c).end()
#define lv vector<ll>
#define cv vector<char>
#define dv vector<ld>
#define rall(c) (c).rbegin(), (c).rend()
#define lpr pair<ll, ll>
#define mp make_pair
#define cin(c) \
    ll c;      \
    cin >> c;
#define lmap unordered_map<ll, ll>
#define vinp(a, n) \
    inc(i, 1, n)   \
    {              \
        cin(k);    \
        a.pb(k);   \
    }
#define LIM 1000000007
#define F first
#define S second
#define fr(i, n) inc(i, 0, n - 1)
#define fri(n, a) \
    inc(i, 0, n - 1) { cin >> a[i]; }
#define end cout << "\n";
#define debug(p) cout << p;
#define umap unordered_map
#define uset unordered_set
#define fill(a, val, n) \
    inc(i, 0, n - 1) { a[i] = val; }
void i_love_Accepted()
{
    char c;
    cin>>c;
    if(c>='a')
        cout<<'a';
    else
        cout<<'A';
}   
int main()
{
    fast;
    ll t=1;
    //cin>>t;
    while(t--)
    {
        i_love_Accepted();
        end;
    } 
}


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

right = a[n-1]-a[0]
left = 0

min = right

for x in range(n-1):
    left = (k-a[x+1])+a[x]
    if left <= right and left < min:
        min = left

print(str(min))

Measured memory_bytes: 26436
#include<stdio.h>
int main(void)
{
	int n;
	scanf("%d",&n);
	for(int i=0;i*7<=n;i++)
	{
		
		if((n-i*7)%4==0)
		{
			puts("Yes");
			return 0;
		}
	}
	puts("No");
	return 0;
}

Measured memory_bytes: 128
#!usr/bin/env python3
from collections import defaultdict
from heapq import heappush, heappop
import sys
import math
import bisect
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return list(sys.stdin.readline())
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
mod = 1000000007

#A
x, y = LS()
if x > y:
    print(">")
elif x == y:
    print("=")
else:
    print("<")

Measured memory_bytes: 38384
import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline
n = int(readline())
x = [int(i) for i in readline().split()]

p1 = sum(x)//n
p2 = sum(x)//n+1
ans1 = 0
ans2 = 0
for i in x:
    ans1 += (i-p1)**2
    ans2 += (i-p2)**2
print(min(ans1, ans2))

Measured memory_bytes: 3064
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

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

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

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

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1000000007;

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

int main() {
	int n;
	cin >> n;
	int s;
	LL sum = 0;
	int min_s = 101;
	for (int i = 0; i < n; i++) {
		cin >> s;
		sum += s;
		if (s % 10 != 0) {
			min_s = min(s,min_s);
		}
	}
	if (sum % 10 == 0) {
		if (min_s == 101) {
			cout << 0;
		}
		else {
			cout << sum - min_s;
		}
	}
	else {
		cout << sum;
	}


	return 0;
}



Measured memory_bytes: 256
import java.util.Scanner;


public class Main {

	public static void main(String[] args) {

		Scanner scanner=new Scanner(System.in);
		String S=scanner.next();

		int kotae=0;

		for(int i=0;i<4;i++) {
			if(S.substring(i,i+1).equals("+")) {//Stringは参照型。文字の中身の比較をするのは.equals
				kotae++;
			}else {
				kotae--;
			}

		}System.out.println(kotae);
	}
}


Measured memory_bytes: 23764
#include<bits/stdc++.h>
#define forr(i, a, b) for(int i = (a); i < (b); i++)
#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = 1; i <= (n); i++)
#define ALL(a) (a.begin()),(a.end())
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll, ll> LP;
const ll LINF = 1LL<<60;
const int INF = 1001001001;
const int MOD = 1000000007;

/* --------------------------------------------------- */

int main() {
    int n, m;
    cin >> n >> m;
    vector<int> V(n + 1, INF);
    int ans = 0;
    rep(i, m) {
        int a, b;
        cin >> a >> b;
        if(V[a] != INF && b != V[a]) {
            ans = -1;
        }
        V[a] = b;
    }
    if(ans == -1) {
        cout << ans << endl;
        return 0;
    }
    if(n >= 2) {
        if(V[1] == 0) {
            cout << -1 << endl;
            return 0;
        } 
        rrep(i, n) {
            if(V[i] == INF) {
                if(i == 1) {
                    V[i] = 1;
                } else {
                    V[i] = 0;
                }
            }
        }
    } else {
        if(V[1] == INF) {
            V[1] = 0;
        }
    }
    
    rrep(i, n) {
        cout << V[i];
    }
    cout << endl;

    return 0;
}

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

int main() {
  string name;
  int a, b;
  for (int i=0; i<N; i++) {
    int am = 200, pm = 300;
    cin >> name >> a >> b;
    int num = a+b;
    int fee = a*am+b*pm;
    cout << name << " " << num << " " << fee << endl;
  }
  return 0;
}

Measured memory_bytes: 3184
//#include "bits/stdc++.h"

#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>
#include<iomanip>
#include<unordered_set>
#include<bitset>
#include<complex>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

//typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

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

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD =  (int)1e9 + 7;
const double EPS = 1e-9;

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

	int N, K, X, Y;
	cin >> N >> K >> X >> Y;

	cout << X * min(N, K) + Y * max(0LL, N - K) << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
#define rep(i,a,b)    for(int i=a;i<b;i++)
#define repn(i,a,b)   for(int i=a;i>=b;i--)
#define ll long long
#define ld long double
#define F first
#define S second
#define pii pair<int,int>
#define vi vector<ll>
#define vii vector<pii>
#define pb push_back
#define mp  make_pair
#define all(v) (v).begin(), (v).end()
#define sz(a) ll(a.size())

#define pb push_back
#define mp make_pair
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
ll INF = 1e6;

void solve()
{
    ll n, d;
    cin>>n>>d;
    ll a[n][2]; ll ans=0;
    rep(i,0,n)
    {
        cin>>a[i][0]>>a[i][1];
        if(a[i][0]*a[i][0] + a[i][1]*a[i][1]<=d*d)
            ans++;
    }
    cout<<ans;

}
 
int main()
{
    SPEED;
    ll t = 1;
    //cin>>t;
    while(t--) solve();
    return 0;
}



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

using namespace std;
int graph[125][125], color[125], times, s[125], f[125], v, w, n;
class DFS{
public:
	static void search(){
		for(int i = 1;i<=n;i++){
			color[i] = 0;
		}
		times = 0;
		for(int u = 1;u<=n;u++){
			if(color[u] == 0){
				visit(u);
			}
		}
	}
	static void visit(int u){
		color[u] = 1;
		s[u] = ++times;
		for(int w=1;w<=n;w++){
			if(graph[u][w] == 0) continue;
			if(color[w] == 0){
				visit(w);
			}
		}
		color[u] = 2;
		f[u] = ++times;
	}
};
int main(){
	cin >> n;
	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++){
			graph[i][j] = 0;
		}
	}

	for(int i=1;i<=n;i++){
		int num;
		int k;
		int tmp;
		cin >> num >> k;
		if(k !=0){
			for(int j=0;j<k;j++){
				cin >> tmp;
				graph[num][tmp] = 1;
			}
		}
	}
	DFS::search();
	int i;
	for(i=1;i<=n;i++){
		cout << i << " " << s[i] << " " << f[i] << endl;
	}
}



Measured memory_bytes: 3128
#include <bits/stdc++.h>
using namespace std;
int s[100005],us[100005],x,y,ans;
map <int,int> in;
int main()
{
	scanf("%d",&x);
	for(int i=1;i<=x;i++)
	{
		scanf("%d",&s[i]);
		us[i]=s[i];
		in[us[i]]=i%2;
	}
	sort(s+1,s+1+x);
	for(int i=1;i<=x;i++)
	{
		if(in[us[i]] != in[s[i]])
			ans++;
	}
	if(ans!=0)
		printf("%d",ans/2);
	else
		printf("0");
}


Measured memory_bytes: 5760
#include <bits/stdc++.h>
#define ios ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long
#define bit(x,j) ((x>>j)&1)
using namespace std;
// bitset<8>set1(p);
// __builtin_popcountll(x);
// bitset<100> b("1010");
ll int mod=1e9+7;//998244353;
int mul(ll int x, ll int y)
{
    return (x * 1ll * y) % mod;
}

int add(int x, int y)
{
    x += y;
    while(x >= mod) x -= mod;
    while(x < 0) x += mod;
    return x;
}

long long power(long long a, long long b,ll m) {
    a %= m;
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = mul(res,a);
        a = mul(a,a);
        b >>= 1;
    }
    return res%m;
    }


  ll int binomial(ll int n, ll int k) 
{ 
    ll int C[k+1]; 
    memset(C, 0, sizeof(C)); 
  
    C[0] = 1;  // nC0 is 1 
  
    for (ll int i = 1; i <= n; i++) 
    { 
        // Compute next row of pascal triangle using 
        // the previous row 
        for (int j = min(i, k); j > 0; j--) 
            C[j] = C[j]+C[j-1]; 
    } 
    return C[k]; 
} 
  vector<int> pr;
  bool prime[10000000];
void Sieve(ll int n) 
{ 
    memset(prime, true, sizeof(prime)); 
    prime[1]=false;
  
    for (int p=2; p*p<=n; p++) 
    { 
        if (prime[p] == true) 
        { 
            pr.push_back(p);
            for (int i=p*p; i<=n; i += p) 
                prime[i] = false; 
        } 
    } 
}
 


//It reurns Fn,Fn+1
pair<int, int> fib (int n) {
    if (n == 0)
        return {0, 1};

    auto p = fib(n >> 1);
    int c = p.first * (2 * p.second - p.first);
    int d = p.first * p.first + p.second * p.second;
    if (n & 1)
        return {d, c + d};
    else
        return {c, d};
}
int sum(int n)  
{  
    if (n == 0)  
    return 0;  
    return (n % 10 + sum(n / 10));  
}  
ll int factorial(ll int n,ll int m) 
{ 
    ll int fact = 1; 
    for(int i=2;i<=n;i++) { 
        fact = (fact * i)%m; 
    } 
    return fact%m; 
} 

int reduce(int x, int y) 
{ 
    int d; 
    d = __gcd(x, y); 
  
    x = x / d; 
    y = y / d; 
    return x; 
} 


int main() {
  ios;
  string s;
  cin>>s;
  ll int l=0;
  for(int i=0;i<s.length();i++)
  {
      l+=(s[i]-'0');
  }
  if(l%9==0)
  cout<<"Yes"<<endl;
  else
  cout<<"No"<<endl;
}


Measured memory_bytes: 3736
#include <iostream>
#include <cctype>
#include <string>

int main() {
    std::string s;
    
    std::getline(std::cin, s);
    for (auto &c: s) {
        if (std::isupper(c)) {
            c = std::tolower(c);
        } else {
            c = std::toupper(c);
        }
    }

    std::cout << s << std::endl;
}


Measured memory_bytes: 3184
def IOI(n):
	m = "I"
	for _ in xrange(n):
		m += "OI"
		
	return m

while True:
	n = input()
	if n == 0 : break

	w = IOI(n)
	m = input()
	nm = raw_input()
	
	count = 0
	for i in xrange(len(nm) - 2 * n):
		if nm[i:i+2*n+1] == w : count += 1
		
	print count

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

using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define MIN(a,b) ((a)>(b)? (b): (a))
#define MAX(a,b) ((a)<(b)? (b): (a))

const long long INF = 1LL << 60;
typedef unsigned long long ll;
const long long MOD = 1000000000 + 7;

int main(){
    char x, y;
    cin >> x >> y;
    if(x>y)
        cout << ">" << endl;
    else if(x<y)
        cout << "<" << endl;
    else
        cout << "=" << endl;
    return 0;
}

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

ans=0
for i in range(n):
  ans+=min(a[i],b[i])
  b[i]-=min(a[i],b[i])
  ans+=min(a[i+1],b[i])
  a[i+1]-=min(a[i+1],b[i])
print(ans)

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

typedef long long ll;
#define OO 1e9
using namespace std;
double dp[301][301][301];
int n;
double ans(int i, int j, int k){
  if(dp[i][j][k] != -1)
    return dp[i][j][k];
  if(i + j + k > n)
    return 0;
  if(i == n)
    return 0;
//  cout << i << ' ' << j << ' ' << k << endl;
  double p = 1.0;
//  cout << p << endl;
//  if(i)
//    p += (1.0 * (n - i) / n);
  if(j)
    p += 1.0 * j / n * ans(i + 1, j - 1, k);
  if(k)
    p += 1.0 * k / n * ans(i, j + 1, k - 1);
  if(n - i - j - k)
    p += (1.0 * (n - i - j - k) / n * ans(i, j, k + 1));
  dp[i][j][k] = p / (1 - 1.0 * i / n);
  return dp[i][j][k];
}
int main(){
//  freopen("in.txt", "r", stdin);
//  freopen("out.txt", "w", stdout);
  cin >> n;
  int a[3] = {0};
  int x;
  for(int i = 0;i < n;i++){
    cin >> x;
    a[x - 1]++;
  }
  for(int i = 0;i <= 300;i++)
    for(int j = 0;j <= 300;j++)
      for(int k = 0;k <= 300;k++)
        dp[i][j][k] = -1;
//  for(int i = n;i >= 0;i--){
//    for(int j = 0;j <= n;j++){
//      for(int k = 0;k <= n;k++){
//        if(i + j + k > n)continue;
//        if(i == n){
//          dp[i][j][k] = 0;
//          continue;
//        }
//        double p = 0;
//        if(i)
//          p += (1.0 * (n - i) / i);
//        if(j)
//          p += 1.0 * j / n * dp[i + 1][j - 1][k];
//        if(k)
//          p += 1.0 * k / n * dp[i][j + 1][k - 1];
//        if(n - i - j - k)
//          p += (1.0 * (n - i - j - k) / n * dp[i][j][k + 1]);
//        dp[i][j][k] = p / (1 - 1.0 * i / n);
//        cout << dp[i][j][k] << endl;
//      }
//    }
//  }
//  cout << a[0] << ' ' << a[1] << endl;
  printf("%.10f", ans(0, a[0], a[1]));
//  cout << ans(0, a[0], a[1]);
}


Measured memory_bytes: 213376
a_count = 0
b_count = 0
N,A,B =gets.chomp.split(' ').map{|n| n.to_i}
S = gets.chop
for num in 0..N-1 do
    if S[num] == 'a' && (a_count + b_count) < A + B
      puts "Yes"
      a_count += 1
    elsif S[num] == 'b' && (a_count + b_count) < A + B && b_count < B
      puts "Yes"
      b_count += 1
    else
      puts"No"
    end
end


Measured memory_bytes: 2428
// At Corder.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//

#include <algorithm>
#include <iostream>
using namespace std;
#include <bits/stdc++.h>
#include <vector>
#include <numeric>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using ll = long long;
using p = pair<int, int>;//<key,value>
#include <math.h>
int main()
{
int n;
cin>>n;
set<string> st;
rep(i,n){
string s;
cin>>s;
st.insert(s);}//setにいれる
cout<<st.size()<<endl;

	return 0;
}

// プログラムの実行: Ctrl + F5 または [デバッグ] > [デバッグなしで開始] メニュー
// プログラムのデバッグ: F5 または [デバッグ] > [デバッグの開始] メニュー

// 作業を開始するためのヒント:
//    1. ソリューション エクスプローラー ウィンドウを使用してファイルを追加/管理します
//   2. チーム エクスプローラー ウィンドウを使用してソース管理に接続します
//   3. 出力ウィンドウを使用して、ビルド出力とその他のメッセージを表示します
//   4. エラー一覧ウィンドウを使用してエラーを表示します
//   5. [プロジェクト] > [新しい項目の追加] と移動して新しいコード ファイルを作成するか、[プロジェクト] > [既存の項目の追加] と移動して既存のコード ファイルをプロジェクトに追加します
//   6. 後ほどこのプロジェクトを再び開く場合、[ファイル] > [開く] > [プロジェクト] と移動して .sln ファイルを選択します


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

using namespace std;
inline void read(int &x){
    char ch;
    bool flag=false;
    for (ch=getchar();!isdigit(ch);ch=getchar())if (ch=='-') flag=true;
    for (x=0;isdigit(ch);x=x*10+ch-'0',ch=getchar());
    x=flag?-x:x;
}

inline void read(long long &x){
    char ch;
    bool flag=false;
    for (ch=getchar();!isdigit(ch);ch=getchar())if (ch=='-') flag=true;
    for (x=0;isdigit(ch);x=x*10+ch-'0',ch=getchar());
    x=flag?-x:x;
}


inline void write(int x){
    static const int maxlen=100;
    static char s[maxlen];
        if (x<0) {   putchar('-'); x=-x;}
    if(!x){ putchar('0'); return; }
    int len=0; for(;x;x/=10) s[len++]=x % 10+'0';
    for(int i=len-1;i>=0;--i) putchar(s[i]);
}
int const MAXN= 310;
int n;
long long a[ MAXN ][ MAXN ];
//long long g[ MAXN ][ MAXN ];

struct Edge{
int st,ed;
long long v;
}edge[ MAXN*MAXN ];


bool cmp( Edge A, Edge B){
return A.v< B.v;
}

const long long INF = 2147483647;


int main(){
    read(n);
    int cnt=0;
    for (int i=1;i<=n;i++)
        for (int j=1;j<=n;j++)
        {
            read(a[i][j]);
            edge[++cnt].st=i;
            edge[cnt].ed=j;
            edge[cnt].v=a[i][j];
        }
    long long ans=0;
        for (int i=1;i<=n;i++)
            for (int j=1;j<=n;j++)
            {
                long long minn=INF;
                for (int k=1;k<=n;k++)
                    if ( (k!=j)&& (k!=i ) )
                        minn= min( minn , a[ i ][k] + a[ k ][j] );
                if (minn > a[ i ][ j ])
                    ans+=a[i][j];
                if (minn < a[i][j])
                    {
                        puts("-1");
                        return 0;
                    }
            }
    /*
    for (int i=1;i<=n;i++)
        for (int j=1;j<=n;j++)
            g[i][j]=INF;
    sort( edge+1 , edge+cnt+1, cmp);
    long long ans=0;
    for (int i=1;i<=cnt;i++)
        {
            int x=edge[i].st;
            int y=edge[i].ed;
            long long minn=INF;
            for (int j=1;j<=n;j++)
                minn= min( minn , g[ x ][j]+g[ y ][j] );
            if (minn > a[ x ][ y ])
                {
                    g[x][y]=a[x][y];
                    g[y][x]=a[x][y];
                    ans+=a[x][y];
                }
            if (minn < a[x][y])
                {
                    puts("-1");
                    return 0;
                }
        }
    */
    cout<<ans/2<<endl;
    return 0;
}


Measured memory_bytes: 2432
// https://atcoder.jp/contests/dp/tasks/dp_o

#include <bits/stdc++.h>

using namespace std;

#define REP(i,n)   for(int i=0; i<(int)(n); i++)
#define FOR(i,b,e) for(int i=(b); i<=(int)(e); i++)
#define DUMP(a, n) REP(i, n) printf("%d%c", a[i], i + 1 == n ? '\n' : ' ')
#define DUMP2D(a, n, m) REP(i, n) REP(j, m) printf("%d%c", a[i][j], j + 1 == m ? '\n' : ' '); puts("")

//------------------------------------------------------------------------------
int num_of_bits(int bits)
{
    bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555);
    bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);
    bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f);
    bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff);
    return (bits & 0x0000ffff) + (bits >>16 & 0x0000ffff);
}

//------------------------------------------------------------------------------
const int N_MAX = 21;
const int MOD = 1e9+7;
const int S_MAX = 1 << 21;

int N;
int a[N_MAX][N_MAX];

int S;
int dp[S_MAX];

void solve() {
  S = 1 << N;
  dp[0] = 1;
  for (int s = 0; s < S - 1; s++) {
    int i = num_of_bits(s);
    REP(j, N) {
      if (a[i][j] > 0 && (s >> j & 1) == 0) {
        int s2 = s | 1 << j;
        dp[s2] = (dp[s2] + dp[s]) % MOD;
      }
    }
  }
  printf("%d\n", dp[S - 1]);
}

void input() {
  scanf("%d", &N);
  REP(i, N) REP(j, N) scanf("%d", &a[i][j]);
}

int main() {
  input();
  solve();
  return 0;
}


Measured memory_bytes: 8448
/************************************************
*Author        :  Jack
*Created Time  :  2019.10.27.20:11
*Mail          :  724033213@qq.com
*Problem       :  c
*Extra         :  
************************************************/
#include <bits/stdc++.h>
#define int long long
using namespace std;
int n, t;
signed main() {
//    freopen("c.in","r",stdin);
//    freopen("c.out","w",stdout);
    cin >> n;
	int t = sqrt(n);
	while(t){
		if(n % t == 0){
			cout << t + n / t - 2;
			return 0;
		}
		t --;
	}
    return 0;
}


Measured memory_bytes: 256
//by Top1
#include <bits/stdc++.h>
          
#define f first
#define s second
#define int long long
#define ld long double
#define ull unsigned long long
#define pii pair <int, int>
#define pll pair <long, long>
#define mp make_pair
#define pb push_back
#define pf push_front
#define pp pop_back
#define cerr cout
#define rev reverse
#define all(s) s.begin(), s.end()
#define sz(s) (int)s.size()
#define forn(i, a, b) for (int i = a; i <= b; i++)
#define boost ios_base::sync_with_stdio(false); cin.tie(0),cout.tie(0);
#define nxtp next_permutation
#define pvtp prev_permutation
#define KZ return 
#define x1 x21212121
#define y1 y21212121
#define sqr(x) x * x 
      
const int inf = (1e9) + 1;
const int mod = 1e9 + 7;
const int maxn = 3e6 + 111;
        
using namespace std;          

int n, k, ans;

void solve(){
	cin >> n >> k;

   	for (int i = k - 1; i <= n; i++){
   		ans += (n - i + 1) % mod + (n - i) % mod * i % mod;
   		ans %= mod;
   	}

   	cout << ans;
}                              
      
main(){
	//freopen(".in", "r", stdin);
	//freopen(".out", "w", stdout);

    boost;
    
    int q = 1;
 
    //cin >> q;
    
    while (q--){
        solve();
    }
}

Measured memory_bytes: 3612
use std::io;
use std::str::FromStr;

static MOD: u64 = 1_000_000_007;

fn input_tuple() -> (u64, u64) {
    let mut line: String = String::new();
    io::stdin().read_line(&mut line);
    let vec: Vec<u64> = line.split_whitespace().map(|s| s.parse().unwrap()).collect();
    (vec[0], vec[1])
}

fn binary_power(x: u64, n: u64) -> u64 {
    if n == 0 {
      return 1;
    }
    if n % 2 == 0 {
      return (binary_power(x, n / 2) % MOD).pow(2) % MOD;
    } else {
      return binary_power(x, n - 1) % MOD * x % MOD;
    }
}
  
fn inverse_mod(n: u64) -> u64 {
    binary_power(n, MOD-2)
} 

fn combination(n: u64, m: u64, fact: &Vec<u64>, finv: &Vec<u64>) -> u64 {
    fact[n as usize] * finv[m as usize] % MOD * finv[(n-m) as usize] % MOD
}

fn main() {
    let (n, k) = input_tuple();
    let mut fact: Vec<u64> = Vec::new();
    let mut finv: Vec<u64> = Vec::new();
    fact.push(1);
    fact.push(1);
    finv.push(inverse_mod(1));
    finv.push(inverse_mod(1));
    for i in 2..n*2 {
        fact.push(fact[i as usize - 1] * i % MOD);
        finv.push(inverse_mod(fact[i as usize]));
    }
    // println!("{:?}", fact);
    // println!("{:?}", finv);
    if k >= n {
        // 全組み合わせ
        println!("{}", combination(n * 2 - 1, n - 1, &fact, &finv));
        return;
    }
    let mut sum = 0;
    for i in (n-k)..(n+1) {
        sum += combination(n, i, &fact, &finv) * combination(i + n - i - 1, n - i, &fact, &finv);
        sum %= MOD;
    }
    println!("{}", sum);
}


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

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a, b, k;
  cin >> a >> b >> k;
  int count = 0;
  vi m;
  for (int i = min(a, b); i >= 1; i--) {
    if (a % i == 0 && b % i == 0) {
      m.push_back(i);
    }
  }
  cout << m[k - 1] << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i <=(n); ++i)
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define inf 2147483647 //int値の最大値
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素
#define CST(x) cout<<fixed<<setprecision(x)//小数点以下の桁数指定
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;
}
int gcd(int a, int b) {
    if (b==0) return a;
    else return gcd(b, a%b);
}
int lcm(int a, int b) {
    return a * b / gcd(a, b);
}
int two(int n){
	ll ans=1;
	rep(i,n){
		ans*=2;
	}
	return ans;
}
int main() {
	cin.tie(0);
	cout.tie(0);
	ios::sync_with_stdio(false);

   int a,b,c,x;
   cin>>a>>b>>c>>x;
   int sum =0;

   rep(i,a)rep(j,b){
      rep(k,c)if(50*k==x-500*i-100*j)sum++;

   }
   cout<<sum<<endl;


}

Measured memory_bytes: 3624
#!python3

import numpy as np

LI = lambda: list(map(int, input().split()))

# input
N = int(input())
A, B = [None] * N, [None] * N
for i in range(N):
    A[i], B[i] = LI()


def main():
    a, b = np.array(A, dtype=int), np.array(B, dtype=int)
    a.sort()
    b.sort()
    i = N // 2
    if N % 2 == 0:
        a *= 2
        b *= 2
        l = (a[i - 1] + a[i]) // 2
        r = (b[i - 1] + b[i]) // 2
        ans = r - l + 1
    else:
        ans = b[i] - a[i] + 1
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 45624
package main

import "fmt"

func main() {
	var N int
	var P []int
	fmt.Scanf("%d", &N)
	P = make([]int, N)
	for i := 0; i < N; i++ {
		fmt.Scanf("%d", &P[i])
	}
	min := 0
	count := 0
	for i := 0; i < N; i++ {
		if i == 0 {
			min = P[0]
			count++
			continue
		}
		if min < P[i] {
			continue
		} else {
			min = P[i]
			count++
		}
	}
	fmt.Println(count)
}


Measured memory_bytes: 4992
local ior = io.input()
local n = ior:read("*n", "*l")
local num_b_st_a_ed = 0
local num_b_st = 0
local num_a_ed = 0

local tot = 0

for i = 1, n do
  local str = ior:read()
  local len = #str
  local isfirst = true
  local bcand = false
  local adet = false
  if(str:sub(1, 1) == "B") then bcand = true end
  if(str:sub(len, len) == "A") then adet = true end
  for j = 1, len - 1 do
    if(str:sub(j, j) == "A" and str:sub(j + 1, j + 1) == "B") then
      tot = tot + 1
      -- print("FOUND")
    end
  end
  if(adet and bcand) then
    num_b_st_a_ed = num_b_st_a_ed + 1
    -- print(i, "BA")
  elseif(adet) then
    num_a_ed = num_a_ed + 1
    -- print(i, "-A")
  elseif(bcand) then
    num_b_st = num_b_st + 1
    -- print(i, "B-")
  end
end
-- print(num_a_ed, num_b_st, num_b_st_a_ed)
if(num_a_ed == 0 and num_b_st == 0) then
  if(0 < num_b_st_a_ed) then
    tot = tot + num_b_st_a_ed - 1
  end
else
  tot = tot + num_b_st_a_ed + math.min(num_a_ed, num_b_st)
end
print(tot)


Measured memory_bytes: 384
#include <iostream>
using namespace std;
int main(){
  int A,B,C,X;
  int d=0;
  cin >> A;
  cin >> B;
  cin >> C;
  cin >> X;
  for (int a=0; a<=A; a++){
    for (int b=0; b<=B; b++){
      for (int c=0; c<=C; c++){
        if (a*500+b*100+c*50==X){
          d++;
        }
      }
    }
  }
  cout << d << "\n";
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
	    double a = Double.parseDouble( scan.next());
	    double pi=Math.PI;
	    
	    double area = a * a * pi;
	    double length = 2 * a * pi;
	    
	    String ar = String.format("%f", area);
	    String l = String.format("%f", length);
	    
	    System.out.println(ar + " "+ l);
 
	}
}

Measured memory_bytes: 26248
#include<bits/stdc++.h>
#define rep(i,m) for(long long i=0; i<m; i++)
#define per(i,m) for(long long i=m-1; i>=0; i--)
#define FOR(i,n,m) for(long long i=n; i<m; i++)
#define ROF(i,n,m) for(long long i=n-1; i>=m; i--)
#define all(x) (x).begin(),(x).end()
#define EPS (1e-7)
#define INF (1e18)
#define PI (acos(-1))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
typedef pair<ll, ll> LP;

ll POW(ll x,ll n){
  if(n==0)return 1;
  if(n%2==0)return POW(x*x%MOD,n/2);
  return x*POW(x,n-1)%MOD;
}

ll gcd(ll u, ll v) {
  ll r;
  while (0 != v) {
    r = u % v; u = v; v = r;
  }
  return u;
}
 
ll KAI(ll m)
{
  if(m<0) return 0;
  if(m==0) return 1;
  return m*KAI(m-1)%MOD;
}
 
ll extGCD(ll a, ll b, ll &x, ll &y) {
    if (b == 0) {
        x = 1;
        y = 0;
        return a;
    }
    ll d = extGCD(b, a%b, y, x);
    y -= a / b * x;
    return d;
}
 
inline ll mod(ll a, ll m) {
    return (a % m + m) % m;
}
 
ll modinv(ll a) {
    ll x, y;
    extGCD(a, MOD, x, y);
    return mod(x, MOD);
}
 
ll COM(ll m,ll n)
{
  if(m<n) return 0;
  if(n<0) return 0;
  if(n==0) return 1;
  if(m==n) return 1;
  return KAI(m)%MOD*modinv(KAI(n)%MOD*KAI(m-n)%MOD)%MOD;
}

ll DEC(ll x,ll m,ll n)
{
  return x%POW(m,n+1)/POW(m,n);
}

ll keta(ll x,ll n)
{
  if(x==0)return 0;
  return keta(x/n,n)+1;
}

ll DIV(ll x,ll n)
{
  if(x==0)return 0;
  return x/n+DIV(x/n,n);
}


int main()
{
  ll n,k,a;
  a=1;
  cin >> n >> k;
  rep(i,n)a=min(2*a,a+k);
  printf("%lld",a);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n)for(int i=0;i<(n);i++)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
using ll = long long;
using P = pair<int, int>;
using Graph = vector<vector<int>>;

int main(){
    int n, t; cin >> n >> t;
    vector<P> vec;
    rep(i,n){
        int c, t; cin >> c >> t;
        vec.push_back(P(c,t));
    }
    sort(ALL(vec));
    for(auto p : vec){
        if(p.second <= t){
            cout << p.first << endl;
            return 0;
        }
    }
    cout << "TLE" << endl;
}

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

const int MAX_N = 101000;
int a[MAX_N];
int N;

int main()
{
    scanf("%d", &N);
    for(int i = 1; i <= N; ++i) scanf("%d", &a[i]);
    int res = 0;
    for(int i = 1; i <= N; ++i) if(a[a[i]] == i) ++res;
    printf("%d\n", res/2);
}

Measured memory_bytes: 640
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;

int r, c;

int main(){
	while (scanf("%d%d", &r, &c), r){
		int s[10000][10];
		for (int i = 0; i < r; i++){
			for (int j = 0; j < c; j++){
				scanf("%d", &s[j][i]);
			}
		}
		int Max = 0;
		for (int i = 0; i < 1 << r; i++){
			int cnt = 0;
			for (int j = 0; j < r; j++){
				if (i >> j & 1){
					for (int t = 0; t < c; t++)
						s[t][j] ^= 1;
				}
			}
			for (int j = 0; j < c; j++){
				int coun = count(s[j], s[j] + r, 0);
				cnt += max(coun, r - coun);
			}
			Max = max(Max, cnt);
			for (int j = 0; j < r; j++){
				if (i >> j & 1){
					for (int t = 0; t < c; t++)
						s[t][j] ^= 1;
				}
			}
		}
		printf("%d\n", Max);
	}
	return 0;
}

Measured memory_bytes: 3128
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<vector>
using namespace std;
#define MOD 1000000007
#define MAX 100100
#define ll long long
inline int read()
{
	int x=0;bool t=false;char ch=getchar();
	while((ch<'0'||ch>'9')&&ch!='-')ch=getchar();
	if(ch=='-')t=true,ch=getchar();
	while(ch<='9'&&ch>='0')x=x*10+ch-48,ch=getchar();
	return t?-x:x;
}
int n,ans=1;
int a[MAX],dg[MAX];
bool cir[MAX];
int col[MAX],foot[MAX],cnt[MAX];
int f[MAX];
int main()
{
	n=read();
	for(int i=1;i<=n;++i)a[i]=read(),++dg[a[i]];
	for(int i=1;i<=n;++i)
	{
		if(col[i])continue;
		int x=i;
		for(;!col[x];x=a[x])col[x]=i;
		if(col[x]!=i)continue;//circle with foot
		for(;!cir[x];x=a[x])cir[x]=true;//circle
	}
	for(int i=1;i<=n;++i)//illegal part 
		if((cir[i]&&dg[i]>2)||(!cir[i]&&dg[i]>1)){puts("0");return 0;}
	for(int i=1;i<=n;++i)
	{
		if(dg[i])continue;//start of a foot do not have egde in
		int x=i,len=0;
		while(!cir[x])x=a[x],++len;
		foot[x]=len;//record length
	}
	for(int i=1;i<=n;++i)//calculate answer of circle with feet
	{
		if(!cir[i])continue;//calculate circles
		int x=i,pts=0,st=0,l1=0,fr=0;
		//st:last root of foot,fr:first root of foot,l1:length of the first foot
		//pts:number of the node in the circle
		while(cir[x])
		{
			++pts;cir[x]=false;
			if(foot[x])//a foot in the circle
			{
				if(!fr)st=fr=pts,l1=foot[x];
				else
				{
					int ways=(foot[x]<(pts-st))+(foot[x]<=(pts-st));
					ans=ans*ways%MOD;st=pts;
				}
			}
			x=a[x];
		}
		if(fr)//circle of feet
		{
			int ways=(l1<(pts+fr-st))+(l1<=(pts+fr-st));
			ans=ans*ways%MOD;
		}
		else//just a circle
			cnt[pts]+=1;
	}
	for(int i=1;i<=n;++i)//dp,in order to calc each length of circles
	{
		if(!cnt[i])continue;
		f[0]=1;
		for(int j=1;j<=cnt[i];++j)
		{
			if(i>1&&(i&1))//odd circle
				f[j]=(f[j-1]<<1)%MOD;//two ways
			else//even circle
				f[j]=f[j-1];//only one way
			if(j>1)f[j]=(f[j]+1ll*f[j-2]*(j-1)%MOD*i%MOD)%MOD;
			//merge two circle in the same length
		}
		ans=1ll*ans*f[cnt[i]]%MOD;
	}
	printf("%d\n",ans);
	return 0;
}



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

int main() {
  char s[200001], t[200001];
  scanf("%s %s", s, t);
  int l = strlen(s), a[26], b[26];
  for (int i=0; i<26; i++) {
    a[i] = -1;
    b[i] = -1;
  }
  for (int i=0; i<l; i++) {
    int cs = s[i]-'a';
    int ct = t[i]-'a';
    if (a[cs] == -1 && b[ct] == -1) {
      a[cs] = ct;
      b[ct]++;
    } else if (a[cs] != -1 && ct == a[cs]) continue;
    else {
      printf("No\n");
      return 0;
    }
  }
  printf("Yes\n");
  return 0;
}


Measured memory_bytes: 512
package main

import "fmt"

func f(a int) int {
	ans := 0
	switch a % 4 {
	case 0:
		ans = a
	case 1:
		ans = 1
	case 2:
		ans = a/4*4 + 3
	case 3:
		ans = 0
	}
	return ans
}

func main() {
	var a, b int
	fmt.Scan(&a, &b)

	if a == 0 {
		fmt.Println(f(b))
	} else {
		fmt.Println(f(b) ^ f(a-1))
	}
}


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

using ll = long long;
#define debug(x) cerr << #x << ": " << x << endl;
#define line() cerr << "---------------" << endl;

bool ans;
int a[10];

void dfs(int idx, int l, int r) {
   if (idx == 10) {
      ans = true;
      return;
   }

   int val = a[idx];
   if (l < val) dfs(idx+1, val, r);
   if (r < val) dfs(idx+1, l, val);
}

int main() {
   int N;
   cin >> N;
   while (N--) {
      for (int i = 0; i < 10; i++) cin >> a[i];
      ans = false;
      dfs(0, -1, -1);
      puts(ans ? "YES" : "NO");
   }

   return 0;
}


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

int score(const vector<int>& v, bool& ace){
	int s=0;
	bool flag = false;
	for(int i=0 ; i < v.size() ; i++ ){
		if( v[i] == 1 ) flag = true;
		s += v[i];
	}
	if( flag && s+10 <= 21 && s < s+10 ){
		s += 10;
		ace = true;
	}
	return s;
}

int main(){
	int h[256] = {0};
	h['A'] = 1; h['T'] = h['J'] = h['Q'] = h['K'] = 10;
	for(char c = '2' ; c <= '9' ; c++ ) h[c] = c - '0';
	
	int N;
	cin >> N;
	for(int t=0 ; t < N ; t++ ){
		vector<int> v;
		{
			char a, b;
			cin >> a >> b;
			v.push_back( h[a] );
			v.push_back( h[b] );
		}
		vector<int> a;
		for(int i=0 ; i < 8 ; i++ ){
			char e;
			cin >> e;
			a.push_back( h[e] );
		}
		int k=0, ans;
		while( true ){
			bool ace = false;
			int s = score(v,ace);
			if( s <= 16 || (s == 17 && ace) ){
				v.push_back( a[k++] );
			}else{
				ans = s;
				break;
			}
		}
		if( 21 < ans ){
			cout << "bust" << endl;
		}else if( ans == 21 && v.size() == 2 ){
			cout << "blackjack" << endl;
		}else{
			cout << ans << endl;
		}
	}
}

Measured memory_bytes: 1216
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
using ll=long long;
using vec=vector<ll>;
using Graph = vector<vector<ll>>;
#define loop(i,n) for(ll i=0;i<n;i++)
#define Loop(i, m, n) for(ll i = m;i < n;i++)
#define pool(i,n) for(ll i=n-1;i>=0;i--)
#define Pool(i, m, n) for(ll i=n-1;i>=m;i--)
#define MAX 99999999999ll
#define MIN -99999999999ll
#define setbit bitset<8>
#define flagcount __builtin_popcount
#define flag(x) (1<<x)
#define flagadd(bit,x) bit|=flag(x)
#define flagpop(bit,x) bit&=~flag(x) 
#define flagon(bit,i) bit&flag(i)
#define flagoff(bit,i) !(bit & (1<<i))
#define all(v) v.begin(),v.end()
#define low2way(v,x) lower_bound(all(v),x)
#define high2way(v,x) upper_bound(all(v),x)
#define count2way(v,x) high2way(v,x)-low2way(v,x)
#define lower(v,x) low2way(v,x)-v.begin() //1番左が0、もし見つから無いならｎを出力
#define higher(v,x) high2way(v,x)-v.begin()-1 //1番左が0、もし見つからないならn-1を出力（注意）
#define putout(a) cout<<a<<endl
#define putout2(a,b) putout(a);putout(b)
#define putout3(a,b,c) putout(a);putout(b);putout(c)
#define putout4(a,b,c,d) putout(a);putout(b);putout(c);putout(d)
#define putout5(a,b,c,d,e) putout(a);putout(b);putout(c);putout(d);putout(e)
#define Gput(a,b) G[a].push_back(b)
#define cin1(a) cin>>a
#define cin2(a,b) cin>>a>>b
#define cin3(a,b,c) cin>>a>>b>>c
#define cin4(a,b,c,d) cin>>a>>b>>c>>d
#define cin5(a,b,c,d,e) cin>>a>>b>>c>>d>>e
#define sum(v) accumulate(all(v), 0ll)
ll ctoi(char c){
	if(c>='0'&&c<='9'){
		return c-'0';
	}
	return 0;
}
int main() {
  ll n,k;
  cin>>n>>k;
  vec a(n);
  map<ll,ll> count;
  ll syurui=0;
  loop(i,n){
    cin>>a[i];
    if(count[a[i]]==0)syurui++;
    count[a[i]]++;
  }
  vec ans(syurui);
  ll j=0;
  loop(i,200001){
    if(count[i]!=0){
      ans[j]+=count[i];
      j++;
    }
  }
  sort(all(ans));
  ll ANS=0;
  loop(i,syurui-k){
    ANS+=ans[i];
  }
  putout(ANS);
}

Measured memory_bytes: 15872
#include<stdio.h>
int main(){
  int h,w;
  char s;
  s='#';

    while (1)
  {
    scanf("%d",&h);
    scanf("%d",&w);
    if(w == 0 && h == 0 )break;
    for (int i = 1; i <= h; i++)
    {
      for (int j = 1; j <= w; j++)
      {
        if( (i % 2 != 0 && j % 2 == 0) || (i % 2 == 0 && j % 2 != 0)) s = '.';
        else
        {
          s = '#';
        }
        
        printf("%c",s);
      }
      printf("\n");
    }
    printf("\n");
  }
  return 0;
}


Measured memory_bytes: 2040
N, M, X, Y = map(int, input().split())

x_L = list(map(int, input().split()))
y_L = list(map(int, input().split()))


ans = "War"
for i in range(X + 1, Y + 1):
    if i > max(x_L) and  i <=  min(y_L):
        ans = "No War"
        break

print(ans)

Measured memory_bytes: 3060
#include<iostream>
#include<iomanip>
#include<stack>
#include<queue>
#include<numeric>
#include<algorithm>
#include<string>
#include<map>
#include<bitset>
#include<set>
#include<cmath>
#define int long long
#define inf 1145141919ll
#define oku 1000000007ll
using namespace std;
int a,b,c,d,e,f,g;
int dx[]={0,-1,0,1,0};
struct A{
	A *e;
	int temp;

};
struct B{
	A *src;
	A *dst;
	int cost;
};
struct C{
	int u;
	int v;
	int len;
	C(int x,int y,int z):u(x),v(y),len(z){}
};
int i,j,k,n;
int p[2][5001];
signed main(){
	string s;
	cin>>s;
	for(auto &x:s)
		if(x==',')
			x=' ';
	cout<<s<<endl;
}

Measured memory_bytes: 256