akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define MAX ((int)(1e8))
#define pi (2*acos(0))
#define M ((ll)(998244353))
#define NN ((ll)(305))
#define N ((int)(2e6 + 5))
#define eps 0
#define log 20


using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef unsigned long long ull;


typedef tree < ll,  null_type,  less < ll >,  rb_tree_tag,  tree_order_statistics_node_update > o_set;

ll cnt[N], ans[N];

int a[N], b[N], par[N];

int findpar(int n)
{
    if(par[n]==n) return n;
    return par[n] = findpar(par[n]);
}

int main()
{
    int n, m;
    scanf("%d %d",&n,&m);
    for(int i = 1; i<=n; i++){
        cnt[i] = 1;
        par[i] = i;
    }
    ans[m] = (ll)n*n-n;
    for(int i = 1; i<=m; i++){
        scanf("%d %d",&a[i],&b[i]);
    }
    for(int i = m; i>0; i--){
        ans[i-1] = ans[i];
        if(findpar(a[i])!=findpar(b[i])) {
            ans[i-1] += cnt[findpar(a[i])]*cnt[findpar(a[i])]+cnt[findpar(b[i])]*cnt[findpar(b[i])];
            cnt[findpar(b[i])] += cnt[findpar(a[i])];
            par[findpar(a[i])] = findpar(b[i]);
            ans[i-1] -= cnt[findpar(b[i])]*cnt[findpar(b[i])];
        }
    }

    for(int i = 1; i<=m; i++) printf("%lld\n",ans[i]/2);
}


Measured memory_bytes: 11904
#include <bits/stdc++.h>
using namespace std;
int N, top, A[200001], dec_len[200001];
int main(){
	cin >> N;
	for(int i=N; i>=1; --i) cin >> A[i];
	for(int i=1; i<=N; ++i) {
		if(A[i]>=dec_len[top]){
			dec_len[++top]=A[i];
		}else {
			dec_len[upper_bound(dec_len+1,dec_len+top+1,A[i])-dec_len]=A[i];
		}
	}
	cout << top << endl;
	return 0;
}

Measured memory_bytes: 1024
N = int(input())
C = []
S = []
F = []
for _ in range(N-1):
  c,s,f = map(int,input().split())
  C.append(c)
  S.append(s)
  F.append(f)
for i in range(N-1):
  t = S[i] + C[i]
  i += 1
  while i < N - 1:
    if t == S[i]:
      pass
    elif t > S[i]:
      if t - S[i] % F[i] == 0:
        pass
      else:
        t += F[i] * -(-(t - S[i]) // F[i]) - (t - S[i])
    else:
      t = S[i]
    t += C[i]
    i += 1
  print(t)
print(0)

Measured memory_bytes: 3188
#include <cstdio>
#include <cstring>
#include <cctype>
#include <cassert>
#include <iostream>
using std::cin; using std::cout; using std::endl;
#include <algorithm>
using std::sort; using std::min; using std::max;
#include <vector>
using std::vector;
#include <set>
using std::set;
#include <queue>
using std::queue; using std::priority_queue;
#include <utility>
using std::pair;
typedef pair<int, int> pii;
typedef long long LL;
typedef long double LD;
#define pass printf("%s : Line.%d\n", __FUNCTION__, __LINE__);
char s[1000], t[1000];

int main() {
	cin >> s >> t;
	int n = strlen(s);
	for(int i = n; i <= 2*n; ++i) s[i] = s[i - n];
	for(int i = 0; i < n; ++i) {
		for(int j = 0; j < n; ++j) {
			if(s[i+j] != t[j]) goto FAIL;
		}
		printf("Yes\n"); return 0;
		FAIL: {}
	}
	printf("No\n");
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
    string n;
    cin >> n;
   if(n[1]==n[2] && (n[0]==n[1] || n[2] == n[3])){
       cout << "Yes" << endl;
   }
   else{
       cout << "No" << endl;
   }
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;
#define NIL NULL
#define MAX 500000
Node root;
int S[MAX-1];
int cnt=0;

Node treeMinimum(Node x){

  while(x->left != NIL)	  x = x->left;
 return x;
}
/*
  Node treeMaximum(Node x){


}
*/

/*Node treeSearch(Node u, int k){
  if(x == NIL || k == x->key)return x;
  if(k < x->key)return treeSearch(x->left,k);
  else return treeSearch(x->right,k);
  
  }
*/

Node treeSuccessor(Node x){
  Node y;
  if(x->right != NIL)return treeMinimum(x->right);
  y = x->parent;
  while(y != NIL && x == y->right){
    x = y;
    y = y->parent;
  }
  return y;
}

void treeDelete(Node z){
  Node y; // node to be deleted
  Node x; // child of y
  
  if(z->left == NIL || z->right == NIL) y = z;
  else y = treeSuccessor(z);
  
  if(y->left != NIL) x = y->left;
  else x = y->right;
  
  if(x != NIL) x->parent = y->parent;
  if(y->parent == NIL) root = x;
  else if(y == y->parent->left) y->parent->left = x;
  else y->parent->right = x;
  if(y != z) z->key = y->key;
  
}

void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;
  
  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;
  S[cnt] = k;
  
  while(x != NIL){
    y=x;
  if(z->key < x->key) x = x->left;
  else x = x->right;
  }
  z->parent = y;
  
  if(y == NIL) root = z;
  else if( z->key < y->key) y->left = z;              // z を y の左の子にする
  else     y->right = z;               // z を y の右の子にする
  cnt++;
}

void inorder(Node u){
  if(u == NIL) return;
 
 inorder(u->left);
  printf(" %d",u->key);
  inorder(u->right);
}
void preorder(Node u){
  if(u == NIL) return;
  printf(" %d",u->key);
  
  preorder(u->left);
  preorder(u->right);
}
Node treeSearch(Node u, int k){
  if(u == NIL || k == u->key)return u;
  if(k < u->key)return treeSearch(u->left,k);
  else return treeSearch(u->right,k);
  
}

int main(){
  int n, i, x;
  char com[20];
  scanf("%d", &n);
  
  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    if ( com[0] == 'f' ){
      scanf("%d", &x);
      Node t = treeSearch(root, x);
      if ( t != NIL ) printf("yes\n");
      else printf("no\n");
    }
    else if ( com[0] == 'i' ){
	scanf("%d", &x);
	insert(x);
      }
      else if ( com[0] == 'p' ){
	inorder(root);
	printf("\n");
	preorder(root);
	printf("\n");
      }else if ( com[0] == 'd' ){
	scanf("%d", &x);
	  treeDelete(treeSearch(root, x));
      }
  }
  return 0;
}




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

int main()
{
	int n, m;
	list<int> members;
	list<int>::iterator it;
	int i;

	while (cin>>n>>m, n||m) {
		while ( !members.empty() )
			members.pop_back();
		for (i = 0; i < n; i++)
			members.push_back(i+1);
		i = 0;
		it = members.begin();
		while ( members.size() > 1 ) {
			if (++i >= m) {
				i = 0;
				members.erase(it++);
			} else {
				it++;
			}
			if (it == members.end()) {
				it = members.begin();
			}
		}
		cout<<*members.begin()<<endl;
	}

	return 0;
}

Measured memory_bytes: 920
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<stack>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
//#define mt make_tuple
//typedef tuple<pii,int,int> tp;
//typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
//template<class C>constexpr int size(const C &c){return (int)c.size();}
//template<class T,size_t N> constexpr int size(const T (&xs)[N])noexcept{return (int)N;}
const double PI=acos(-1);
const double EPS=1e-7;
Def inf=sizeof(Def)==sizeof(long long)?9e18:1e9;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
int dp[42][1<<18][2];
int main(){
	int n,m;
	cin>>n>>m;
	vvi in(n,vi(m));
	rep(i,n)rep(j,m)cin>>in[i][j];
	vi now(n),used(m);
	int out=inf;
	rep(q,m){
		vp cnt(m);
		rep(i,m)cnt[i].second=i;
		rep(i,n)cnt[in[i][now[i]]-1].first++;
		sort(all(cnt));
		out=min(out,cnt[m-1].first);
		used[cnt[m-1].second]=true;
		rep(i,n)while(now[i]!=m&&used[in[i][now[i]]-1])now[i]++;
	}
	cout<<out<<endl;
}











Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
constexpr int MAXN = 307;

int n;
double dp[MAXN][MAXN][MAXN];
int cnt[3];

double dfs(int x, int y, int z)
{
    if (dp[x][y][z] != -1)
        return dp[x][y][z];
    __builtin_prefetch(&dp[x][y][z], 1);
    dp[x][y][z] = (double)n;
    if (x)
        dp[x][y][z] += dfs(x - 1, y, z) * x;
    if (y)
        dp[x][y][z] += dfs(x + 1, y - 1, z) * y;
    if (z)
        dp[x][y][z] += dfs(x, y + 1, z - 1) * z;
    return dp[x][y][z] /= (double)(x + y + z);
}

int main()
{
    fill(**dp, **dp + MAXN * MAXN * MAXN, -1);
    dp[0][0][0] = 0.0;
    scanf("%d", &n);
    for (int i = 0, t; i != n; ++i) {
        scanf("%d", &t);
        ++cnt[t - 1];
    }
    printf("%.9f\n", dfs(cnt[0], cnt[1], cnt[2]));
}

Measured memory_bytes: 226304
import java.util.Scanner;

public class Main {

	public static void solve (int n, int x, int t) {

		int joyo = n % x ;
		int ans = n / x ;

		System.out.println((ans * t) + (joyo != 0?t:0));

	}

	public static void main(String[] args) {

		long start = System.currentTimeMillis();
	    // 引数で標準入力System.inを指定する
	    Scanner scanner = new Scanner(System.in);
		try {

		    // 1行目を取得(a)
			int n  = scanner.nextInt();
			int x  = scanner.nextInt();
			int t  = scanner.nextInt();
			scanner.nextLine();

			solve(n, x, t);

		} finally {
		    // Scannerクラスのインスタンスをクローズ
		    scanner.close();
		}
		long end = System.currentTimeMillis();
		// System.out.println((end - start) );
	}


	// ************************************
	// Common
	// ************************************

	private static final int[] changeArrayStringToInt(String line) {

		String[] strArray = line.split(" ");

		int[] intArray = new int[strArray.length];

		for (int i = 0; i < intArray.length; i++) {
			intArray[i] = Integer.parseInt(strArray[i]);
		}
		return intArray;
	}

}


Measured memory_bytes: 35668
#include <stdio.h>
 
int main(void) {
   
  int a[4][3][10], n;
  int i, j, k, l;
  int b, f, r, v;
  for(i = 0; i < 4; i++) {
    for(j = 0; j < 3; j++) {
      for(k = 0; k < 10; k++) {
    a[i][j][k] = 0;
      }
    }
  }
   
  scanf("%d", &n);
   
  for(l = 0; l < n; l++) {
    scanf("%d %d %d %d", &b, &f, &r, &v);
    a[b-1][f-1][r-1] += v;
  }
  for(i = 0; i < 4; i++) {
    for(j = 0; j < 3; j++) {
      for(k = 0; k < 10; k++) {
    printf(" %d", a[i][j][k]);
      }
      printf("\n");
    }
     
    if(i < 3) {
      printf("####################");
    }
    if(i < 3) {
      printf("\n");
    }
  }
   
  return 0;
}


Measured memory_bytes: 2104
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int a = 0;
        int b = 0;
        int d = 0;
        int r = 0;
        double f = 0.0;
        
        
        a = sc.nextInt();
        b = sc.nextInt();
        
        d = a/b;
        r = a%b;
        f = 1.0*a/b;
        
        System.out.println(d + " " + r + " " + String.format("%.5f",f));
        
    }
}



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

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

  // パターン1
  if (N % 2 == 0) {
    cout << N / 2 << endl;
  }

  // パターン2
  else {
    cout << (N + 1) / 2 << endl;
  }

}


Measured memory_bytes: 256
mod = 10**9+7
n,m = map(int,input().split())
x = list(map(int,input().split()))
y = list(map(int,input().split()))
x.sort()
y.sort()

xd = 0
for i in range(n):
    xd += (2*i-n+1)*x[i]
    xd %= mod

yd = 0
for i in range(m):
    yd += (2*i-m+1)*y[i]
    yd %= mod

print(xd*yd%mod)

Measured memory_bytes: 18624
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>

using namespace std;

typedef long long ll;
// typedef pair<ll, ll> P;
typedef pair<int, int> P;

#define MOD 1000000007
#define REP(i, N) for (int i = 0; i < N; ++i)
#define REP1(i, N) for (int i = 1; i <= N; ++i)
#define RREP(i, N) for (int i = N - 1; i >= 0; --i)
#define ALL(a) a.begin(), a.end()
#define ADD(a, b) a = (a + b) % MOD

int main()
{
  int H, W;
  cin >> H >> W;
  char A[H][W];
  REP(i, H)
  REP(j, W)
  cin >> A[i][j];
  int dist[H][W];
  REP(i, H)
  REP(j, W)
  dist[i][j] = -1;
  queue<P> que;
  REP(i, H)
  REP(j, W)
  {
    if (A[i][j] == '#')
    {
      que.push(make_pair(i, j));
      dist[i][j] = 0;
    }
  }
  int dy[4] = {0, -1, 0, 1};
  int dx[4] = {-1, 0, 1, 0};
  while (que.size())
  {
    P p = que.front();
    que.pop();
    REP(i, 4)
    {
      int ny = p.first + dy[i];
      int nx = p.second + dx[i];
      if (0 <= ny && ny < H && 0 <= nx && nx < W && dist[ny][nx] == -1)
      {
        que.push(make_pair(ny, nx));
        dist[ny][nx] = dist[p.first][p.second] + 1;
      }
    }
  }
  int ans = 0;
  REP(i, H)
  REP(j, W)
  {
    if (ans < dist[i][j])
      ans = dist[i][j];
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 13328
#include<bits/stdc++.h>
#define ll long long int
#define pb push_back
#define mk make_pair
#define all(v) v.begin(),v.end()
#define fi first
#define se second
#define vl vector<long long int>
#define vvl vector<vector<ll> > 
#define fo(i,a,b) for(int i=a;i<b;i++)
#define rof(i,a,b)  for(int i=b;i>=a;i--)
using namespace std;
ll mod=1000000007;
int main()
{
    ll n,k;cin>>n>>k;
    ll a[n],dp[k+1];
    memset(dp,0,sizeof(dp));
    fo(i,0,n)
        cin>>a[i];
    fo(i,1,k+1)
    {
        dp[i]=0;
        fo(j,0,n)
        {
            if(a[j]<=i&&dp[i-a[j]]==0)
                dp[i]=1;
        }
    }
    if(dp[k])
        cout << "First";
    else    cout << "Second";
}



Measured memory_bytes: 4416
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using static System.Console;
namespace AtCoder.ARC086
{
    class NotSoDivers
    {
        public static void Main()
        {
            var nk = ReadLine().Split(' ').Select(_ => int.Parse(_));
            var n = nk.First(); var k = nk.Last();
            var array = new int[(n + 1)];
            foreach (var a in ReadLine().Split(' ').Select(_ => int.Parse(_)))
            {
                array[a]++;
            }
            var balls = array.Where(_ => _ != 0).OrderByDescending(_ => _).ToArray();
            if (balls.Count() <= k) WriteLine(0);
            else
            {
                var res = n;
                for (var i = 0; i < k; ++i) res -= balls[i];
                WriteLine(res);
            }
        }
    }
}


Measured memory_bytes: 37628
x, y, a, b, c = map(int, input().split())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))
p.sort(reverse = True)
q.sort(reverse = True)
r.sort(reverse = True)
pp = p[:x]
qq = q[:y]
if x+y <= c:
  rr = r[:(x+y)]
else:
  rr = r
ppqqrr = pp + qq + rr
ppqqrr.sort(reverse = True)
print(sum(ppqqrr[:x+y]))

Measured memory_bytes: 23328
#include <bits/stdc++.h>
using namespace std;
#define all(V) V.begin(),V.end()
#define ll long long
#define MOD 1000000007

vector<int> G[610];
pair<int, int> E[200000];
double cost[610], les[610];

int main() {
	int N, M, s, t, sz;
	cin >> N >> M;
	for (int i = 0;i < M;i++) {
		cin >> s >> t;
		G[s].push_back(t);
		E[i] = { s,t };
	}
	for (int i = N;i > 0;i--) {
		cost[i] = 1.0;
		//(接続先の期待値+1)*(そこに進む確率)
		for (int j = i - 1;j > 0;j--) {
			sz = G[j].size();
			for (int k : G[j]) {
				cost[j] += cost[k] / sz;
			}
		}
		les[i] = cost[1];
		for (int j = 1;j <= N;j++)cost[j] = 0.0;
	}

	for (int i = N;i > 0;i--) {
		sz = G[i].size();
		for (int k : G[i]) {
			cost[i] += (cost[k] + 1) / sz;
		}
	}

	double ans = 0, tp;
	for (int i = 0;i < M;i++) {
		tie(s, t) = E[i];
		sz = G[s].size();
		if (sz == 1)continue;
		tp = cost[s] - (cost[t] + 1.0) / sz;
		tp *= (double)sz / (sz - 1);
		tp = (cost[s] - tp) * les[s];
		ans = max(tp, ans);
	}
	printf("%.10f", cost[1] - ans);
}

Measured memory_bytes: 2816
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<map>
#include<math.h>

typedef  long long ll;

#define rep(i,a,n) for(ll (i)=(a);(i)<(n);(i)++)
#define rrep(i,a,n) for(ll (i)=(a);(i)>=(n);(i)--)

#define INF ll 1 << 60
#define MOD 1000000007


using namespace std;

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(long long int a,long long int b){
    long long int r;
    if(a < b){
        int tmp;
        tmp = a;
        a = b;
        b = tmp;
    }
    while(r = a % b){
        a = b;
        b = r;
    }
    return a;
}


void ys(){
    cout << "Yes" << endl;
}

void yb(){
    cout << "YES" << endl;
}

void ns(){
    cout << "No" << endl;
}

void nb(){
    cout << "NO" << endl;
}

int dig(int d){
    int ans = 1;
    if(d == 0) return ans;
    while(d != 0){
        d--;
        ans*=100;
    }
    return ans;
}

ll divisors(ll n) {
    vector<ll> res;

    for(ll i = 1; i*i <= n; ++i) {
        if(n % i != 0) continue;
        res.push_back(i-1);
        if(n/i == i) continue;
        res.push_back((n/i)-1);
    }

    ll ans = 0;

    rep(i,0,res.size()){
        if(res[i] != 0)
        if(n/res[i] == n%res[i]) ans += res[i];
    } 
    return ans;
}


void solve(){
    int a,b,c;
    cin >> a >> b;

    cout << (3*a+b)/2<<endl;
}

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


Measured memory_bytes: 384
import string
counter = [0 for i in range(26)]
while True:
    try:
        Sen = input()
    except:
        break
    for i,alp in enumerate(string.ascii_lowercase):
        counter[i] += Sen.count(alp)+Sen.count(alp.swapcase())
for i,alp in enumerate(string.ascii_lowercase):
    print(alp + " : " + str(counter[i]))


Measured memory_bytes: 6684
s = input()
q = int(input())
rev = False
pre = ''
for i in range(q):
  inp = input()
  if int(inp[0]) == 1:
    rev = not rev
  else:
    t, f, c = inp.split()
    if (int(f) == 1 and rev) or (int(f) == 2 and not rev):
      s += c
    else:
      pre += c
print(s[::-1] + pre if rev else pre[::-1] + s)


Measured memory_bytes: 4480
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a),i##formax=(b);i<i##formax;i++)
#define FORR(i,a,b) for(int i=(a),i##formax=(b);i>=i##formax;i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pcnt __builtin_popcount
#define sz(x) (int)(x).size()
#define maxs(x,y) x=max(x,y)
#define mins(x,y) x=min(x,y)
#define show(x) cout<<#x<<" = "<<x<<endl;
#define all(a) (a.begin()),(a.end())
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define perm(c) sort(all(c));for(bool c##p=1;c##p;c##p=next_permutation(all(c)))
#define bitComb(a,n,k) for(int a##x,a##y,a=(1<<k)-1;a<(1<<n);a##x=a&-a,a##y=a+a##x,a=(((a&~a##y)/a##x)>>1)|a##y)
#define uniq(v) sort(all(v));v.erase(unique(all(v)), v.end())
#define bit(n) (1LL<<(n))
#define randInt(l,r) (uniform_int_distribution<ll>(l,r)(rnd))
#define randDouble(l,r) (uniform_real_distribution<double>(l,r)(rnd))
#define dout(d) printf("%.12f\n",d)

typedef long long ll;
typedef __int128_t lll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
template<class T>using V=vector<T>;
template<class T>using VV=V<V<T>>;
template<class T,class Y>ostream& operator<<(ostream& o,const pair<T,Y>& p){return o<<"("<<p.fi<<", "<<p.se<<")";}
template<typename A,size_t N,typename T>void Fill(A (&array)[N],const T&v){fill((T*)array,(T*)(array+N),v);}
lll gcd(lll a,lll b,lll &x,lll &y){if(!b){x=1;y=0;return a;}lll d=gcd(b,a%b,y,x);y-=a/b*x;return d;}
ll gcd(ll a,ll b){lll x=0,y=0;return gcd(a,b,x,y);}
ll modInv(ll a,ll m){lll x,y;gcd(a,m,x,y);return (x%m+m)%m;}
ll modPow(lll a,lll n,ll m){if(!a)return a;lll p=1;for(;n>0;n>>=1,a=a*a%m)if(n&1)p=p*a%m;return(ll)p;}
bool isPrime(ll n){if(n<2||n%2==0)return n==2;lll t=n-1,d=t/(t&-t);for(lll a:{2,325,9375,28178,450775,9780504,1795265022})if(a%n){for(t=d,a=modPow(a,t,n);t!=n-1&&a!=1&&a!=n-1;a=a*a%n,t=t*2%n);if(a!=n-1&&t%2==0)return 0;}return 1;}
const int IINF = 1e9+6;
const ll LINF = 1e18;
const int MOD = 1e9+7;
const double PI = acos(-1);
const double EPS = 1e-10;
static random_device rd;
static mt19937 rnd(rd());

const int N = 1e5;
string s;
main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> s;
  cout << s[0] << sz(s)-2 << s[sz(s)-1] << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include<limits.h>
#include<iomanip>
#include <cassert>
#define rep(i, n) for(int i = 0; i < n; i++)
#define rrep(i, n) for(int i = n-1; i >= 0; i--)
#define REP(i, m, n) for(int i = m; i < n; i++)
#define ALL(v) v.begin(),v.end()
#define RALL(v) v.rbegin(),v.rend()
#define Cout(x) cout << x << endl;
#define check(v) rep(i,v.size()) cout << v[i] << endl;
#define vint(x) vector<int> x
#define vll(x) vector<long long> x
#define vstr(x) vector<string> x
const long long LLINF = 1LL<<60;
const int INF = 1e9;
const long long MOD = 1000000007;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
typedef long long ll;
#define pint pair<int,int>
#define pll pair<ll,ll>
using namespace std;
//オーバーフローに気をつけろよおおおおおお
//確認忘れるなよおおおおおお

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n, m; cin >> n >> m;
    vector<int> v(n,INF);
    rep(i,m) {
        int s, c; cin >> s >> c;
        s--;
        if(v[s]!=INF && v[s]!=c) {
            cout << -1 << endl;
            return 0;
        }
        v[s] = c;
    }

    if(n==1 && v[0]==0) {
        cout << 0 << endl;
        return 0;
    }
    if(n==1 && m==0) {
        cout << 0 << endl;
        return 0;
    }

    rep(i,n) {
        if(i==0) {
            if(v[i]==0) {
                cout << -1 << endl;
                return 0;
            }
            else if(v[i]==INF) cout << 1;
            else cout << v[i];
        }
        else {
            if(v[i]==INF) cout << 0;
            else cout << v[i];
        }
    }
    cout << endl;

    return 0;
}

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

#define FOR(i,l,r) for(int i = (l);i < (r);i++)
#define ALL(x) (x).begin(),(x).end()
template<typename T> bool chmax(T& a,const T& b){return a < b ? (a = b,true) : false;}
template<typename T> bool chmin(T& a,const T& b){return b < a ? (a = b,true) : false;}
typedef long long ll;

class UnionFind{
	private:
		vector<int> parent;
		vector<int> rank;
	public:
		UnionFind(int n)
			:parent(n + 1),rank(n + 1,1){
			for(int i = 1;i <= n;i++) parent [i] = i;
		}
		int find(int x){
			if(parent [x] == x) return x;
			return parent [x] = find(parent [x]);
		}
		bool connect(int x,int y){
			x = find(x),y = find(y);
			if(x == y) return false;
			if(rank [x] < rank [y]) swap(x,y);
			if(rank [x] == rank [y]) rank [x]++;
			parent [y] = x;
			return true;
		}
		bool same(int x,int y){
			return find(x) == find(y);
		}
};

int N,M;

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

	cin >> N >> M;
	vector<int> K(N + 1);
	vector< vector<int> > lang(M + 1);
	for(int i = 1;i <= N;i++){
		cin >> K [i];
		FOR(j,0,K [i]){
			int L;
			cin >> L;
			lang [L].push_back(i);
		}
	}

	UnionFind uf(N);
	int cnt = 0;

	for(int i = 1;i <= M;i++){
		if(lang [i].empty()) continue;
		FOR(j,0,lang [i].size()){
			cnt += uf.connect(lang [i].front(),lang [i] [j]);
		}
	}

	cout << (cnt == N - 1 ? "YES" : "NO") << endl;

	return 0;
}


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

int main()
{
    int n;
    cin >> n;
    cout << fixed << setprecision(10);
    int odd = 0;
    for (int i = 1; i <= n; i++)
    {
        if (i % 2 == 1)
            odd++;
    }
    cout << float(odd) / float(n) << endl;
    return 0;
}

Measured memory_bytes: 256
#define _CRT_NONSTDC_NO_WARNINGS
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <array>
#include <algorithm>
#include <list>
#include <iomanip>
#include <queue>
#include <functional>
#include <cassert>
#include <cmath>
#include <set>
#include <map>
#include <numeric>

#define NL << endl

using namespace std;
using ll = long long;
const int INTMAX = numeric_limits<int>::max();
const int INTMIN = numeric_limits<int>::min();
const ll LLMAX = numeric_limits<long long>::max();
const ll LLMIN = numeric_limits<long long>::min();
const int MOD = 1000000007;
int gcd(int a, int b) { return b ? gcd(b, a%b) : a; }

using namespace std;

signed main() {
	int a, b, c, d, e, f;

	vector<int> alist;
	vector<int> blist;

	cin >> a >> b >> c >> d >> e >> f;

	for (int i = 0; i <= f; i += (100 * a)) {
		for (int j = 0; j + i <= f; j += (100 * b)) {
			alist.push_back(i + j);
		}
	}
	for (int i = 0; i <= f; i += c) {
		for (int j = 0; j + i <= f; j += d) {
			blist.push_back(i + j);
		}
	}

	double max = -1.0;
	int ma, mb;
	for (auto& a : alist) {
		for (auto& b : blist) {
			if (a + b <= f && 100 * b <= a * e) {
				double t = 100.0 * b / (a + b);
				if (max < t) {
					max = t;
					ma = a;
					mb = b;
				}
			}
		}
	}

	cout << ma + mb << ' ' << mb NL;


	return 0;

}



Measured memory_bytes: 1400
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

bool dfs(const vector< vector< pair<int,int> > > &g, vector<int> &x, int v, int p=-1) {
    bool res = true;
    for(auto u: g[v]) {
        if(u.first == p) continue;
        if(x[u.first] == numeric_limits<int>::min()) {
            x[u.first] = x[v] + u.second;
            res &= dfs(g, x, u.first, v);
        } else if(x[u.first] != x[v] + u.second) {
            res = false;
        }
    }
    return res;
}

int main(void) {
    int N, M;
    cin >> N >> M;
    vector< vector< pair<int,int> > > g(N);
    while(M--) {
        int L, R;
        int64_t D;
        cin >> L >> R >> D;
        --L; --R;
        g[L].emplace_back(R, D);
        g[R].emplace_back(L, -D);
    }

    bool ans = true;
    vector<int> x(N, numeric_limits<int>::min());
    for(int i=0; i<N; i++) {
        if(x[i] == numeric_limits<int>::min()) {
            x[i] = 0;
            ans &= dfs(g, x, i);
        }
    }
    
    if(ans) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 15104
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<LL,LL> P;
const LL mod=1e9+7;
const LL LINF=1LL<<62;

int main(){
    int N;
    cin >> N;
    vector<LL> X;
    for(int i=0;i<N;i++){
        LL x;
        cin >> x;
        X.pb(x);
    }
    vector<LL> t;
    t=X;
    sort(ALL(X));
    map<LL,LL> ma;
    for(int i=0;i<N;i++){
        if(i<N/2) ma[X[i]]=X[N/2];
        else ma[X[i]]=X[N/2-1];
    }
    for(int i=0;i<N;i++){
        cout << ma[t[i]] << endl;
    }
    return 0;
}

Measured memory_bytes: 17520
h, w = map(int, input().split())
n = int(input())
a = list(map(int, input().split()))
ans = []
for i in range(n): ans += [i+1]*a[i]
for hi in range(h):
    if hi % 2 == 0:
        print(*ans[hi*w:hi*w+w])
    else:
        print(*ans[hi*w:hi*w+w][::-1])

Measured memory_bytes: 3828
n = int(input())
s = input()

if n % 2 == 1:
    result = "No"
else:
    result = "Yes"
    n = int(n/2)

    for i in range(n):
        if s[i] == s[i + n ]:
            next
        else:
            result = "No"
            break

print(result)

Measured memory_bytes: 2940
#include<iostream>
#include<algorithm>
#include<vector>
#include<numeric>
#include<string>
#include<cmath>
#include<set>
#include<queue>
#include<deque>
#include<bitset>
#include<iomanip>
#include<cctype>
#include<map>
#include<cstring>
#include<bitset>
#include<cassert>

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,a,b) for (int (i)=a;(i)<(b);(i)++)
#define all(x) (x).begin(),(x).end()

using namespace std;
using ll = long long int;

const int inf = 1001001000;
const long long int Inf = 1001001001001001000;



void print(vector<vector<int>> a){
	for (int i = 0; i < a.size(); i++)
	{
		for (int j=0;j<a[i].size();j++){
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
}

void print(vector<vector<long long int>> a){
	for (int i=0;i<a.size();i++){
		for (int j=0;j<a[i].size();j++){
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
}

void print(vector<int> a){
    int n = a.size();
    for (int j=0;j<n;j++) {
        if (j != n-1) cout << a[j] << " ";
        else cout << a[j] << endl;
    }
}

void print(vector<long long int> a){
    int n = a.size();
    for (int j=0;j<n;j++) {
        if (j != n-1) cout << a[j] << " ";
        else cout << a[j] << endl;
    }
}

void print(set<int> a){
	for (auto x:a)
		cout << x << " ";
	cout << endl;
}


int main()
{
	int h, w, m;
	cin >> h >> w >> m;
	vector<int> nh(h,0), nw(w,0);
	vector<pair<int, int>> bom;
	rep(i, m)
	{
		int a, b;
		cin >> a >> b;
		a--;
		b--;
		nh[a]++;
		nw[b]++;
		bom.push_back(pair<int, int>(a, b));

	}

	
	int maxh = *max_element(all(nh));
	int ch = max_element(all(nh)) - nh.begin();
	rep(i,m){
		if (bom[i].first == ch)
			nw[bom[i].second]--;
	}
	int maxw = *max_element(all(nw));
	int cw = max_element(all(nw)) - nw.begin();
	// print(nh);
	// print(nw);
	// cout << maxh << " " << maxw << "  " << ch << " " << cw << endl;

	int ans = maxh + maxw;
	rep(i,m){
		if (bom[i].first == ch)
			nw[bom[i].second]++;
	}
	swap(nh, nw);

	maxh = *max_element(all(nh));
	ch = max_element(all(nh)) - nh.begin();
	rep(i,m){
		if (bom[i].second == ch)
			nw[bom[i].first]--;
	}
	maxw = *max_element(all(nw));
	cw = max_element(all(nw)) - nw.begin();

	ans = max(ans,maxh + maxw);

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 9784
#include<bits/stdc++.h>
//#include<boost\lexical_cast.hpp> 
#define ll long long
#define pi pair<int,int>
#define pl pair<ll,ll>
#define vi vector<int> 
#define vl vector<ll>
#define vpi vector<pi> 
#define vpl vector<pl>
#define pb push_back
#define mp make_pair
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define ss second
#define ff first
#define endl "\n"
#define mod 1000000007
#define MAX 100010
#define fill(a,x) memset(x,a,sizeof x)
#define all(x) x.begin(),x.end()
#define clr(x) memset(x,0,sizeof x)
#define rep(i,a,n) for(ll i=a;i<n;++i)
#define repr(i,n,b) for(ll i=n;i>=b;i--)
#define repit(itr,x) for(auto itr=x.begin();itr!=x.end();itr++)
using namespace std;
//using boost::lexical_cast;
//using boost::bad_lexical_cast;
int main(){
	ios_base::sync_with_stdio(false); cin.tie(NULL);
	int test=1;
	// cin>>test;
	while(test--){
		ll n; cin>>n;
		vector<float> a(n,0);
		rep(i,0,n){
			cin>>a[i];
		}
		double ans=0.0d;
		rep(i,0,n){
			ans+=1/a[i];
		}
		cout<<setprecision(10);
		cout<<fixed;
		cout<<1/ans<<endl;
	}
}

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

int main() {
    double pi=3.141592654;
    double a, b, x;
    cin>>a>>b>>x;
    double theta;
    if(a*a*b/2<x){
        theta=atan(2*b/a-2*x/pow(a, 3));
    }
    else{
        theta=pi/2-atan(2*x/a/b/b);
    }
    printf("%.6lf\n", theta*180/pi);
}

Measured memory_bytes: 384
// Problem : D - Not Divisible
// Contest : AtCoder - AtCoder Beginner Contest 170
// URL : https://atcoder.jp/contests/abc170/tasks/abc170_d?lang=en
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
#pragma GCC target("avx,avx2,fma")
//#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("Ofast")  // disable
using namespace std;
#define ll long long
#define ull unsigned long long
#define ld long double
#define lll __int128
#define lp(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define vec(v, type, sz) vector<type> v(sz)
#define in(v) \
    for (auto &i : v) cin >> i
#define all(v) v.begin(), v.end()
#define prv(v)                         \
    for (auto i : v) cout << i << " "; \
    cout << "\n"
#define MOD 1000000007
#define INF 1000000000
#define INFL 1000000000000000000ll
#define fast_io                       \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
#define vi vector<int>
#define vl vector<ll>
#define vii(v, n, m, val) vector<vector<int>> v(n, vector<int>(m, val))
#define viii(v, i, j, k, val)        \
    vector<vector<vector<int>>> v(i, \
                                  vector<vector<int>>(j, vector<int>(k, val)))
#define pii pair<int, int>
#define pb push_back
#define file_io                       \
    freopen("input.txt", "r", stdin); \
    freopen("output.txt", "w", stdout);
#define testcases \
    int tcc;      \
    cin >> tcc;   \
    for (int tc = 1; tc <= tcc; tc++)
vector<string> vec_splitter(string s) {
    s += ',';
    vector<string> res;
    while (!s.empty()) {
        res.push_back(s.substr(0, s.find(',')));
        s = s.substr(s.find(',') + 1);
    }
    return res;
}
void debug_out(vector<string> __attribute__((unused)) args,
               __attribute__((unused)) int idx,
               __attribute__((unused)) int LINE_NUM) {
    cerr << endl;
}
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
    if (idx > 0)
        cerr << ", ";
    else
        cerr << "Line(" << LINE_NUM << ") ";
    stringstream ss;
    ss << H;
    cerr << args[idx] << " = " << ss.str();
    debug_out(args, idx + 1, LINE_NUM, T...);
}
#ifdef DB
#define debug(...) \
    debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
#else
#define debug(...) 42
#endif

int main() {
    fast_io;
    int n;
    cin >> n;
    map<int, int> mp;
    lp(i, 0, n) {
        int t;
        cin >> t;
        mp[t]++;
    }
    int cnt = 0;
    for (auto i : mp) {
        if (i.second > 1) continue;
        if (i.first != 1 && mp[1] > 0) continue;
        int sq = sqrt(i.first);
        bool is = true;
        for (int j = 2; j <= sq; j++) {
            if (i.first % j == 0) {
                if (mp[j] || mp[i.first / j]) {
                    is = false;
                    break;
                }
            }
        }
        cnt += is;
    }
    cout << cnt;
}

Measured memory_bytes: 32460
INF=10**5+1
p=[1]*INF
for i in range(2,INF):
  if p[i]:
    for j in range(2*i,INF,i):p[j]=0
p[0],p[1]=0,0
dp=[0]*INF
for i in range(1,INF,2):
  if p[i]*p[(i+1)//2]:dp[i]=1
for i in range(1,INF):
  dp[i]+=dp[i-1]
q=int(input())
for i in range(q):
  l,r=map(int,input().split())
  print(dp[r+1]-dp[l-1])

Measured memory_bytes: 78280
#include <bits/stdc++.h>
#ifdef _WIN32
#include "debug.hpp"
#endif
using namespace std;

#define rep(i, N)  for(int i = 0; i < (N); i++)
#define reps(i, N) for(int i = 1; i <= (N); i++)
#define repr(i, N) for(int i = (N) - 1; i >= 0; i--)
#define pub push_back

template<typename T> 
void chmax(T &a, T b){ a = max(a, b); };
template<typename T> 
void chmin(T &a, T b){ a = min(a, b); };

typedef long long ll;
typedef pair<int, int> P;
const int INF = 100000000;
const ll LINF = 10000000000000000;
const int MOD = 1000000007;
const int dx[9] = { 0, 1,  0, -1, 1,  1, -1, -1, 0};
const int dy[9] = { 1, 0, -1,  0, 1, -1, -1,  1, 0};
//--------------------------------------//
int N;
double p[2999];

double dp[3000][3000]; //i番目までで、j枚表になる確率
void solve(){
	dp[0][0] = 1;
	rep(i, N){
		rep(j, N + 1){
			dp[i + 1][j] = dp[i][j] * (1 - p[i]);
			if(j > 0)
				dp[i + 1][j] += dp[i][j - 1] * p[i];
		}
	}
	double ans = 0;
	for(int i = N / 2 + 1; i <= N; i++){
		ans += dp[N][i];
	}
	printf("%.10lf\n", ans);
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cin>>N;
	rep(i,N) {
		cin>>p[i];
	}
		solve();
	return 0;
}


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

int main() {
  ll L, R;
  cin >> L >> R;

  if (R - L >= 2019) {
    cout << 0 << endl;
  } else {
    ll ans = 2019;
    for (ll i = L; i < R; i++) {
      for (ll j = i + 1; j <= R; j++) {
        ans = min(ans, (i * j) % 2019);
      }
    }
    cout << ans << endl;
  }
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define infin ll (pow(10,9)+7);
typedef unsigned int ui;
int main()
{
    int n;
    string s;
    cin>>n;
    cin>>s;
    int count=0,temp=0;
    for(ui i=0;i<s.size();i++)
    {
        if (s[i]=='W')
         temp+=1;
    }
    for(ui i=s.size()-temp;i<s.size();i++)
    {
        if (s[i]=='R')
         count++;
    }
    cout<<count<<endl;
}

Measured memory_bytes: 3708
#include <complex>
#include <cmath>
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
const double EPS = 1e-7;
struct P{
	double x,y,z;
	P(double x,double y,double z) : x(x) , y(y) , z(z) {}
	P(){}
};
P operator + (P a,P b){
	a.x += b.x;
	a.y += b.y;
	a.z += b.z;
	return a;
}
P operator - (P a,P b){
	a.x -= b.x;
	a.y -= b.y;
	a.z -= b.z;
	return a;
}
double abs(P a){
	return sqrt(a.x * a.x + a.y * a.y + a.z * a.z);
}
double det(vector< vector<double> > A){
	double ans = 1;
	for(int i = 0 ; i < A.size() ; i++){
		for(int j = i+1 ; j < A.size() ; j++){
			if( A[i][i] == 0 && A[j][i] != 0 ){
				swap(A[i],A[j]);
				ans *= -1;
				break;
			}
		}
		if( abs(A[i][i]) < 1e-9 ) return 0;
		ans *= A[i][i];
		for(int j = i+1 ; j < A.size() ; j++){
			for(int k = A.size()-1 ; k >= i ; k--){
				A[j][k] -= A[i][k] * A[j][i] / A[i][i];
			}
		}
	}
	return ans;
}

P calc(double k,P a){
	a.x *= k;
	a.y *= k;
	a.z *= k;
	return a;
}
double area(P a,P b,P c){
	b = b-a;
	c = c-a;
	double x = det({{b.y,b.z},{c.y,c.z}});
	double y = det({{b.z,b.x},{c.z,c.x}});
	double z = det({{b.x,b.y},{c.x,c.y}});
	return sqrt(x*x+y*y+z*z);
}
int main(){
	P uaz,ene,a,b,c;
	P vec;
	cin >> uaz.x >> uaz.y >> uaz.z;
	cin >> ene.x >> ene.y >> ene.z;
	cin >> a.x >> a.y >> a.z;
	cin >> b.x >> b.y >> b.z;
	cin >> c.x >> c.y >> c.z;
	
	uaz = uaz - a;
	ene = ene - a;
	b = b - a;
	c = c - a;
	a = a - a;
	vec = ene - uaz;
	double s = abs(vec);
	vec.x /= s;
	vec.y /= s;
	vec.z /= s;
	double l = -1000000 , r = 1000000;
	for( int _ = 0 ; _ < 128 ; _++ ){
		double m = (l+r) / 2.0;
		P pos1 = calc(m,vec) + uaz;
		P pos2 = calc(r,vec) + uaz;
		double D1 = det({{b.x,b.y,b.z},{c.x,c.y,c.z},{pos1.x,pos1.y,pos1.z}});
		double D2 = det({{b.x,b.y,b.z},{c.x,c.y,c.z},{pos2.x,pos2.y,pos2.z}});
		if( D1 * D2 > 0  ){
			r = m;
		}else{
			l = m;
		}
	}
	P hit = calc(l,vec) + uaz;
	//cout << fabs(abs(uaz-hit)-l) << endl;
	//while( abs(det({{b.x,b.y,b.z},{c.x,c.y,c.z},{hit.x,hit.y,hit.z}})) > EPS ){}
	//cout << hit.x << " " << hit.y << " " << hit.z << endl;
	if( l > EPS && fabs(abs(uaz-hit)-l)<EPS && fabs( abs(ene-hit) - (s-l) ) < EPS  ){
		double all = area(a,b,c);
		double sub1 = area(a,b,hit);
		double sub2 = area(b,c,hit);
		double sub3 = area(c,a,hit);
		//cout << all << " " <<  sub1 + sub2 + sub3 << endl;
		if( fabs( all-(sub1+sub2+sub3) ) < EPS ){
			cout << "MISS" << endl;
		}else{
			cout << "HIT" << endl;
		}
	}else{
		cout << "HIT" << endl;
	}
	
	
}

Measured memory_bytes: 1248
MOD = 10**9 + 7
n = int(input())
nodes = []
for i in range(n):
    nodes.append([int(input()), 0])
for i in range(n):
    nodes.append([int(input()), 1])

nodes.sort()
ans = 1
cnt = 0
state = 0
for x, label in nodes:
    if cnt == 0:
        cnt += 1
        state = label
    else:
        if state == label:
            cnt += 1
        else:
            ans *= cnt
            ans %= MOD
            cnt -= 1
print(ans)

Measured memory_bytes: 30740
#include <iostream>
using namespace std;
 
int main() {
  int a, b, c;
  int d;
  cin >> a >> b >> c >> d;
  if (abs(c - a) <= d) {
    cout << "Yes" << endl;
    return 0;
  } else if (abs(b - a) <= d && abs(c - b) <= d) {
    cout << "Yes" << endl;
    return 0;
  }
  
  cout << "No" << endl;
  return 0;
}

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


def main():
    n = int(input())
    c = input()
    r_count = c.count('R')
    ans = 0

    if r_count == 0:
        print(0)
        exit()

    for ci in c:
        if ci == 'W':
            ans += 1

        r_count -= 1

        if r_count == 0:
            print(ans)
            exit()

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 9444
countCells :: Int -> Int -> Int
countCells 1 _ = 1
countCells _ 1 = 1
countCells h w =
  if h `mod` 2 == 0
    then w * (h `div` 2)
    else w * (h `div` 2) + w `div` 2
       + if w `mod` 2 == 0 then 0 else 1

main :: IO ()
main = do
  [h, w] <- map read . words <$> getLine
  print $ countCells h w


Measured memory_bytes: 508
#include<bits/stdc++.h>
using namespace std;
#define ll         long long
#define mod        1000000007
#define setbits(x) __builtin_popcountll(x)
#define zrobits(x) __builtin_ctzll(x)
#define inf        1e18
#define ps(x,y)    fixed<<setprecision(y)<<x

int main() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	int n, m, x;
	cin >> n >> m >> x;
	std::vector<vector<int>> v(n, vector<int>(m + 1));

	for (int i = 0; i < n; ++i)
	{
		for (int j = 0; j < m + 1; ++j)
		{
			cin >> v[i][j];
		}
	}
	// for (int i = 0; i < n; ++i)
	// {
	// 	for (int j = 0; j < m + 1; ++j)
	// 	{
	// 		cout << v[i][j] << " ";
	// 	}
	// 	cout << endl;
	// }

	int ans = INT_MAX;
	for (ll bit = 0; bit < (1 << n); ++bit)
	{
		std::vector<int> skill(m + 1, 0);
		int cost = 0;
		for (int i = 0; i < n; ++i)
		{
			if (bit & (1 << i))
			{
				cost = cost + v[i][0];
				for (int j = 1 ; j <= m; ++j)
				{
					skill[j] += v[i][j];
				}
			}
		}
		bool ck = true;
		for (int i = 1; i <= m ; ++i)
		{
			if (skill[i] < x)
			{
				ck = false;
				break;
			}
		}
		if (ck)
			ans = min (ans, cost);
	}
	if (ans == INT_MAX)
		cout << -1;
	else
		cout << ans << endl;
}

Measured memory_bytes: 3584
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s;
    cin >> s;
    char c1,c2,c3;
    int c = 0;
    c1 = s[0];
    c2 = s[1];
    c3 = s[2];
    
    if( c1 == 'R') c++;
    if( c2 == 'R') c++;
    if( c3 == 'R') c++;
    
    if( c == 3 ) cout << c << "\n";
    else if ( c <= 1 ) cout << c << "\n";
    else if ( c == 2 && ((c1 == c2 && c1 == 'R') || (c2 == c3 && c3 == 'R'))) cout << c << "\n";
    else cout << 1 << "\n";
}

Measured memory_bytes: 3620
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        if(s.equals("Sunny")) System.out.println("Cloudy");
        if(s.equals("Cloudy")) System.out.println("Rainy");
        if(s.equals("Rainy")) System.out.println("Sunny");
        sc.close();

    }

}


Measured memory_bytes: 19284
n = int(input())
a = [int(x) for x in input().split()]
amount = sum(list(map(int,input().split())))
c=[int(x) for x in input().split()]
for i in range(n-1):
  if a[i]+1 == a[i+1]:
    amount += c[a[i]-1]
    
print(int(amount))

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

#define ll long long
#define vvi vector<vector<int>>
#define vec vector
#define pq priority_queue
#define all(v) (v).begin(), (v).end()
#define uniqueV(x) sort(x.begin(), x.end()); x.erase(unique(x.begin(), x.end()), x.end());
#define rep(i, n) for (int (i) = (0); (i) < (n); ++(i))
#define repp(i, m, n) for (int (i) = (m); (i) < (n); ++(i))
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) cerr<<"("<<#x<<", "<<#y<<") = "<<"("<<x<<", "<<y<<")"<<endl;
#define debug3(x, y, z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = "<<"("<<x<<", "<<y<<", "<<z<<")"<<endl;
#define debugB(value, size) cerr<<#value<<": "<<bitset<size>(value) << endl;
#define line() cerr << "---------------" << endl;

const int dx[] = {1, -1, 0, 0};
const int dy[] = {0, 0, -1, 1};
const double PI = 3.14159265358979323846;

template<typename T>
void printA(vector<T> &printArray, char between = ' ') {
   int paSize = printArray.size();
   for (int i = 0; i < paSize; i++) { cerr << printArray[i] << between;}
   if (between != '\n') {cerr << endl;}
}

// ------------------------------------------------------------------------------------------

int n;

int main() {
   cin >> n;
   int four = 0, two = 0, one = 0;
   for (int i = 0; i < n; i++) {
      int a; cin >> a;
      if (a % 4 == 0) {
         four++;
      } else if (a % 2 == 0) {
         two++;
      } else {
         one++;
      }
   }

   one += two % 2;

   if (one <= four+1) {
      puts("Yes");
   } else {
      puts("No");
   }

   return 0;
}

Measured memory_bytes: 256
"use strict"
function Main(input) {
  input = input.trim().split(' ').map(Number);
  let A = input[0];
  let B = input[1];
  let C = input[2];
  let X = input[3];
  let Y = input[4];

  let ret = A*X + B*Y;
  if(A + B < 2*C) {
    console.log(ret);
    return;
  }


  const Xmax = X*2;
  const Ymax = Y*2;
  for(let i=1; i<=Xmax; i++){
    if(i%2 !== 0) continue;
    let x = X-i/2 > 0 ? X-i/2 : 0;
    let y = Y-i/2 > 0 ? Y-i/2 : 0;
    let m = C*i + x*A + y*B;
    if(ret > m) ret = m;
  }

  for(let i=1; i<=Ymax; i++){
    if(i%2 !== 0) continue;
    let x = X-i/2 > 0 ? X-i/2 : 0;
    let y = Y-i/2 > 0 ? Y-i/2 : 0;
    let m = C*i + x*A + y*B;
    if(ret > m) ret = m;
  }
  console.log(ret);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7496
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(x) begin(x), end(x)
#define chmax(x,y) x = max(x,y)
using namespace std;
typedef long long ll;
typedef pair <int,int> P;

P cnt_i[300005],cnt_j[300005];

int main(){
  int H,W,m;
  cin>>H>>W>>m;
  set<P> se;
  rep(i,H){
    cnt_i[i].second=i;
  }
  rep(i,W){
    cnt_j[i].second=i;
  }
  rep(i,m){
    int h,w;
    cin>>h>>w;
    h--; w--;
    se.insert({h,w});
    cnt_i[h].first++;
    cnt_j[w].first++;
  }

  sort(cnt_i,cnt_i+H);
  sort(cnt_j,cnt_j+W);

  int ma_i=cnt_i[H-1].first,ma_j=cnt_j[W-1].first;
  for(int i=H-1;i>=0;i--){
    if(cnt_i[i].first!=ma_i) break;
    for(int j=W-1;j>=0;j--){
      if(cnt_j[j].first!=ma_j) break;
      if(se.find({cnt_i[i].second,cnt_j[j].second})==se.end()){
	cout<<ma_i+ma_j<<endl;
	return 0;
      }
    }
  }
  
  cout<<ma_i+ma_j-1<<endl;
  return 0;
}


Measured memory_bytes: 22368
#include <bits/stdc++.h>
using namespace std;
// types
typedef long long ll; 
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int, int> pii;
// IO
#define fo(i, n) for (int i = 0; i < n; i++)
#define fo1(i, n) for (int i = 1; i <= n; i++)
#define sc(n) scanf("%d", &n) 
#define sca(a, n) fo(i, n) sc(a[i])
#define pd(a) printf("%d ", a)
#define pld(a) printf("%d\n", a)
#define pda(a, n) fo(i, n) pd(a[i])
#define pl printf("\n")
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b) 
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
// math
const ll mod = 1e9+7;
template<typename T> T gcf(T a, T b) {return (b == 0) ? a : gcf(b, a%b);} 
template<typename T> T lcm(T a, T b) {return (a*b)/gcf(a, b);}
template<typename T> T sumTo(T x) {return x * (x+1) / 2;}
template<typename T> T sumSquaresTo(T x) {return x * (x+1) * (2*x+1) / 6;}
template<typename T> T ceilDiv(T n, T d) {return (n+d-1)/d;}

void solve() {
    ll n; cin >> n;
    cout << sumTo(n-1);
}

int main() {
    int t = 1;
    //scanf("%d", &t);
    while (t--) {
        solve();
    }
    return 0;
}

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

int main() {
  int a,b,c,d;
  cin>>a>>b>>c>>d;
  if(a+b>c+d) cout<<"Left"<<endl;
  else if(a+b==c+d) cout<<"Balanced"<<endl;
  else cout<<"Right"<<endl;
}

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

int main() {
  string S,T;
  cin>>S;
  cin>>T;
  int ans=0;
  
  for(int i=0;i<S.size();i++){
    if(S.at(i)!=T.at(i)){
      ans++;
    }
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 3916