akhauriyash/Code-Regression huggingface dataset:
def main():
    n,k = tuple([int(t)for t in input().split()])

    a = tuple([int(t)for t in input().split()])

        
    for i in range(k,n):
        if a[i]/a[i-k]>1:
            print("Yes")
        else:
            print("No")

if __name__ == "__main__":
    main()

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

int main()
{
	int m,f,r;
	
	while(1){
		
		cin >> m >> f >> r;
		
		if(m==-1&&f==-1&&r==-1)break;
		
		if(m==-1||f==-1)cout << 'F' << "\n";
		
		else if((m+f)>=80)cout << 'A' << "\n";
		
		else if((m+f)<80&&(m+f)>=65)cout << 'B' << "\n";
		
		else if((m+f)<65&&(m+f)>=50)cout << 'C' << "\n";
		
		else if((m+f)<50&&(m+f)>=30&&r>=50)cout << 'C' << "\n";
		
		else if((m+f)<50&&(m+f)>=30)cout << 'D' << "\n";
		
		else if((m+f)<30)cout << 'F' << "\n";
		
	}
		
return 0;
}

Measured memory_bytes: 3076
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <climits>
#include <cmath>
#include <vector>
#include <string>
#include <set>

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

using namespace std;

int N;
double p[3000];

int main()
{
    scanf("%d", &N);
    REP(i, N)
        scanf("%lf ", &p[i]);
    vector <vector <double>> dp(N+1, vector <double>(N+1, 0.0));
    dp[1][0] = 1.0 - p[0];
    dp[1][1] = p[0];
    FOR(i, 3, N+1) {
        if (i%2==0)
            continue;
        REP(j, N+1) {
            dp[i][j] = dp[i-2][j]*(1.0-p[i-1])*(1.0-p[i-2]);
            if (j >= 1)
                dp[i][j] += dp[i-2][j-1]*(p[i-1]*(1.0-p[i-2])+(1.0-p[i-1])*p[i-2]);
            if (j >= 2)
                dp[i][j] += dp[i-2][j-2]*p[i-1]*p[i-2];
        }
    }
    double ans = 0.0;
    FOR(i, N/2+1, N+1)
        ans += dp[N][i];
    printf("%.11f\n", ans);
    return 0;
}


Measured memory_bytes: 70656
#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <string>
#include <bitset>
#include <utility>
#include <numeric>
#include <queue>
#include <stack>
#include <iomanip>

using ll = long long;
using namespace std;

constexpr int MOD = 1e9 + 7;
constexpr ll MOD_LL = ll(1e9 + 7);

template<typename T>
T modpow(T a, T p, T mod) {
	T ret = 1;
	while( p ) {
		if( p & 1 ) {
			ret *= a;
			ret %= mod;
		}
		
		a *= a;
		a %= mod;
		p >>= 1;
	}
	
	return ret;
}

int main(void) {
	ll n;
	cin >> n;
	
	ll ans = modpow(10LL, n, MOD_LL);
	ans %= MOD_LL;
	ans -= modpow(9LL, n, MOD_LL);
	ans %= MOD_LL;
	ans -= modpow(9LL, n, MOD_LL);
	ans %= MOD_LL;
	ans += modpow(8LL, n, MOD_LL);
	ans %= MOD_LL;
	
	if( ans < 0 ) ans += MOD_LL;
	
	cout << ans << endl;
	
	return 0;
}


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

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

#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0, a1, a2, a3, a4, x, ...) x
#define debug_1(x1) cerr << #x1 << ": " << x1 << endl
#define debug_2(x1, x2) cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << endl
#define debug_3(x1, x2, x3) cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " << x3 << endl
#define debug_4(x1, x2, x3, x4) cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " << x3 << ", " #x4 << ": " << x4 << endl
#define debug_5(x1, x2, x3, x4, x5) cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " << x3 << ", " #x4 << ": " << x4 << ", " #x5 << ": " << x5 << endl
#define debug(...) CHOOSE((__VA_ARGS__, debug_5, debug_4, debug_3, debug_2, debug_1, ~)) (__VA_ARGS__)

using namespace std;
using ll = long long;
using P = pair<int, int>;

const int INF = 1e8;

void Main() {
  int N;
  cin >> N;
  vector<int> L(N);
  rep(i, N) cin >> L[i];
  sort(L.begin(), L.end());
  int s = 0;
  rep(i, N-1) s += L[i];
  if (L[N-1] < s) cout << "Yes" << endl;
  else cout << "No" << endl;
}

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


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

int main(){
 	int n,m;
	cin >>n >> m;
	vector<long> x(n);
	vector<long> y(m);
  	for(int i = 0; i < n; i++) {
		cin >> x[i];
	}
  	for(int i = 0; i < m; i++) {
		cin >> y[i];
	}
  	long t=0;
	long tmp=0;
	for(int i = 0; i *2< n-1;i++) {
		tmp += (n-1-2*i)*(x[n-1-i]-x[i]);
	}
  	tmp %= (long)1E9+7;
  	for(int j = 0; j*2 < m-1; j++) {
		t +=(m-1-2*j) * (y[m-1-j]-y[j]);
	}
  	t %= (long)1E9+7;
  	t *= tmp;
  
  	t %= (long)1E9+7;
  	cout << t << endl;
	
}


Measured memory_bytes: 1792
a = int(input())
x = list(map(int, input().split()))

def func(x):
  s = 0
  while(True):
    for (i, j) in enumerate(x):
      if j % 2 == 1:
        return s
      x[i] = j / 2
    s = s + 1

print(func(x))

Measured memory_bytes: 9152
#include<stdio.h>
int main(void)
{
	int N, L[10];
	int Max = 0;
	int sum = 0;
	scanf("%d", &N);
	for (int i = 0; i < N; i++) {
		scanf("%d", &L[i]);

		if (i == 0) {
			Max = L[0];
		}


		else if (L[i] > Max) {
			sum = sum + Max;
			Max = L[i];
		}
		else //if (L[i] <= L[i - 1]) {
			sum = sum + L[i];
		//}
	}

	if (Max < sum) {
		printf("Yes");
	}
	else
		printf("No");

	return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast", "unroll-loops")

#include <bits/stdc++.h>

using namespace std;

#define ll long long

int main() {
	int N; cin >> N;
	if (N % 10 == 2 || N % 10 == 4 || N % 10 == 5 || N % 10 == 7 || N % 10 == 9) {
		cout << "hon" << endl;
	}
	else if (N % 10 == 3) {
		cout << "bon" << endl;
	}
	else {
		cout << "pon" << endl;
	}
	return 0;
}

Measured memory_bytes: 3632
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <queue>
#include <map>

using namespace std;

#define F first
#define S second
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define INT(a) int((a)+1e-9)
#define SUPMaxX 22
#define SUPMaxY 22

typedef pair<int,int> Pii;

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

int maxX,maxY;
char tizu[SUPMaxX][SUPMaxY];
int re;
int initX,initY;

int dfs(int px, int py){
	re++;
	FOR(i,0,4){int qx=px+DX[i]; int qy=py+DY[i];
		if(tizu[qx][qy]=='.'){
			tizu[qx][qy]='@';
			dfs(qx,qy);
		}
	}
}

int main(){
	while(true){
		cin >> maxY >> maxX;			if(!maxX) return 0;
		FOR(x,0,maxX+2) FOR(y,0,maxY+2) tizu[x][y]='#';
		FOR(x,1,maxX+1) FOR(y,1,maxY+1){
			cin>>tizu[x][y];
			if(tizu[x][y]=='@'){initX=x; initY=y;}
		}
		re=0;
		dfs(initX,initY);
		cout<<re<<endl;
	}
}

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

//typedef
//------------------------------------------
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<LL, LL> PLL;

//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())

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

//MOD
//--------------------------------------------
#define MUL(a,b) (((a) % MOD) * ((b) % MOD)) % MOD

// grid
//--------------------------------------------
VL dx = {0, 1, 0, -1};
VL dy = {1, 0, -1, 0};
VL dx2 = {-1, 0, 1, -1, 1, -1, 0, 1};
VL dy2 = {-1, -1, -1, 0, 0, 1, 1, 1};

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

//main code

LL gcd(LL a,LL b) {
	LL bigger = max(a,b);
	LL smaller = min(a,b);
	if (smaller == 0) return bigger;
	if (smaller < 0) {
		cerr << "smaller of gcd is negative number" << endl;
		return 1;
	}
	if (bigger % smaller != 0) {
		return gcd(smaller,(bigger % smaller));
	}
	return smaller;
}

int main(int argc, char const* argv[])
{
	int n;
	cin >> n;
	VL a(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	VL rui_f(n+1,0);
	VL rui_b(n+1,0);
	for (int i = 0; i < n; i++) {
		rui_f[i+1] = gcd(a[i], rui_f[i]);
	}
	for (int i = n-1; i >= 0; i--) {
		rui_b[i] = gcd(a[i], rui_b[i+1]);
	}
	LL ans = 0;
	for (int i = 0; i < n; i++) {
		ans = max(ans, gcd(rui_f[i], rui_b[i+1]));
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 2560
#include<stdio.h>

#define INFTY 1000000000
#define N 500001

int sum=0;

void merge(int *A, int left, int mid,int right){
  int n1,n2,i,j,k,L[N],R[N];
  n1 = mid - left;
  n2 = right - mid;

  for( i = 0;i< n1;i++) L[i] = A[left + i];
  for (i = 0 ;i<n2;i++)R[i] = A[mid + i];
  L[n1] = INFTY;
  R[n2] = INFTY;
  i = 0;
  j = 0;
  for (k = left;k< right; k++){
    if (L[i] <= R[j]){
      A[k] = L[i];
      i = i + 1;
    } 
    else {
      A[k] = R[j];
      j = j + 1;
    }
  }
  sum=sum+i+j;
}

void mergeSort(int *A,int left,int right){
  int mid;
  if (left+1 < right){
    mid = (left + right)/2;
    mergeSort(A, left, mid);
    mergeSort(A, mid, right);
    merge(A, left, mid, right);
  }
}

int main(){
  int n,i,A[N];

  
  scanf("%d",&n);
  for(i=0;i<n;i++) scanf("%d",&A[i]);
  mergeSort(A,0,n);

  for(i=0;i<n-1;i++) printf("%d ",A[i]);
  
  printf("%d\n",A[n-1]);
  printf("%d\n",sum);
  return 0;
}

Measured memory_bytes: 5488
use std::cmp::*;
use std::io::*;

fn main() {
    let mut s: String = String::new();
    stdin().read_to_string(&mut s).ok();
    let mut itr = s.trim().split_whitespace();
    let n: usize = itr.next().unwrap().parse().unwrap();
    let mut out = Vec::new();

    let mut m = 0;
    for i in 1..n + 1 {
        for j in i + 1..n + 1 {
            if j != n + (n % 2 == 0) as usize - i {
                m += 1;
                writeln!(out, "{} {}", i, j).ok();
            }
        }
    }
    println!("{}", m);
    stdout().write_all(&out).unwrap();
}


Measured memory_bytes: 4352
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

def main():
    N = int(readline())

    K = 0
    for i in range(1,450):
        if i * (i-1) // 2 == N:
            K = i
            break

    if K == 0:
        print("No")
        exit()
    
    S = [[] for _ in range(K)]

    i = 1
    k = 0
    cnt = 0
    while i <= N:
        S[k].append(i)
        i += 1
        cnt += 1
        if cnt == K - (k+1):
            k += 1
            cnt = 0

    j = 1
    k = 1
    cnt = 0
    col = 0
    while j <= N:
        S[k].append(j)
        j += 1
        k += 1
        cnt += 1
        if cnt == K - (col+1):
            col += 1
            k = col + 1
            cnt = 0

    print("Yes")
    print(K)

    for s in S:
        print(K - 1, *s)

    
if __name__ == "__main__":
    main()


Measured memory_bytes: 12588
#include<iostream>
#include<string>
#include<algorithm>
#include<queue>
#include<vector>
#include<cmath>

using namespace std;

#define rep(i, n) for(long int i = 0; i < n; i++)
#define P pair<long int, long int>

int main(){
    long int n;
    cin >> n;
    long int a[n], b[n];
    rep(i, n) cin >> a[i];
    rep(i, n) cin >> b[i];
    long int num[29];
    fill(num, num + 29, 0);
    sort(b, b + n);
    rep(i, 29){
        long int t = 1 << i;
        // cout << "t = " << t << endl;
        long int amod[n], bmod[n];
        rep(j, n) {
            amod[j] = a[j] % (t * 2);
            bmod[j] = b[j] % (t * 2);
        }

        sort(bmod, bmod + n);

        rep(j, n){
            // cout << amod[j] << " " << bmod[j] << endl;
            num[i] += lower_bound(bmod, bmod + n, 2 * t - amod[j]) - lower_bound(bmod, bmod + n, t - amod[j]);
            num[i] += lower_bound(bmod, bmod + n, 4 * t - amod[j]) - lower_bound(bmod, bmod + n, 3 * t - amod[j]);
        }
        // cout << num[i] << endl;
    }
    // rep(i, 30) cout << num[i] << " ";
    // cout << endl;
    long int ans = 0;
    for (long int i = 28; i >= 0; i--){
        ans <<= 1;
        if (num[i] % 2 == 1){
            ans += 1;
        }  
        // cout << ans << endl; 
    }
    cout << ans << endl;
}

Measured memory_bytes: 6528
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 c = sc.nextInt();
		if (a != b) {
			System.out.println("No");
		} else if (a != c) {
			System.out.println("No");
		} else {
			System.out.println("Yes");
		}
		sc.close();
	}
}

Measured memory_bytes: 22740
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//cout << fixed << setprecision(15);
vector<int> forintinput(int n) {
	vector<int> x;
	for(int i = 0;i < n;i++){
		int ia;
		cin >> ia;
		x.push_back(ia);
	}
	return x;
}
int main(){
	int a,b,c;
	cin >> a >> b >> c;
	
	cout << a*b/2 << endl;
}

Measured memory_bytes: 3588
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		dPA();

	}

	private static void dPA() {
		Scanner scanner = null;
		int numDay = 0;

		try {
			scanner = new Scanner(System.in);
			numDay = scanner.nextInt();
			int[][] dayArray = new int[numDay][3];
			int[][] koufukuArray = new int[numDay][3];

			for (int i = 0; i < numDay; i++) {
				dayArray[i][0] = scanner.nextInt();
				dayArray[i][1] = scanner.nextInt();
				dayArray[i][2] = scanner.nextInt();
			}

			koufukuArray[0][0] = dayArray[0][0];
			koufukuArray[0][1] = dayArray[0][1];
			koufukuArray[0][2] = dayArray[0][2];
			for (int i = 1; i < dayArray.length; i++) {
				Arrays.fill(koufukuArray[i], Integer.MIN_VALUE);
				for (int j = 0; j < 3; j++) {
					for (int k = 0; k < 3; k++) {
						if (j == k) {
							continue;
						}
						koufukuArray[i][j] = Math.max(dayArray[i][j] + koufukuArray[i - 1][k], koufukuArray[i][j]);
					}
				}
			}

			int koufuku = 0;
			for (int i = 0; i < 3; i++) {
				koufuku = Math.max(koufukuArray[koufukuArray.length - 1][i], koufuku);
			}

			System.out.println(koufuku);
		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}
}

Measured memory_bytes: 100580
#include <iostream>
using namespace std;
 
long a[100010];
int main()
{
    long n, k; cin>>n>>k;
    for(int i=0; i<n; ++i) cin>>a[i];
    long x=0;
    for(int i=62; i>=0; --i) {
        int c=0;
        for(int j=0; j<n; ++j) c+=(a[j]>>i)&1;
        if (2*c<n && (x|(1L<<i))<=k) x|=1L<<i;
    }
    long res=0;
    for(int i=0; i<n; ++i) res+=x^a[i];
    cout<<res<<endl;
}

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

#define rep(a,b) for(int a = 0;a < b;a++)
#define REP(i, x, n) for(int i = x; i < n; i++)
#define P(a) cout << a << endl
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
#define ssort(v) sort(v.begin(),v.end())
#define rev(v) reverse(v.begin(),v.end())
#define vP(v) for(int i = 0;i < v.size();i++){cout << v[i];if(i != v.size()-1)cout << endl;}
#define vcin(v,n) rep(i,n){int a;cin >> a;v.pb(a);}

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
int dx[] = { 1, -1 , 0 , 0 };
int dy[] = { 0,  0,  1, -1 };
ll MOD = 1000000007;

void solve(){
	string a,b,c;
	cin >> a >> b >> c;
	cout << (char)((int(a[0]-32))) << (char)((int(b[0]-32))) << (char)((int(c[0]-32))) << endl;
}

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


Measured memory_bytes: 256
/*
auhtor:hbohra98
chandigarh univeristy
*/
#include<bits/stdc++.h>
#define ll long long int
#define pb push_back
#define VP vector < pair < ll , ll > >
#define VI vector< ll >
#define VS vector< string >
#define mk make_pair

template<typename T, typename U> inline void smin(T &a, U b) {if(a>b) a=b;}
template<typename T, typename U> inline void smax(T &a, U b) {if(a<b) a=b;}

using namespace std;
int main(){

    ll n;cin>>n;
    VI a;ll count=0;
    for(ll i=0;i<n;i++){ll io;cin>>io;a.pb(io);}
    for(ll i=1;i<n-1;i++){
        if(min({a[i-1],a[i],a[i+1]})!=a[i] && max({a[i-1],a[i],a[i+1]})!=a[i])
            count++;
    } 
    cout<<count;


} 


Measured memory_bytes: 256
function Main(input){
    limit=input.split("\n");
    eachlimit=limit[0].split(" ");
    N=Number(eachlimit[0]);
    T=Number(eachlimit[1]);
    var ans=1001;
    for(i=1;i<=N;i++){
        info=limit[i].split(" ");
        if(T>=info[1]){
            c=Number(info[0]);
            ans=Math.min(ans,c);
        }
    }
    if(ans==1001){
        console.log('TLE');
    } else{
        console.log(ans);
    }
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

int main(void){

    int N, M;

    scanf("%d%d", &N, &M);

    int d[N+1][N+1];

    for(int i = 1; i <= N; i++){
        for(int j = 1; j <= N; j++){
            if(i == j){
                d[i][j] = 0;
            }else{
                d[i][j] = 1000000000;
            }
        }
    }

    int a[M], b[M];

    for(int i = 0; i < M; i++){
        scanf("%d%d", &a[i], &b[i]);
        d[a[i]][b[i]] = 1;
        d[b[i]][a[i]] = 1;
    }

    int ans = 0;

    int e[N+1][N+1];

    for(int l = 0; l < M; l++){
        for(int i = 1; i <= N; i++){
            for(int j = 1; j <= N; j++){
                e[i][j] = d[i][j];
            }
        }
        e[a[l]][b[l]] = 1000000000;
        e[b[l]][a[l]] = 1000000000;
        for(int k = 1; k <= N; k++){
            for(int i = 1; i <= N; i++){
                for(int j = 1; j <= N; j++){
                    if(e[i][j] > e[i][k] + e[k][j]){
                        e[i][j] = e[i][k] + e[k][j];
                    }
                }
            }
        }
        int f = 0;
        for(int i = 1; i <= N; i++){
            if(f == 1){
                break;
            }
            for(int j = 1; j <= N; j++){
                if(e[i][j] == 1000000000){
                    f = 1;
                    break;
                }
            }
        }
        if(f == 1){
            ans++;
        }
    }

    printf("%d\n", ans);

    return 0;
}

Measured memory_bytes: 1744
#include<iostream>
using namespace std;
int main(){
  string s;
  int k,i=1;
  char out;
  cin >> s >> k;
  if(s[0] != '1'){
    out = s[0];
  }else{
    while(s[i] == '1'){
      i++;
    }
    if(k<=i){
      out = '1';
    }else{
      out = s[i];
    }
  }
    cout << out << endl;
    return 0;
  }

Measured memory_bytes: 256
/*
      author : nishi5451
      created: 11.08.2020 23:31:38
*/

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

ll GCD(ll x,ll y){
    if(x%y == 0) return y;
    else return GCD(y, x%y);
}

int main(){
    ll x,y;
    cin >> x >> y;
    if(x%y==0) {
        cout << -1 << endl;
        return 0;
    }
    cout << x << endl;

    return 0;
}

Measured memory_bytes: 3628
#include <iostream>
#include <cstdio>
#include <string>
#include <cmath>
#include <cctype>
#include <cstdlib>
#include <stack>
#include <queue>
#include <vector>
#include <algorithm>
#include <list>
#include <map>
#include <set>
using namespace std;

string anagramize(string s) {
	vector<char> v;
	for (int i = 0; i < 10; i++) {
		v.push_back(s[i]);
	}
	sort(v.begin(), v.end());
	for (int i = 0; i < 10;i++) {
		s[i] = v[i];
	}
	return s;
}
int main() {
	int n; long long ans = 0;
	cin >> n;
	map<string, int> m;
	string s;
	for (int i = 0; i < n; i++) {
		cin >> s;
		m[anagramize(s)]++;	
	}
	for (map<string, int>::iterator it = m.begin();it != m.end();it++) {
		long long  k = it->second;
		ans += k * (k - 1) / 2;
	}
	cout << ans << endl;
}
        

Measured memory_bytes: 11136
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(),v.end()
#define puts(i) cout << i << endl
#define INF INT_MAX
#define INFL LLONG_MAX
typedef long long ll;
using namespace std;


int main(){
  ll n,a,b,c,d;
  cin >> n >> a >> b >> c >> d;

  string s,res;
  cin >> s;

  ll m=max(c,d);

  int x=0;
  for(ll i=a;i<m;i++){
    if(s.at(i)=='#' && x){
      res="No";
      cout << res << endl;
      return 0;
    }

    if(s.at(i)=='#'){
      x=1;
    }
    else{
      x=0;
    }
  }

if(c<d){
  res="Yes";
  cout << res << endl;
}

else{
  for(ll i=b-1;i<d;i++){
    if(s.at(i-1)=='.' &&
       s.at(i)=='.' &&
       s.at(i+1)=='.'){
           res="Yes";
           cout << res << endl;
           return 0;
         }
   }

  res="No";
  cout << res << endl;
}


return 0;

  }

Measured memory_bytes: 3736
//#pragma comment(linker, "/stack:200000000")
#ifndef LOCAL
#pragma GCC optimize("O3")
#endif
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

 
using namespace __gnu_pbds;
using namespace std;
 
template <typename T>
using ordered_set =
	tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
 
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
	*this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

#define pb push_back
#define mp make_pair
#define st first
#define nd second
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define un(x) x.erase(unique(ALL(x)),x.end())
#define REP(i,x,v)for(int i=x;i<=v;i++)
#define REPD(i,x,v)for(int i=x;i>=v;i--)
#define FOR(i,v)for(int i=0;i<v;i++)
 
using ll=long long;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using vi=vector<int>;
using vll=vector<ll>;
const int MOD=1e9+7;//998244353;
int p[1<<20];
ll s[1<<20];

	
int main()
{
	ios_base::sync_with_stdio(0);cin.tie(0);
	cout << fixed << setprecision(11);
	cerr << fixed << setprecision(6);
	int n,k;cin>>n>>k;
	FOR(i,n) {cin>>p[i];s[i+1]=s[i]+p[i]+1;}
	ll mx=0;
	REP(j,k,n) {mx=max(mx,s[j]-s[j-k]);}
	cout<<mx*1.0/2<<endl;
		


    return 0;
}










Measured memory_bytes: 3840
import java.util.Arrays;
import java.util.Scanner;

public class Main {
  Scanner sc;

  int ex(int src, int ratio) {
    return (src * (100 + ratio))/100;
  }

  void run() {
    for (; ; ) {
      int x = ni();
      int y = ni();
      int s = ni();

      if ( (x | y | s) == 0 ) {
        break;
      }

      int max = 0;
      for ( int i = 1; i < s; ++i ) {
        for ( int j = 1; j < s; ++j ) {
          int a = ex(i, x);
          int b = ex(j, x);

          if(a+b == s) {
            max = Math.max(max, ex(i, y) + ex(j, y));
          }
        }
      }

      System.out.println(max);
    }
  }

  Main() {
    sc = new Scanner(System.in);
  }

  int ni() {
    return sc.nextInt();
  }

  public static void main(String[] args) {
    new Main().run();
  }

  void debug(Object... os) {
    System.err.println(Arrays.deepToString(os));
  }
}

Measured memory_bytes: 21056
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
 
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
 
template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;
 
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
 
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy
 
ll modExp(ll base, ll power) {
    if (power == 0) {
        return 1;
    } else {
        ll cur = modExp(base, power / 2); cur = cur * cur; cur = cur % MOD;
        if (power % 2 == 1) cur = cur * base;
        cur = cur % MOD;
        return cur;
    }
}

ll inv(ll base) {
    int g = MOD, r = base, x = 0, y = 1;
    while (r != 0) {
        int q = g / r;
        g %= r; swap(g, r);
        x -= q * y; swap(x, y);
    }
    return x < 0 ? x+MOD : x;
}

ll mul(ll A, ll B) {
	return (A*B)%MOD;
}

ll add(ll A, ll B) {
	return (A+B)%MOD;
}

ll dvd(ll A, ll B) {
    return mul(A, inv(B));
}

ll sub(ll A, ll B) {
    return (A-B+MOD)%MOD;
}


ll* facs = new ll[MX];
ll* facInvs = new ll[MX];

ll choose(ll a, ll b) {
	if (b > a) return 0;
	if (a < 0) return 0;
	if (b < 0) return 0;
    ll cur = facs[a];
    cur = mul(cur, facInvs[b]);
    cur = mul(cur, facInvs[a-b]);
    return cur;
}

void initFacs() {
	facs[0] = 1;
	facInvs[0] = 1;
	FOR(i, 1, MX) {
		facs[i] = (facs[i-1] * i) % MOD;
		facInvs[i] = inv(facs[i]);
	}
}

ll solve(string N, int K) {
    if (K == 0) return 1;
    if (sz(N) == 0) return 0;
    if (N[0] == '0') {
        string n; FOR(i, 1, sz(N)) n += N[i];
        return solve(n, K);
    }

    //case 1: choose 3 non-F
    ll ans = 0;

    if (sz(N) > K) {
        ans += choose(sz(N)-1, K) * modExp(9, K);
    }
    
    //case 2: choose lower

    if (N[0] != '1' && sz(N) > K-1) {
        ans += (N[0] - '1') * choose(sz(N)-1, K-1) * modExp(9, K-1);
    }

    //case 3: choose same

    string n; FOR(i, 1, sz(N)) n += N[i];
    ans += solve(n, K-1);


    return ans;


}

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);    
    initFacs();
    string N; int K; cin >> N >> K;
    cout << solve(N, K) << endl;
	
	return 0;
}
 
// read the question correctly (ll vs int)
// template by bqi343



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

using namespace std;

int main(void)
{
    int N;
    cin >> N;

    long long sum = 1;
    int flag = 0;

    vector<long long> A(N);
    for(int i = 0;i < N; i++) {
        cin >> A[i];
        if (A[i] == 0) {
            cout << 0 << endl;
            return 0;
        }
        if (sum > 1000000000000000000/A[i]) {
            flag = 1;
        }
        sum = sum * A[i];
    }
    if (flag == 1) {
        cout << -1 << endl;
        return 0;
    }

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

Measured memory_bytes: 4028
def divisor(num)
  result = []
  i = 1
  while i <= num do
    remainder = num % i
    if remainder == 0
      result << i
    end 
    i += 1
  end
  return result
end

n = gets.to_i

ans = 0
(1..n).each do |k|
    next if k.even?
    ans += 1 if 8 == divisor(k).length
end

puts ans

Measured memory_bytes: 1788
#include <iostream>
#include <iomanip>
using namespace std;
int main(void){
    int a,b,d,r;
    double f;
    cin >> a >> b;
    d=a/b;
    r=a%b;
    f=(1.0*a)/b;
    cout << fixed << setprecision(7);
    cout << d << " " << r << " " << f << endl; 
}



Measured memory_bytes: 3276
#include<iostream>
#include<string>
using namespace std;
int main(){
    int y,m,d,ny;
	string a;
	while(cin>>y>>m>>d){
		a="pre-meiji";
		ny=y+1;
		if(y>1868||y==1868&&m>9||y==1868&&m==9&&d>=8){
			ny-=1868;
			a="meiji ";
		}
		if(y>1912||y==1912&&m>7||y==1912&&m==7&&d>=30){
			ny-=44;
			a="taisho ";
		}
		if(y>1926||y==1926&&m>12||y==1926&&m==12&&d>=25){
			ny-=14;
			a="showa ";
		}
		if(y>1989||y==1989&&m>1||y==1989&&m==1&&d>=8){
			ny-=63;
			a="heisei ";
		}
		cout<<a;
		if(a!="pre-meiji")
		    cout<<ny<<" "<<m<<" "<<d;
		cout<<endl;
	}
    return 0;
}
 

Measured memory_bytes: 1204
import numpy as np

balance_num = int(input())
Weight=[int(x) for x in input().split()]
min_abs=np.inf

for num in range(balance_num):
    absolute=abs(sum(Weight[:num])-sum(Weight[num:]))
    if min_abs>absolute:
        min_abs=absolute
        
print("{}".format(min_abs))

Measured memory_bytes: 21476
#include <iostream>
#include <vector>
#include<iomanip>
#define ll long long;
using namespace std;
vector<long double> heads;
vector<vector<long double>> dp;
int N;
long double res = 0;
int count = 0;
// double solve(int pos = 0, int tailsCount = 0, bool isHead = true,long double prob = 1)
// {
//     count++;
//     if (pos == N){
//         // cout<<prob<<" ";

//         res += prob;
//         return prob;
//     }
//     long double headProb = heads[pos];
//     long double tailProb = 1 - heads[pos];
//     solve(pos + 1, tailsCount, true,headProb * prob);
//     if(tailsCount + 1 <= N/2)
//         solve(pos + 1, tailsCount + 1, false,tailProb * prob);
//     return prob;
// }

double solve(){
    dp[0][0] = 1;
    for(int i = 1; i <= N; i++){
        for(int j = 0; j <= i;j++){
            if(j == 0){
                dp[i][j] = (1-heads[i-1]) * dp[i-1][j];
            }
            // else if(i == j){
            //     dp[i][j] = heads[i-1];
            // }
          else{
                dp[i][j] = (((1-heads[i-1]) * dp[i-1][j]) + (heads[i-1] * dp[i-1][j-1]));
            }

        }
    }
    //  for(int i = 0; i <= N; i++){
    //     for(int j = 0; j <= N;j++){
    //         cout<<dp[i][j]<<"\t";
    //     }
    //     cout<<endl;
    // }
    double ans = 0;
    for(int k = N; k > N/2;k--){
        ans += dp[N][k]; 
    }
    return ans;
}

int main()
{
    cin >> N;
    heads = vector<long double>(N);
    dp = vector<vector<long double>>(N+1,vector<long double>(N+1,0));
    for (int i = 0; i <= N; i++)
    {
        cin >> heads[i];
    }
    cout<<setprecision(10)<<solve() ;
    //cout<<setprecision(10)<<res<<" "<<count;
}

Measured memory_bytes: 144236
//Author rahuliitkgp

/*A thing of beauty is a joy forever,
Its loveliness increases,
it will never pass into nothingness.*/
//Men at Work :)

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef long long int ll;

#define setbits(x)      __builtin_popcountll(x)
#define mod             1000000007
#define ps(x,y)         fixed<<setprecision(y)<<x
#define w(x)            int x; cin>>x; while(x--)
#define INF (int)1e9 + (int)1e8
mt19937_64 mt(chrono::steady_clock::now().time_since_epoch().count());

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

void cpp() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
}

int main(){
    cpp();
    ll n, w;
    cin>>n>>w;
    vector<pair<ll, ll> > v(n);
    for(ll i=0; i<n; i++){
        cin>>v[i].first>>v[i].second;
    }
    vector<vector<ll> > dp(n+1, vector<ll>(w+1));
    for(ll i=1; i<=n; i++){
        for(ll j=1; j<=w; j++){
            dp[i][j] = dp[i-1][j];
            if(j>=v[i-1].first){
                dp[i][j] = max(dp[i][j], dp[i-1][j-v[i-1].first]+v[i-1].second);
            }
        }
    }
    cout<<dp[n][w]<<endl;
    return 0;
}






Measured memory_bytes: 83144
#include <iostream>
using namespace std;
#define MAX 500000
#define SENTINEL 2000000000

int L[MAX/2 + 2], R[MAX/2 + 2];
int cnt;

void merge(int A[], int left, int mid, int right)
{
    int n1 = mid - left;
    int n2 = right - mid;
    for (int i = 0; i < n1; i++) L[i] = A[left + i];
    for (int i = 0; i < n2; i++) R[i] = A[mid + i];
    L[n1] = R[n2] = SENTINEL;
    int i = 0, j = 0;
    for (int k = left; k < right; k++) {
        cnt++;
        if (L[i] <= R[j]) {
            A[k] = L[i++];
        } else {
            A[k] = R[j++];
        }
    }
}

void merge_sort(int A[], int left, int right)
{
    if (left + 1 < right) {
        int mid = (left + right) / 2;
        merge_sort(A, left, mid);
        merge_sort(A, mid, right);
        merge(A, left, mid, right);
    }
}

int main(int argc, char const *argv[])
{
    cnt = 0;
    int n, A[MAX];
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> A[i];
    }
    
    merge_sort(A, 0, n);

    for (int i = 0; i < n; i++) {
        if (i) cout << " ";
        cout << A[i];
    }
    cout << endl;

    cout << cnt << endl;;

    return 0;
}




Measured memory_bytes: 6884
import { readFileSync } from "fs";

const main = (input: string[][]) => {
  const A = BigInt(input[0][0]);
  const B = BigInt(Math.round(Number(input[0][1]) * 100));

  const prod = (A * B) / 100n;

  return prod.toString();
};

const read = () =>
  readFileSync(0, "utf8")
    .split("\n")
    .map((line) => line.split(" "));

console.log(main(read()));


Measured memory_bytes: 29548
# 2019-11-25 06:26:24(JST)
import sys

def main():
    s, k = sys.stdin.read().split()
    k = int(k)

    if len(s) == 1:
        print(k // 2)
        sys.exit()
    
    if s.count(s[0]) == len(s):
        if len(s) % 2 == 0:
            ans = len(s) // 2 * k
        else:
            if k % 2 == 0:
                ans = len(s) * (k // 2)
            else:
                ans = len(s) * (k // 2) + len(s) // 2
        print(ans)
        sys.exit()

    count = 0
    same = 1
    flag = False
    for i in range(len(s)-1):
        if s[i] == s[i+1]:
            same += 1
        else:
            if not flag: 
                first_same = same
                flag = True 
                # 最初に何文字連続するかだけ記録しておく
            count += same // 2
            same = 1
    
    bl = False
    if s[-1] == s[0]:
        if same % 2 == 1 and first_same % 2 == 1:
            # ここでのsameは一番最後に連続した文字数
            count += same // 2 + 1
            # この場合は最後だけ調整が必要なので記録しておく
            bl = True
        else:
            count += same // 2
    else:
        count += same // 2

    ans = count * k
    if bl:
        ans -= 1

    print(ans)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
n = int(input())
counts = [[[0 for i in range(10)]for j in range(3)]for k in range(4)]
for i in range(n):
    b,f,r,v = map(int,input().split())
    counts[b-1][f-1][r-1] += v
        
for k in range(4):
    for j in range(3):
        for i in range(10):
            print("",counts[k][j][i],end="")
        print("\n",end="")
    if k != 3:
        print("#"*20)


Measured memory_bytes: 5640
#include<iostream>
using namespace std;
int main()
{
    int A,B,C;
    cin>>A>>B>>C;
    if(A==5&&B==5&&C==7)
    {
        cout<<"YES";
    }
    else if(A==5&&B==7&&C==5)
    {
        cout<<"YES";
    }
    else if(A==7&&B==5&&C==5)
    {
        cout<<"YES";
    }
    else
    {
        cout<<"NO";
    }
}


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

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



Measured memory_bytes: 3148
#include <stdio.h>

int main(){
  
  int i, j, k,n,m,l;
  
  scanf ("%d%d%d",&n,&m,&l);
    
  int a[n][m], b[m][l];
  long c[n][l];
  
  for (i = 0;i < n;i++){
    for (j = 0;j < m;j++){
      scanf ("%d",&a[i][j]);	
    }
  }
  
  for (i = 0;i < m;i++){
    for (j = 0;j < l;j++){
      scanf ("%d",&b[i][j]);
    }
  }
  
  
  for(i = 0;i < n;i++){
    for(j = 0;j < l;j++){
      
      c[i][j] = 0;
      
      for (k = 0;k < m;k++){
	c[i][j] += a[i][k] * b[k][j];
      }
    }
  }
  
  for(i = 0;i < n;i++){
    for(j = 0;j < l-1;j++){
      printf("%ld ",c[i][j]);
    }
    printf ("%ld\n",c[i][j]);
  }
  
  return 0;
}



Measured memory_bytes: 2104
#include "bits/stdc++.h"
using namespace std;
const int MOD = 1e9 + 7;
typedef long long lint;
typedef pair<int,int> P;
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define rep(i, n) for (lint i = 0; i < (n); i++)
#define INF LLONG_MAX
#define all(x) (x).begin(),(x).end()
#define pb push_back
int main(){
    int n;
    cin>>n;
    int res=0;
    rep(i,n){
        int a,b;
        cin>>a>>b;
        res+=b-a+1;
    }
    cout<<res<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
 
int main(){
    int n,i,j,k;
    cin>>n;
    long long A,B,C=0;
    cin>>A>>B;
    for(i=3;i<=n;i++){
        long long t;
        cin>>t;
        C^=t;
    }
    long long D=A+B-C>>1;
    if(A+B-C & 1 || D<0 || D>A || D&C){
        cout<<"-1\n";
        return 0;
    }
    long long a=D;
    for(i=60;i>=0;i--){
        if(C>>i & 1 && D>>i&1^1&&(a|1ll<<i)<=A){
            a|=1ll<<i;
        }
    }
    if(a==0){
        cout<<"-1\n";
        return 0;
    }
    cout<<A-a<<endl;
 
    return 0;
}

Measured memory_bytes: 3616
#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;
 
int main() {
  int Tc; cin >> Tc;
  int H, M;
   
  while(Tc --) {
    scanf("%d:%d", &H, &M);
     
    double h = H*30.0 + M/2.0, m = M*6;
     
    int ang = abs(h - m);
    if(ang > 180) ang = 360 - ang;
    if(0 <= ang && ang < 30) {
      cout << "alert" << endl;
    }
    else if(90 <= ang && ang <= 180) {
      cout << "safe" << endl;
    }
    else cout << "warning" << endl;
  }
   
  return 0;
}

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

using namespace std; 

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
typedef long long LL;
typedef priority_queue<int> PQ_DESC;
typedef priority_queue<int, vector<int>, greater<int>> PQ_ASC;
typedef priority_queue<PII> PQ_DESC_PII;
typedef priority_queue<PII, vector<PII>, greater<PII>> PQ_ASC_PII;

#define ALL(c) (c).begin(),(c).end()
#define PB push_back
#define MP make_pair
#define SORT_ASC(c) sort(ALL(c))
#define SORT_DESC(c) sort(ALL(c), greater<typeof(*((c).begin()))>())
#define SIZE(a) int((a).size())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ROF(i,a,b) for(int i=(b-1);i>=(a);--i)
#define REP(i,n) FOR(i,0,n)
#define PER(i,n) ROF(i,0,n)

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int LARGE_INT = 1e9+100;
const int INF = 2e9+100;
const LL INF_LL = (LL)INF * 300 * 300;
const int MOD = 2019;

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

LL modpow(LL a, LL n) {
    LL res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}


void Main()
{
    string s;cin>>s;
    int n = SIZE(s);
    reverse(ALL(s));

    REP(i,n){
        s[i] -= '0';
    }

    vector<LL> a(n);
    a[0] = s[0];
    FOR(i,1,n){
        a[i] = (a[i-1] + modpow(10,i)*s[i])%MOD;
        //dump(s[i]+'0')
    }

    VI c(MOD+1);
    c[0]++;
    REP(i,n){
        c[a[i]]++;
        //dump(a[i])
    }
    
    LL result=0;

    REP(i,MOD+1){
        result += c[i]*(c[i]-1)/2;
    }

    cout<<result<<endl;



	return;
}

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

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

#define ll long long
#define mod 1000000007

int main(){
	int n,open=0;
	string s;
	cin>>n>>s;
	ll res=1,fac=1;
	for(int i=2;i<=n;i++){
		fac*=i;
		fac%=mod;
	}
	for(int i=0;i<2*n;i++){
		if(open==0){
			open++;
			if(s[i]=='W'){
				res=0;
				break;
			}
		}
		else{
			if(s[i]=='W'){
				if(open&1){
					open++;
				}
				else{
					res*=open;
					res%=mod;
					open--;
				}
			}
			else{
				if(open&1){
					res*=open;
					res%=mod;
					open--;
				}
				else{
					open++;
				}
			}
		}
	}
	if(open!=0) res=0;
	res*=fac;
	res%=mod;
	cout<<res<<"\n";
	return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<string>
using namespace std;
int n;
int main(){
    string str1,str2;
    while(cin >> n){
        cin >> str1 >> str2;
        if(str1 == str2) cout << n << endl;
        else{
            int cnt = 0;
            for(int i = 0;i < n;++i){
                int flag = 1;
                if(str1[i] == str2[0]){
                    for(int j = 0;i+j < n;++j){
                        if(str1[j+i] != str2[j]){
                            flag = 0;
                            break;
                        }
                    }
                }
                else flag = 0;
                if(flag == 1){
                    cnt = n-i;
                    break;
                }
            }
            cout << 2*n - cnt << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

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

		int aa = a + b;
		int ab = a - b;
		int ac = a * b;

		int max = aa;
		if(max < ab) max = ab;
		if(max < ac) max = ac;
		System.out.println(max);


	}

}


Measured memory_bytes: 23764
#include <iostream>

using namespace std;

int main(){
	string s;
	string v;
	int count = 0;
	cin >> s >> v;
	for(int i = 0; i < s.length(); i++){
		if (s[i] != v[i]){
			count++;
		}
	}	
	cout << count << endl;
	return 0;
}


Measured memory_bytes: 3924
import math
from functools import reduce
K=int(input())
a=0
def gcd(*numbers):
    return reduce(math.gcd,numbers)
#def gcd_list(numbers):
 #   return reduce(math.gcd,numbers)
for i in range(1,K+1):
    for j in range(1,K+1):
        for k in range(1,K+1):
            a+=gcd(i,j,k)
print(a)

Measured memory_bytes: 69884
using System;
using System.Linq;
using System.Collections.Generic;
using System.Collections;
public class Program {
  public static void Main() {
    int[] ABC = ReadIntArray();
    int A = ABC[0], B = ABC[1], C = ABC[2];
    if (B / A > C) {
      Console.WriteLine(C);
    } else {
      Console.WriteLine((int)B/A);
    }
  }

  private static string ReadStr() { return Console.ReadLine(); }
  private static int ReadInt() { return int.Parse(Console.ReadLine()); }
  private static double ReadDouble() { return double.Parse(Console.ReadLine()); }
  private static long ReadLong() { return long.Parse(Console.ReadLine()); }
  private static char ReadChar() { return Console.ReadLine()[0]; }
  private static string[] ReadStringArray() { return Console.ReadLine().Split(' '); }
  private static int[] ReadIntArray() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
  private static double[] ReadDoubleArray() { return Console.ReadLine().Split(' ').Select(double.Parse).ToArray(); }
  private static long[] ReadLongArray() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
  private static char[] ReadCharArray() { return Console.ReadLine().ToArray(); }
  private static string[] ReadCharStringArray() { return Console.ReadLine().ToCharArray().Select(c => c.ToString()).ToArray(); }
}


Measured memory_bytes: 13396
program abc149_c
    implicit none
    integer(4) :: X, i
    read(*, *) X

    do i = X, 100003
        if( isPrime(i) .eqv. .true. ) then
            print *, i
            exit
        endif
    enddo


contains
    logical function isPrime(x) result(res)
        implicit none
        integer(4), intent(in) :: x
        integer(4) :: i, sqrtNum

        if( x < 2 ) then
            res = .false.
            return
        else if( x == 2 ) then
            res = .true.
            return
        else if( mod(x, 2) == 0 ) then
            res = .false.
            return
        endif

        sqrtNum = nint(SQRT(real(x))) + 1
        do i = 3, sqrtNum, 2
            if( mod(x, i) == 0 ) then
                res = .false.
                return
            endif
        enddo
 
        res = .true.
    end function isPrime
end program abc149_c

Measured memory_bytes: 256
using System;

namespace AOJ.Volume1
{
    class Matrix_likeComputation
    {
        public static void Main()
        {
            while (true)
            {
                int n = int.Parse(Console.ReadLine());
                if (n == 0) { break; }

                int[,] matrix = new int[n + 1, n + 1];
                for (int i = 0; i < n; i++)
                {
                    var input = Console.ReadLine().Trim().Split();
                    int h = 0;
                    for (int j = 0; j < n; j++)
                    {
                        matrix[i, j] = int.Parse(input[j]);
                        h += int.Parse(input[j]);
                    }
                    matrix[i, n] = h;
                }

                for (int i = 0; i <= n; i++)
                {
                    int v = 0;
                    for (int j = 0; j < n; j++)
                    {
                        v += matrix[j, i];
                    }
                    matrix[n, i] = v;
                }

                for (int i = 0; i <= n; i++)
                {
                    string output = "";
                    for (int j = 0; j <= n; j++)
                    {
                        output += matrix[i, j].ToString().PadLeft(5, ' ');
                    }
                    Console.WriteLine(output);
                }
            }
        }
    }
}

Measured memory_bytes: 5796
#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>
#define rep(i, f, n) for (int i = (f); i < (int)(n); i++)
#define repe(i, f, n) for (int i = (f); i <= (int)(n); i++)
using namespace std;
using ll = long long;
using pint = pair<int, int>;

const int INF = 1001001001;

int main() {
  int N;
  cin >> N;
  int ans = 0, l, r;
  rep(i, 0, N) {
    cin >> l >> r;
    ans += r - l + 1;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3596
a = []
for i in range(3):
    row = list(map(int, input().split()))
    a += row
    
result = [1] * 9
    
n = int(input())
for j in range(n):
    k = int(input())
    try:
        c = a.index(k)
        result[c] = 0
    except ValueError:
        continue

if sum(result[:3]) == 0:
    print('Yes')
elif sum(result[3:6]) == 0:
    print('Yes')
elif sum(result[6:]) == 0:
    print('Yes')
elif result[0] + result[3] + result[6] == 0:
    print('Yes')
elif result[1] + result[4] + result[7] == 0:
    print('Yes')
elif result[2] + result[5] + result[8] == 0:
    print('Yes')
elif result[0] + result[4] + result[8] == 0:
    print('Yes')
elif result[2] + result[4] + result[6] == 0:
    print('Yes')
else:
    print('No')
    

Measured memory_bytes: 3064
import sys,heapq
from collections import deque,defaultdict
printn = lambda x: sys.stdout.write(x)
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
DBG = True # and False
def ddprint(x):
  if DBG:
    print(x)

n = inn()
print(180*(n-2))


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

#include<iostream>
#include<string>
using namespace std;
 
int main() {
  string s; cin >> s;
  int a[26] = {};
  for (int i = 0; i < s.size(); i++) a[s[i] - 'a']++;
  for (int i = 0; i < 26; i++) {
    if (a[i] == 0) {
      cout << (char)(i + 'a') << endl;
      return 0;
    }
  }
  cout << "None" << endl;
}

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

int main()
{
    int a,b,x;
    cin>>a>>b>>x;
    if (a>x) printf("NO\n");
    else if (a+b>=x) printf("YES\n");
    else printf("NO\n");
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    long long int x;
    scanf("%lld",&x);
    if(x%11==0)
    printf("%lld\n",(x/11)*2);
    else if(x%11<7 && x%11>0)
    printf("%lld\n",((x/11)*2)+1);
    else
    printf("%lld\n",((x/11)*2)+2);
    return 0;
}

Measured memory_bytes: 128