akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<cmath>
#include<utility>
#define ll long long int
#define ld long double
#define INF 1000000000
#define EPS 0.0000000001
#define rep(i,n) for(i=0;i<n;i++)
using namespace std;
typedef pair<int, int> P;

string str;

//???????????????????????????????§?(cos??)????±???????
double arg(double vx,double vy,double ux,double uy)
{
  double v=sqrt(vx*vx+vy*vy);//????????????v?????§??????
  double u=sqrt(ux*ux+uy*uy);//????????????u?????§??????
  double product=vx*ux+vy*uy;//????????????u??¨????????????v?????????
  /*
  printf("\nv=%f\nu=%f\n",u,v);
  printf("product=%f\n",product);
  printf("cos=%f\n",product/v/u);
  */
  return acos(product/v/u);

}


int main()
{
  double xa,ya,xb,yb,xc,yc,xd,yd;
  double large,small;

  while(scanf("%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf",
	      &xa,&ya,&xb,&yb,&xc,&yc,&xd,&yd)!=EOF){


    large=arg(xa-xd,ya-yd,xc-xd,yc-yd);//DC,DA
    small=arg(xb-xd,yb-yd,xc-xd,yc-yd);//DC,DB
    // printf("A\n%f\n%f\n",large,small);
    if(large<small){      //?§?A?????????
      cout<<"NO"<<endl;
      continue;
    }


    large=arg(xb-xa,yb-ya,xd-xa,yd-ya);//AD,AB
    small=arg(xc-xa,yc-ya,xd-xa,yd-ya);//AD,AC
    // printf("B\n%f\n%f\n",large,small);
    if(large<small){      //?§?B?????????
      cout<<"NO"<<endl;
      continue;
    }


    large=arg(xc-xb,yc-yb,xa-xb,ya-yb);//BA,BC
    small=arg(xd-xb,yd-yb,xa-xb,ya-yb);//BA,BD
    // printf("C\n%f\n%f\n",large,small);
    if(large<small){      //?§?C?????????
      cout<<"NO"<<endl;
      continue;
    }


    large=arg(xd-xc,yd-yc,xb-xc,yb-yc);//CB,CD
    small=arg(xa-xc,ya-yc,xb-xc,yb-yc);//CB,CA
    //  printf("D\n%f\n%f\n",large,small);
    if(large<small){      //?§?D?????????  
      cout<<"NO"<<endl;
      continue;
    }

    cout<<"YES"<<endl;

  }
}

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

int main() {
    int n, l;
    cin >> n >> l;
    int sum = 0;
    for (int i = 1; i <= n; i++) sum += l + i - 1;
    int ans = 0, sub = 1e9;
    for (int i = 1; i <= n; i++) {
        int tmp = 0;
        for (int j = 1; j <= n; j++) {
            if (i == j) continue;
            tmp += l + j - 1;
        }
        if (sub > abs(tmp - sum)) {
            sub = abs(tmp - sum);
            ans = tmp;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
n = int(input())
red = [[int(i) for i in input().split()] for _ in range(n)]
blue = [[int(i) for i in input().split()] for _ in range(n)]

red.sort(key=lambda x: x[1])
blue.sort()
is_paird = [0] * n
cnt = 0

for b in blue:
    idx = -1
    for i, r in enumerate(red):
        if not is_paird[i] and r[0] < b[0] and r[1] < b[1]:
            idx = i
    if idx != -1:
        is_paird[idx] = 1
        cnt += 1

print(cnt)


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


int main(){
  int n; cin >> n;
  vector<vector<int>> v(n,vector<int>(2));
  for(int i = 0; i < n; i++){
    cin >> v[i][0];
    v[i][1] = i;
  }
  sort(v.begin(), v.end());
  vector<int> w(n, 0);
  for(int i = 0; i < n; i++){
    if(i < n/2){w[v[i][1]] = v[(n/2)][0];}
    else{w[v[i][1]] = v[(n/2)-1][0];}
    //cout << v[i][1] << w[v[i][1]] << endl;
  }
  //for(int i = 0; i < n;i++) cout << v[i][0] << " " << v[i][1] << endl;
  for(auto c:w){cout << c << endl;}
}


Measured memory_bytes: 13952
# -*- coding: utf-8 -*-
import sys
import math
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush
import itertools
import random
from decimal import *

input = sys.stdin.readline

def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
def inputStr(): return input()[:-1]

inf = float('inf')
mod = 1000000007

#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-

def main():
	D = inputInt()
	C = inputList()
	S = []
	ans = []
	for i in range(D):
		s = inputList()
		S.append(s)

	minC = max(C)
	minCn = 0
	for i,val in enumerate(C):
		if val == minC:
			minCn = i+1

	for i,val in enumerate(S):
		tmp = max(val)
		mins = 0
		for j,vol in enumerate(val):
			if tmp == vol:
				mins = j+1
				break
		if i <= D//2:
			ans.append(mins)
		else:
			ans.append(minCn)

	for i in range(D):
		print(ans[i])

#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
if __name__ == "__main__":
	main()


Measured memory_bytes: 84184
#include <bits/stdc++.h>
#define ll long long
#define pb puhs_back
#define Int int64_t
using namespace std;

int N;
int main()
{
   cin>>N;
   vector<Int> A(N);
   for(auto &x:A) cin>>x;
   Int ans=0;
   for(int i=0;i<N;++i){
       for(int j=i+1;j<N;++j){
           ans+=A[i]*A[j];
       }
   }
   cout<<ans<<"\n";
}

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

int main(){
  string s;
  cin >>s;
  if(s=="Sunny") cout << "Cloudy" << endl;
  if(s=="Cloudy") cout << "Rainy" << endl;
  if(s=="Rainy") cout << "Sunny" << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main() {
    int n;
    cin >> n;
    int k = n % 10;
    switch (k)
    {
    case 2:cout << "hon"; break;
    case 4:cout << "hon"; break;
    case 5:cout << "hon"; break;
    case 7:cout << "hon"; break;
    case 9:cout << "hon"; break;
    case 0:cout << "pon"; break;
    case 1:cout << "pon"; break;
    case 6:cout << "pon"; break;
    case 8:cout << "pon"; break;
    case 3:cout << "bon"; break;
    }
    return 0;
 }

Measured memory_bytes: 3620
import collections
N = int(input())
S = input()

table = collections.defaultdict(int)
for i in range(N):
    table[S[i]] += 1
ans = 1
mod = 10**9 + 7
alpha = 'abcdefghijklmnopqrstuvwxyz'
for x in alpha:
    ans *= table[x] + 1
    ans %= mod

print((ans-1) % mod)


Measured memory_bytes: 3444
import java.util.Scanner;
import java.util.Random;
import java.util.Arrays;
import java.util.Comparator;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.HashMap;

public class Main {
	
	public static void main(String[] args) {
		HashMap<String, Integer> map = new HashMap<>();
		
		map.put("A", 10);
		map.put("B", 11);
		map.put("C", 12);
		map.put("D", 13);
		map.put("E", 14);
		map.put("F", 15);
		
		
		Scanner sc = new Scanner(System.in);
		String x = sc.next();
		String y = sc.next();
		
		int a = map.get(x);
		int b = map.get(y);
		
		if(a < b) System.out.println("<");
		if(a == b) System.out.println("=");
		if(a > b) System.out.println(">");
		
	}
	
	
}

Measured memory_bytes: 24660
#include <iostream>
#include <algorithm>
#include <queue>
#include <cstdio>
#include <cstring>
using namespace std;

#include <map>
typedef pair<int,int>Pos;
typedef pair<Pos,int>p;
typedef pair<int,p>P;
#define C top().first
#define X top().second.first.first
#define Y top().second.first.second
#define Z top().second.second
#define mp(a,b,c,d) make_pair(a,make_pair(make_pair(b,c),d))
#define Push(a,b,c,d) push(mp(a,b,c,d))

int xv[]={0,1,0,-1};
int yv[]={-1,0,1,0};


int main(){
	for(int W,H;cin>>W>>H,W;){
		int M[32][32],F[32][32][4];
		memset(M,-1,sizeof(M));
		memset(F,-1,sizeof(F));
		for(int i=1;i<=H;i++)for(int j=1;j<=W;j++)cin>>M[j][i];
		priority_queue<P, vector<P>, greater<P> > Q;
		Q.Push(0,1,1,1);
		int L[4];
		for(int i=0;i<4;i++)cin>>L[i];
		
		for(int c,x,y,z;!Q.empty();){
			c=Q.C;
			x=Q.X;
			y=Q.Y;
			z=Q.Z;
			Q.pop();
			if(x==W&&y==H){
				cout<<c<<endl;
				break;
			}
			
			if(F[x][y][z]<0){
				//cout<<"$"<<endl;
				F[x][y][z]=c;
				for(int i=0;i<4;i++){
					int nx,ny,nz;
					if(i==0)nz=z;
					if(i==1)nz=(z+1)%4;
					if(i==2)nz=(z+2)%4;
					if(i==3)nz=(z+3)%4;
					nx=x+xv[nz];
					ny=y+yv[nz];
					
					
					
					if(M[nx][ny]>=0&&((M[x][y]==i?c:c+L[i])<F[nx][ny][nz]||F[nx][ny][nz]<0)){
						Q.Push((M[x][y]==i?c:c+L[i]),nx,ny,nz);
					}
				}
			}
			
		}
		
	}
	return 0;
}


Measured memory_bytes: 1352
#include <cstdio>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <iterator>
#define loop(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define debug(x)  cout << #x << " = " << (x) << endl;

using namespace std;
using LL = long long;
using ULL = unsigned long long;

int main() {
    long long x, a, b; cin >> x >> a >> b;
    LL d = b - a;
    if (d <= 0) {
        cout << "delicious" << endl;
    } else if (d <= x) {
        cout << "safe" << endl;
    } else {
        cout << "dangerous" << endl;
    }
}


Measured memory_bytes: 384
def cal(n):
    if len(n)==1:
        return n[0]
    if len(n)==0:
        return 0
    if 0 in  n:
        indexes=n.index(0)
        ind1=n[indexes+1:]
        ind2=n[:indexes]
        return cal(ind2)+cal(ind1)
    else:
        mins=min(n)
        lists=[n[j]-mins for j in range(len(n))]
        return cal(lists)+mins
num=int(input())
listw=list(map(int,input().split()))
print(cal(listw))

Measured memory_bytes: 3188
#pragma comment(linker, "/stack:247474112")
#pragma GCC optimize("Ofast")

#include <iostream>
#include <string>
#include <vector>
#include <string>
#include <cstring>
#include <map>
#include <set>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <unordered_set>
#include <tuple>
#include <queue>
#define PII pair<int, int>
#define T3I tuple<int, int, int>
using namespace std;

typedef long long ll;
const ll LLINF = 0x3f3f3f3f3f3f3f3f;
const int INF = 0x3f3f3f3f;

ll ct(vector<ll> &A, ll m)
{
    ll res = 0;
    for(auto x: A) {
        res += (x-m)*(x-m);
    }
    return res;
}

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

    ll n;
    cin >> n;
    vector<ll> A(n);
    for(int i = 0; i < n; ++i) {
        cin >> A[i];
    }
    sort(A.begin(), A.end());
    ll ans = LLINF;
    for(int i = A[0]; i <= *A.rbegin(); ++i) {
        ans = min(ans, ct(A, i));
    }
    cout << ans << endl;
}

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

int n, m, len, x, y, w, a[N], b[N], l[N], r[N];
char s[N], t[N];

int dp(int n, int k) {
	int flag = 1;
	l[len + 1] = 1; r[len + 1] = n;
	for (int i = len; i >= 1; i --) {
		//cout << a[i] << ' ' << b[i] << endl;
		if (a[i] != -1 && b[i] == 1)
		  l[i] = max(l[i + 1] - 1, 1);
		else if (a[i] == -1 && (b[i] != 1 || l[i + 1] == 1))
			l[i] = l[i + 1] + 1;
		else
      l[i] = l[i + 1];

    if (a[i] != 1 && b[i] == -1) 
    	r[i] = min(r[i + 1] + 1, n);
    else if (a[i] == 1 && (b[i] != -1 || r[i + 1] == n))
    	r[i] = r[i + 1] - 1;
    else
    	r[i] = r[i + 1];

    if (l[i] > n || r[i] < 1 || l[i] > r[i]) {
    	flag = 0;
    	//cout << endl;
    	break;
    }
    //cout << "# " << l[i] << ' ' << r[i] << endl;
  }
  //cout << endl;
  if (!flag) return 0;
  if (k >= l[1] && k <= r[1]) return 1;
  return 0;
}
 


int main() {
	//freopen("1.in", "r", stdin);
	//freopen("1.out", "w", stdout);
	scanf("%d%d%d", &n, &m, &len);
	scanf("%d%d", &x, &y);
  scanf("%s", s + 1);
  scanf("%s", t + 1);
  //cout << s + 1 << endl;
  for (int i = 1; i <= len; i ++) {
  	a[i] = b[i] = 0;
  	if (s[i] == 'L') a[i] = -1; else if (s[i] == 'R') a[i] = 1;
  	if (t[i] == 'L') b[i] = -1; else if (t[i] == 'R') b[i] = 1;
  }
  int ans = 1;
  ans = ans & dp(m, y);
  for (int i = 1; i <= len; i ++) {
  	a[i] = b[i] = 0;
  	if (s[i] == 'U') a[i] = -1; else if (s[i] == 'D') a[i] = 1;
  	if (t[i] == 'U') b[i] = -1; else if (t[i] == 'D') b[i] = 1;
  }
  ans = ans & dp(n, x);
  if (ans) printf("YES"); else printf("NO");
  return 0;
}

Measured memory_bytes: 3840
#include<iostream>
#include<numeric>
#include<math.h>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<climits>
#define fi first
#define se second
#define pb push_back
#define pii pair<int,int>
#define ll long long
#define mkp make_pair
#define pll pair<ll,ll>
#define rep(i,from,to) for(int i=from;i<to;i++)
#define repd(i,from,till) for(int i=from;i>=till;i--)
#define waste ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define inf 1e9+1
#define mod 1e9+7
#define inf1 1e18+1
#define pie 3.14159265358979323846
#define N 100005
using namespace std;

int solve(){
	string s;
	cin>>s;
	int cnt=0,maxi=0;
	rep(i,0,3){
		if(s[i]=='R')cnt++;
		else cnt=0;
		maxi=max(maxi,cnt);
	}
	cout<<maxi<<endl;
	return 0;
}
int main(){
    waste;
    int t;
    //cin>>t;
    t=1;
    while(t--){
       	solve();
    }
}


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

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

using namespace std;

template <class T>
using vec = std::vector<T>;
typedef long long ll;
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;
}

const long long INF = 1LL << 60;

const double PI = acos(-1.0);

// long long積のオーバーフロー検出
bool detect_mul_overflow(ll a, ll b)
{
    return a >= LONG_MAX / b;
}

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

struct edge
{
    int from, to, cost;
};

// int型の2次元配列(3×4要素の)の宣言
// vector<vector<int>> data(3, vector<int>(4));

int L,R,d;

int main()
{
    cin>>L>>R>>d;
    int ans=0;
    for(int i=L;i<=R;i++){
        if(i%d==0){
            ans++;
        }
    }
    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 3564
#include<bits/stdc++.h>
using namespace std;
int N,M;
string A[51]={},B[51]={};
int search(int x,int y){
	for(int i=0;i<M;i++){
		for(int k=0;k<M;k++){
			if(A[i+x][k+y]!=B[i][k]){
				return 0;
			}
		}
	}
	return 1;
}
int main(){
	int answer = -1;
	cin>>N>>M;
	for(int i=0;i<N;i++) cin>>A[i];
	for(int i=0;i<M;i++) cin>>B[i];
	for(int i=0;i<N-M;i++){
		for(int k=0;k<N-M;k++){
			answer=max(answer,search(i,k));
		}
	}
	if(answer)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define debug(x) cerr << "\n" \
                      << #x << " = " << x << ".\n"
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define print(xx) cout << (xx) << endl
using namespace std;
#define int long long
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vint;
const int INF = ((1LL << 30) + (1LL << 29));
const ll MOD = 1000000007;

/* 
*/
//================== INPUT ========================
//=================================================
int N;
vector<int> X;
//=================================================
void input()
{
    cin>>N;
    X.resize(N);
    rep(i,N){
        cin>>X[i];
    }
}
//=================================================
void solve()
{
    vector<pii> XX(N);
    rep(i,N){
        XX[i] = make_pair(X[i],i);
    }

    sort(XX.begin(),XX.end());

    pii l = XX[N/2 - 1];
    pii r = XX[N/2];
    // 2,3,3,4,5,6

    rep(i,N){
        if (X[i] < r.first) {
            cout<<r.first<<endl;
        }
        else {
            cout<<l.first<<endl;
        }

    }

}

//=================================================
signed main()
{
    input();
    solve();
    return 0;
}

Measured memory_bytes: 6912
#include <iostream>
#include <algorithm>
#include <string>
#include <cstdio>
#include <vector>
#include <map>
#include <set>
#include <cmath>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
#define ALL(a) a.begin(), a.end()
#define endl "\n"
typedef long long ll;
#define traceV(v) for(auto x:v)cout<<x<<" ";cout<<endl
#define traceM(mp) for(auto x:mp)cout<<x.first<<" "<<x.second<<endl

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

  int H,W; cin>>H>>W;
  vector<string> board(H);
  rep(i,H) cin>>board[i];

  const int dx[4] = {-1, 1,  0, 0};
  const int dy[4] = { 0, 0, -1, 1};

  bool can = true;
  rep(i,H) rep(j,W) {
    if(board[i][j] == '.') continue;

    bool can2 = false;
    rep(d, 4) {
      int ni = i + dx[d];
      int nj = j + dy[d];

      if(ni<0 || ni>=H) continue;
      if(nj<0 || nj>=W) continue;

      if(board[ni][nj] == '#') {can2=true; break;}
    }

    if(can2) {}
    else {can=false; break;}
  }

  if(can) cout << "Yes" << endl;
  else cout << "No" << endl;

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<string>
#define rep(i,n,m) for(int i=(n);i<(int)(m);i++)
#define reps(i,n,m) for(int i=(n);i<=(int)(m);i++)
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define lb lower_bound
#define ub upper_bound
#define LB(a,x) lb(all(a), x) - a.begin()
#define UB(a,x) ub(all(a), x) - a.begin()
#define MOD 1000000007
#define itn int
#define enld endl
using namespace std;
typedef long long ll;
const double pi = 3.141592653589793;
template<class T> bool chmax(T &a, const T &b){if(a<b){a=b; return 1;} return 0;}
template<class T> bool chmin(T &a, const T &b){if(b<a){a=b; return 1;} return 0;}
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    int H ,W ; cin >> H >> W;
    rep(i,0,H){
        rep(j,0,W){
            string s; cin >> s;
            if(s == "snuke"){
                cout << (char)('A'+j) << i+1 << endl;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 3640
import sys
input = sys.stdin.readline

N = int(input())
p = list(map(float, input().split()))
dp = [[0]*(N+1) for _ in range(N+1)]
dp[0][0] = 1

for i in range(N):
    for j in range(N+1):
        if j+1<=N:
            dp[i+1][j+1] += p[i]*dp[i][j]
            
        dp[i+1][j] += (1-p[i])*dp[i][j]

print(sum(dp[N][N//2+1:]))

Measured memory_bytes: 253320
#include<iostream>
#include<vector>
int main(){
    int n;
    std::cin >> n;
    
    std::vector<int> s(n);
    for(int i = 0; i < n; i++) std::cin >> s[i];
    
    int q;
    std::cin >> q;
    
    std::vector<int> t(q);
    for(int i = 0; i < q; i++) std::cin >> t[i];
    
    int count = 0;
    
    for(int i = 0; i < q; i++){
        
        for(int j = 0; j < n; j++){
            if(t[i] == s[j]) {
                count++;
                break;
            }
        }
        
    }
    
    std::cout << count << std::endl;
    return 0;
} 


Measured memory_bytes: 3116
<?php

ini_set('error_reporting', E_ALL & ~E_NOTICE & ~E_WARNING);
ini_set('display_errors', 'Off');

// define('DEBUG', true);
define('DEBUG', false);

fscanf(STDIN, "%d %d", $N, $K);
$A = explode(" ", trim(fgets(STDIN)));
$base = $A;
$mmax = max($A);

if (in_array($K, $A)) {
    echo "POSSIBLE\n";
    exit;
}
if (DEBUG) {
    rsort($A);
    var_dump($A);
}

$bool = true;

$diff = array();

while($bool) {
    $B = array();
    $bool = false;
    $cnt = count($A);
    for ($i = 0; $i < $cnt - 1; $i++) {
        $d = abs($A[$i+1] - $A[$i]);
        if (DEBUG) echo $d . PHP_EOL;
        $B[] = $d;
        if (!isset($diff[$d])) {
            $diff[$d] = 1;
            $bool = true;
        }
    }
    $B = array_unique($B);
    sort($B);
    $A = $B;
    if (DEBUG) echo "----\n";
}

if (DEBUG) {
    var_dump($diff);
    var_dump($A);   
}


foreach ($diff as $key => $val) {
    if (($mmax - $K) / $key > 0 && ($mmax - $K) % $key == 0) {
        echo "POSSIBLE\n";
        exit;
    }    
}
echo "IMPOSSIBLE\n";


Measured memory_bytes: 33524
#include <bits/stdc++.h>
using namespace std;
int n,ans;
void dfs(int sum,char ss){
    if(sum>n)return;
    if(ss==7)ans++;
    if(sum<99999999){
        dfs(sum*10+3,ss|1);
        dfs(sum*10+5,ss|2);
        dfs(sum*10+7,ss|4);
    }
}
int main(){
    cin>>n;
    dfs(0,0);
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3636
from collections import Counter
n = int(input())
s_sorted = []
for _ in range(n):
    s_sorted.append(''.join(sorted(input())))
s_count = Counter(s_sorted)
ans = 0
for i in s_count:
    ans += (s_count[i] * (s_count[i] - 1)) // 2
print(ans)


Measured memory_bytes: 19760
import sys
sys.setrecursionlimit(100000)
input=lambda : sys.stdin.readline().rstrip('\n')

class UnionFind:
    def __init__(self, n):
        self.data=[-1 for i in range(n)]
 
    def root(self,x):
        if self.data[x]<0:
            return x
        else:
            self.data[x]=self.root(self.data[x])
            return self.data[x]
    def uni(self,x,y):
        x=self.root(x)
        y=self.root(y)
        if(x==y):
            return
        if self.data[y]<self.data[x]:
            x,y=y,x
        self.data[x]+= self.data[y]
        self.data[y] = x
 
    def same(self,x,y):
        return self.root(x)==self.root(y)
 
    def size(self,x):
        return -self.data[self.root(x)]
 
n,m=map(int,input().split())
data=[]
for i in range(m):
    a,b=map(int,input().split())
    data.append((a,b))
 
data=data[::-1]
tmp=0
for i in range(n):
    tmp+=i
ans=[tmp]
uf=UnionFind(n)
for i in range(m):
    a,b=data[i]
    if not uf.same(a-1,b-1):
        x,y=uf.size(a-1),uf.size(b-1)
        uf.uni(a-1,b-1)
        ans.append(ans[-1]-x*y)
    else:
        ans.append(ans[-1])
print(*ans[:-1][::-1],sep='\n')

Measured memory_bytes: 25932
ans_queue = []

while True :
    M = int(input())

    if M == 0 :
        for a in ans_queue :
            print(a[0], a[1])
        break

    N = 10
    INF = 10**20
    paths = [[0 if x == y else INF for x in range(N)] for y in range(N)]
    for i in range(M) :
        a, b, c = map(int, input().split())

        paths[a][b], paths[b][a] = c, c 
        
    for k in range(N) :
        for i in range(N) :
            for j in range(N) :
                paths[i][j] = min(paths[i][j], paths[i][k] + paths[k][j])
                
    sum_min = INF * 10
    sum_min_at = -1

    for i in range(N) :
        sum_over = 0

        if sum(paths[i]) != INF * (N - 1) : 
            for j in range(N) :
                if paths[i][j] != INF :
                    sum_over += paths[i][j]

            if sum_min > sum_over :
                sum_min = sum_over
                sum_min_at = i

    ans_queue.append((sum_min_at, sum_min))



Measured memory_bytes: 5608
let id x = x;;

let () =
    let rec f n = 
        let x = Scanf.sscanf(read_line()) "%d" id in
        if x = 0 then () 
        else 
        	(Printf.printf "Case %d: %d\n" n x;
        	 f (n + 1))
     in f 1


Measured memory_bytes: 4548
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0; i<n; i++)
typedef long long ll;
typedef long long unsigned int llu;
ll mod = 1000000007;
ll INF = 1000000009;



void solve(){
    ll n;
    cin >> n;
    ll a[n+10];
    rep(i,n){
        cin >> a[i];
    }
    //累積和
    ll s[n+10];
    rep(i,n)
    if(i==0) s[i]=a[0];
    else{
        s[i]=s[i-1]+a[i];
    }
    /*s[r]-s[l-1]=a[l]+...+a[r]
    総和が0になる部分列は、等しいs[i]の組の数
    sをソートし、同じ値の個数のCをとる
    
    1 3 -4 2 2 -2
    1 4 0  2 4 2

    0があるごとに1を足す
    0が複数あるときは？

    1 3 -4 2 -2 3 -3
    1 4  0 2 0  3  0
    通常通り足せば良さそう

    */

    sort(s,s+n);
    /*rep(i,n){
        cout << s[i] << endl;
    }*/

    ll ans=0;
    ll tmp=1;
    rep(i,n){
        if(s[i]==0) ans++;
    }
    for(int i=1; i<n; i++){
        if(s[i-1]==s[i]) tmp++;
        else{
            ans += tmp*(tmp-1)/2;
            tmp=1;
        }
    }
    ans += tmp*(tmp-1)/2;
    cout << ans << endl;
}

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



Measured memory_bytes: 3328
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <bitset>
#include <list>
#include <stdexcept>
#include <functional>
#include <utility>
#include <ctime>
#include <random>
#include <cassert>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
#define MEM(a,b) memset((a),(b),sizeof(a))
const LL INF = 1e9 + 7;
const int N = 2e2 + 10;
struct Node
{
	int x, y, h;
	void init()
	{
		scanf("%d%d%d", &x, &y, &h);
	}
} a[N];
int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	int n;
	cin >> n;
	for (int i = 1; i <= n; i++)
	{
		a[i].init();
		if (a[i].h) swap(a[i], a[1]);
	}
	for (int x = 0; x <= 100; x++)
	{
		for (int y = 0; y <= 100; y++)
		{
			int h = abs(a[1].x - x) + abs(a[1].y - y) + a[1].h;
			int cnt = 0;
			for (int i = 1; i <= n; i++)
			{
				if (max(0, h - abs(x - a[i].x) - abs(y - a[i].y)) == a[i].h)
					cnt++;
			}
			if (cnt == n)
			{
				printf("%d %d %d\n", x, y, h);
				return 0;
			}
		}
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string a,b,c;
  cin>> a>> b>>c;

  char d,e,f;
  d=a.at(0);
  e=b.at(0);
  f=c.at(0);
  cout<<d<<e<<f<<endl;
}

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

using namespace std;

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

int main(){
  int x, y;
  cin >> x >> y;

  int total = 0;

  for(int i = 0; i < (x+1); i++){
    total = 0;
    total += 2*i;
    total += 4*(x-i);

    if(total == y){
      cout << "Yes" << endl;
      break;
    }

    if(i == x){
      cout << "No" << endl;
    }
  }
}


Measured memory_bytes: 3632
N = int(input())

a = [0]*N
a = list(map(int, input().split()))
for i in range(N):
  
  if a[i]%2 == 0:
    if a[i]%3 != 0 and a[i]%5 != 0:
      print('DENIED')
      break
  if i == N-1:
    print('APPROVED')

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

using namespace std;

int main() {
  int n;
  cin >> n;
  vector<int> x(n);
  int ma = 0;
  int mi = 10000000;
  for (int i = 0; i < n; ++i) {
    cin >> x[i];
    ma = max(ma, x[i]);
    mi = min(mi, x[i]);
  }

  int ans = 2000000000;
  for (int i = mi; i <= ma; ++i) {
    int tmp = 0;
    for (int j = 0; j < n; ++j) {
      tmp += pow(x[j] - i, 2);
    }
    ans = min(ans, tmp);
  }
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  
  bool can = false;
  for(int i = 0;i < 200;i++) {
    for(int j = 0;j < 200;j++) {
      int total = 4*i+7*j;
      if(total == N) can = true;
    }
  }
 if(can) cout << "Yes" << endl;
 else { cout << "No" << endl; 
     }
}  

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

using namespace std;
using ll = long long;
typedef pair<int, int> ii;
typedef vector<ii> vii; 
typedef vector<int> vi;

int main() {
	ios_base::sync_with_stdio(false); cin.tie(0), cout.tie(0);

	int x, n;
	cin >> x >> n;
	set<int> p;
	for(int i = 0; i < n; i++) {
		int temp;
		cin >> temp;
		p.insert(temp);
	}
	
	int i = 0;
	while(true) {
		if(p.find(x - i) == p.end()) {
			cout << x - i << endl;
			break;
		} else if(p.find(x + i) == p.end()) {
			cout << x + i << endl;
			break;
		}
		i++;
	}
	
	return 0;
}

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

using namespace std;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define sz(x) ll(x.size())
typedef long long ll;
//typedef pair<int, int> P;
typedef pair<ll, ll> P;
//const double INF = 1e10;
const ll INF = 10e10;
const ll MINF = -10e10;
//const int INF = INT_MAX;
#define mins(x, y) x = min(x, y)
#define maxs(x, y) x = max(x, y)

typedef priority_queue<P, vector<P>, greater<P> > PQ_ASK;
const int mod = 1000000007;
//ifstream myfile("C:\\Users\\riku\\Downloads\\01.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;

int main() {
    int a, b;
    cin >> a >> b;

    if (a == 2 || b == 2) {
        cout << "No" << endl;
    } else {
        cout << "Yes" << endl;
    }

}


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

using namespace std;
#define REPP(i,a,b,c) for(int i=a; i<=b; i+=c)
#define REP(i,a,b) REPP(i,a,b,1)
#define REVV(i,a,b,c) for(int i=a; i>=b; i-=c)
#define REV(i,a,b) REVV(i,a,b,1)
#define FOR(i,a) REP(i,0,(int)a-1)
#define FORD(i,a) REV(i,(int)a-1,0)
#define PB push_back
#define POB pop_back
#define FI first
#define SE second
#define MP make_pair
typedef long long ll;
typedef unsigned long long ull;
typedef pair < int , int > pii;
typedef vector < int > vi;
typedef vector < pii > vii;
typedef vector < ll > vl;
typedef pair < ll , ll > pll;

const double PI = acos(-1);
const double EPS = 1e-9;
const ll MOD = 1e9 + 7;
const int INF = 1e9;
	

ll addMod(ll a, ll b){
	if(a + b >= MOD) return a + b - MOD;
	return a + b;
}

ll mulMod(ll a, ll b){
	return (a*b)%MOD;
}

ll fast(ll a, ll b){
	if(b == 0) return 1;
	ll tmp = fast(a,b/2);
	tmp = mulMod(tmp,tmp);
	if(b%2 == 1) tmp = mulMod(tmp,a);
	return tmp;
}

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

#define getc getchar
template<typename T>
T getnum(){
	int sign = 1;
	T ret = 0;
	char c;

	do{
		c = getc();
	}while(c == ' ' || c == '\n');
	if(c == '-')sign = -1;
	else ret = c-'0';
	while(1){
		c = getc();
		if(c < '0' || c > '9')break;
		ret = 10*ret + c-'0';
	}
	return sign * ret;
}

inline void ini(int& x){
	x = getnum<int>();
}

//////////////////////////////////////////////


int main(){
	ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int n; cin >> n;
	int tmp = n * 100 / 108;
	while((int)(tmp * 108 / 100) < n) tmp++;
	if((int)(tmp * 108 / 100) == n) cout << tmp << endl;
	else cout << ":(" << endl;
	return 0;
}

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

using namespace std;
typedef long long lint;

#define RPT(i, b, e) for (int i = (b); i <= (e); i++)
#define RPT0(i, n) RPT(i, 0, n - 1)
#define RPT1(i, n) RPT(i, 1, n)
#define EACH(it, v) for (const auto& it : v)
#define ALL(v) v.begin(), v.end()

bool dp[100001];

void resolve()
{
    int N, K;
    cin >> N >> K;
    vector<int> a(N);
    RPT0(i, N) cin >> a[i];

    // dp[i] : 石の個数がi個のときその時の手番の人が勝てるか？
    RPT(i, 0, K)
    {
        dp[i] = false;
        RPT0(j, N)
        {
            if (i - a[j] < 0) break;
            if (!dp[i - a[j]]) {
                dp[i] = true;
                break;
            }
        }
    }

    string ans = dp[K] ? "First" : "Second";
    cout << ans << endl;
}

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


Measured memory_bytes: 384
n, m = map(int, input().split())
arr = set([int(input()) for _ in range(m)])

MOD = 10**9 + 7

dp = [0] * (n + 1)
dp[0] = 1

for i in range(1, n + 1):
    if not i in arr:
        if i == 1:
            dp[i] = dp[i - 1] % MOD
        else:
            dp[i] = (dp[i - 1] + dp[i - 2]) % MOD

print(dp[-1])

Measured memory_bytes: 18984
# Python 3+
import sys

#file = open("test.txt")
file = sys.stdin

data = list( map(int, file.readline().split()) )

if data[0] > data[2] :
    data[2],data[0] = data[0],data[2]

if data[0] > data[1] :
    data[1], data[0] = data[0], data[1]

if data[1] > data[2] :
    data[2],data[1] = data[1], data[2]

out = " ".join(map(str, data))
print(out)

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

struct binaryTree {
	struct node {
		int left, par, right;
	};
	
	vector<int> dep, hei;
	vector<node> tree;

	binaryTree(int n) :
		dep(n),
		hei(n),
		tree(n, { -1, -1, -1 })
	{}

	int getDegree(int a) {
		int res = 0;
		if (tree[a].left != -1) ++res;
		if (tree[a].right != -1) ++res;
		return res;
	}

	int getDepth(int a) {
		return dep[a];
	}

	int getHeight(int a) {
		return hei[a];
	}

	int getLeft(int a) {
		return tree[a].left;
	}

	int getParent(int a) {
		return tree[a].par;
	}

	int getRight(int a) {
		return tree[a].right;
	}

	int getSibling(int a) {
		if (tree[a].par == -1) return -1;
		if (tree[tree[a].par].left == a) return tree[tree[a].par].right;
		return tree[tree[a].par].left;
	}

	void setLeft(int a, int newLeft) {
		tree[a].left = newLeft;
	}

	void setParent(int a, int newParent) {
		tree[a].par = newParent;
	}

	void setRight(int a, int newRight) {
		tree[a].right = newRight;
	}

	void updateDepth(int a, int b) {
		dep[a] = b;
		if (tree[a].left != -1) updateDepth(tree[a].left, b + 1);
		if (tree[a].right != -1) updateDepth(tree[a].right, b + 1);
	}

	int updateHeight(int a) {
		int b = 0, c = 0;
		if (tree[a].left != -1) b = updateHeight(tree[a].left) + 1;
		if (tree[a].right != -1) c = updateHeight(tree[a].right) + 1;
		hei[a] = max(b, c);
		return hei[a];
	}
};

int main() {
	int n, id, left, right, i;
	cin >> n;
	binaryTree bt(n);
	for (int i = 0; i < n; ++i) {
		cin >> id >> left >> right;
		bt.setLeft(id, left);
		if (left != -1) bt.setParent(left, id);
		if (right != -1) bt.setParent(right, id);
		bt.setRight(id, right);
	}
	for (i = 0; i < n; ++i) {
		if (bt.getParent(i) == -1) break;
	}
	bt.updateDepth(i, 0);
	bt.updateHeight(i);
	for (int i = 0; i < n; ++i) {
		cout << "node " << i << ": parent = " << bt.getParent(i) << ", sibling = " << bt.getSibling(i) << ", degree = " << bt.getDegree(i) << ", depth = " << bt.getDepth(i) << ", height = " << bt.getHeight(i);
		if (bt.getParent(i) == -1) cout << ", root";
		else if (bt.getLeft(i) == -1 && bt.getRight(i) == -1) cout << ", leaf";
		else cout << ", internal node";
		cout << endl;
	}
}


Measured memory_bytes: 3128
#include<iostream>
using namespace std;
int main(){
  string s;
  cin >> s;
  int ans = 700;
  for(int i = 0; i < s.size(); i++){
    if(s[i] == 'o') ans += 100;
  }
  
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 256
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric;

alias P = Tuple!(int, int);

void main()
{
    auto nk = readln.split.to!(int[]);
    auto N = nk[0];
    auto K = nk[1];

    auto x = (N-1)*(N-2)/2;
    if (x < K) {
        writeln(-1);
        return;
    }

    P[] ps;
    foreach (i; 2..N+1) {
        ps ~= P(1, i);
    }
    int a = 2, b = 3;
    while (x != K) {
        --x;
        ps ~= P(a, b);
        ++b;
        if (b > N) {
            ++a;
            b = a+1;
        }
    }
    writeln(ps.length);
    foreach (p; ps) writefln("%d %d", p[0], p[1]);
}

Measured memory_bytes: 380
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define db double
#define pii pair<int,int>
#define pli pair<ll,int>
#define pil pair<int,ll>
#define pll pair<ll,ll>
#define mat vector<vector<int>>
const int inf = 1 << 30;
const ll linf = 1e18;
const db EPS = 1e-7;
template<class T> void chmin(T& x, T y){if(x > y) x = y;}
template<class T> void chmax(T& x, T y){if(x < y) x = y;}

template<class T>
struct BIT{
    int N;
    vector<T> bit;
    T init;

    BIT(int n = 0, T init = linf) : N(n), bit(n + 1, init), init(init) {}

    T val(int i){
        T mini = init;
        while(i <= N){
            chmin(mini, bit[i]);
            i += i & -i;
        }
        return mini;
    }

    void update(int r, T x){
        while(r > 0){
            chmin(bit[r], x);
            r -= r & -r;
        }
    }

    void output(){
        cout << (bit[N] == init ? -1 : bit[N]) << endl;
    }
};

struct range{
    int L, R;
    ll C;
    range() {}
    range(int L, int  R, ll C) : L(L), R(R), C(C) {}

    bool operator < (const range r) const {
        return L < r.L;
    }
    bool operator > (const range r) const {
        return L > r.L;
    }
};

int N, M;
vector<range> rs;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> N >> M;
    BIT<ll> bit(N, linf);
    for(int i = 0; i < M; i++){
        int L, R;
        ll C;
        cin >> L >> R >> C;
        rs.push_back({L, R, C});
    }
    sort(rs.begin(), rs.end());
    bit.bit[1] = 0;
    for(int i = 0; i < M; i++){
        range r = rs[i];
        ll val = bit.val(r.L);
        bit.update(r.R, val + r.C);
    }
    bit.output();
    return 0;
}

Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int INF = 0x3f3f3f3f;
const int N = 1e6 + 10;
const int MAX = 1e5 + 10;
const double exps = 1e-8;
#define endl '\n'

inline int max(int a, int b) { return a > b ? a : b; }
inline int min(int a, int b) { return a > b ? b : a; }
int n;
int main() {
    // ios::sync_with_stdio(false);
    ll sum = 0;
    scanf("%d", &n);
    for (int i = 1; i <= n; ++i) {
        if (!((i % 3 == 0 && i % 5 == 0) or (i % 3 == 0) or (i % 5 == 0)))
            sum += 1ll * i;
    }
    cout << sum;
}

Measured memory_bytes: 3684
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
int main(){
    int n,A[200001],B[200001],x=0;
    cin>>n;
    rep(i,n) cin>>A[i];
    rep(i,n)rep(j,n){
        rep(k,n) B[k]=A[k];
        if(i<j) swap(B[i],B[j]);
        int z=1;
        rep(k,n-1) if(B[k]+1!=B[k+1]) z=0;
        if(z) x=1;
    }
    if(x) cout<<"YES";
    else cout<<"NO";
}

Measured memory_bytes: 256
import Control.Applicative
import Control.Monad
import Text.Printf

main :: IO ()
main = do
  n <- readLn :: IO Int
  xs <- map read . words <$> getLine :: IO [Double]
  ys <- map read . words <$> getLine :: IO [Double]
  mapM_ (printf "%.6f\n" . minkowski xs ys) [Just 1, Just 2, Just 3, Nothing]

minkowski :: [Double] -> [Double] -> Maybe Double -> Double
minkowski xs ys Nothing = maximum $ zipWith (\x y -> abs (x-y)) xs ys
minkowski xs ys (Just p) = sum (zipWith (\x y -> abs (x-y)**p) xs ys)**(1/p)

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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>s;
	s[1]='B'+'R'-s[1];
	cout<<s<<endl;
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 3652
use std::io::prelude::*;

fn input<T>() -> T
where
    T: std::str::FromStr,
{
    let stdin = std::io::stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}

fn main() {
    let x: i64 = input();

    let m = x / 11;
    let r = x % 11;
    println!(
        "{}",
        if r == 0 {
            m * 2
        } else if r <= 6 {
            m * 2 + 1
        } else {
            m * 2 + 2
        }
    );
}


Measured memory_bytes: 4352
#include<iostream>
using namespace std;
static const int N=100;

int main(){
  int M[N][N];
  int n,u,k,v;

  cin>>n;

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

  for(int i=0;i<n;i++){
    cin>>u>>k;
    u--;
    for(int j=0;j<k;j++){
      cin>>v;
      v--;
      M[u][v]=1;
    }
  }

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



Measured memory_bytes: 3144
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i, a, b) for(ll i=(ll)(a); i!=(ll)(b); i++)
#define RFOR(i, a, b) for(ll i=(ll)(a); i!=(ll)(b); i--)
#define REP(i, n) FOR(i, 0, n)

ll e(int i){
  if(i == 1) return 5;
  return 2*i + 1;
}

int main(){
  ll n, s; cin >> n >> s;
  ll x[n+1], c[n+1];
  FOR(i, 1, n+1) cin >> x[i];

  reverse(x+1, x+n+1);
  
  c[0] = 0;
  FOR(i, 1, n+1) c[i] = c[i-1] + x[i];

  ll ans = LLONG_MAX;
  FOR(k, 1, n+1){
    ll tp = 0;
    FOR(i, 1, (int)ceil(n*1./k)+1){
      tp += e(i) * (c[min(n, k*i)]-c[k*(i-1)]);
    }
    if(tp < 0) continue;
    ans = min(ans, tp + (k+n) * s);
  }

  cout << ans << endl;

  return 0;
}



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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
#define REP(i, n) for(int i=0; i<n; i++)
#define REPi(i, a, b) for(int i=int(a); i<int(b); i++)
#define MEMS(a,b) memset(a,b,sizeof(a))
#define mp make_pair
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll MOD = 1e9+7;

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

    string ans = "";

    while(N > 0){
        int x = N % 26;
        x--;
        if(x < 0) x += 26;
        ans += 'a' + x;

        //N /= 26;
        N = (N-1)/26;
    }

    reverse(ans.begin(), ans.end());

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3628
#include <iostream>
#include <bits/stdc++.h>
#define lld long long int 
using namespace std;
int main() 
{
        lld n,w;
        cin >> n >> w;
        lld wt[n],val[n];
        for(int i=0;i<n;i++)
        {
            cin >> wt[i] >> val[i];
        }
        lld t[n+1][w+1];
        for(int i=0;i<n+1;i++)
        {
            for(int j=0;j<w+1;j++)
            {
                if(i == 0 || j == 0)
                {
                    t[i][j] = 0;
                }
            }
        }
            for(int i=1;i<n+1;i++)
        {
            for(int j=1;j<w+1;j++)
            {
                if(wt[i-1] <= j)
                {
                    t[i][j] = max(val[i-1] + t[i-1][j-wt[i-1]] ,t[i-1][j]);
                }
                else
                {
                    t[i][j] = t[i-1][j];
                }
            }
        }
        cout<<t[n][w]<<endl;
	return 0;
}


Measured memory_bytes: 79104
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define INF ((1LL<<62)-(1LL<<31))
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define bit(n,m)(((n)>>(m))&1)
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}
ll pom(ll a,ll n,int m){ll x=1;for(a%=m;n;n/=2)n&1?x=x*a%m:0,a=a*a%m;return x;}
//#define MOD 998244353
#define MOD 1000000007
#define invp(a,p)pom(a,p-2,p)

ll n;
char a[110],b[110],c[110];
ll ans;

int main(){
	scanf("%lld %s %s %s",&n,a,b,c);
	rep(i,0,n){
		if(a[i]==b[i]&&b[i]==c[i]){
		}else if(a[i]==b[i]||b[i]==c[i]||c[i]==a[i]){
			ans++;
		}else{
			ans+=2;
		}
	}
	printf("%lld\n",ans);
}

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

#define PI 3.14159265358979323846264338327950288419

using namespace std;

int n;

int great_power_2(int k){
	int ret = 1;
	while(k % (ret * 2) == 0){
		ret *= 2;
	}
	return ret;
}

void addedge(int a, int b){
	if(a < 0){
		a = n - a;
	}
	if(b < 0){
		b = n - b;
	}
	printf("%d %d\n", a, b);
}


int main(){
	scanf("%d", &n);
	if(great_power_2(n) == n){
		printf("No\n");
		return 0;
	}
	printf("Yes\n");
	addedge(1, 2);
	addedge(2, 3);
	addedge(3, -1); // prefer +k and -k encoding
	addedge(-1, -2);
	addedge(-2, -3);
	
	int pv_left = 1, pv_right = 1;
	for(int i = 4; i < n; i += 2){
		addedge(i, i + 1);
		addedge(i + 1, pv_left);
		addedge(pv_right, -i);
		addedge(-i, -(i + 1));
		pv_left = i;
		pv_right = -(i + 1);
	}
	
	if(n % 2 == 0){
		// place the final number pair
		int g = great_power_2(n);
		addedge(n, g);
		addedge(-n, n - (g - 1));
	}
	return 0;
}

Measured memory_bytes: 2816
#include <iostream>
#include <algorithm>
#define int long long

using namespace std;

const int maxn = 100005;

int n;
int a[maxn], b[maxn];
long long M;

void init() {
    cin >> n;
    M = n*(n+1)/2; M = (M+1)/2;
    for(int i = 0 ; i < n ; i++) { cin >> a[i]; b[i] = a[i]; }
}

int c[maxn], s[maxn], t[maxn], t2[maxn];

long long inversion_cnt(int l, int r) {
    if(l == r) return 0;
    long long ans = 0;
    int m = (l+r)/2;
    ans += inversion_cnt(l, m);
    ans += inversion_cnt(m+1, r);
    
    int i = l, j = m+1;
    for(int i = l ; i <= m ; i++) {
        while(s[i] > s[j] && j <= r) j++;
        if(j <= r) ans += r-j+1;
    }
    
    int k = l; i = l, j = m+1;
    while(i <= m && j <= r) {
        if(s[i] <= s[j]) t[k++] = s[i++];
        else t[k++] = s[j++];
    }
    while(i <= m) t[k++] = s[i++];
    while(j <= r) t[k++] = s[j++];
    for(int i = l ; i <= r ; i++) s[i] = t[i];
    
    return ans;
}

bool ok(int x) {
    for(int i = 0 ; i < n ; i++) c[i] = (a[i] >= x ? 1 : -1);
    s[0] = 0;
    for(int i = 1 ; i <= n ; i++) s[i] = s[i-1] + c[i-1];
    
    if(inversion_cnt(0, n) >= M) return true;
    else return false;
}

void solve() {
    sort(b, b+n);
    int x = unique(b, b+n) - b;
    
    int l = 0, r = x, m;
    while(l+1 < r) {
        m = (l+r)/2;
        if(ok(b[m])) l = m;
        else r = m;
    }
    
    cout << b[l] << "\n";
}
#define int int
int main() {
    init();
    solve();
}


Measured memory_bytes: 4096
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
        int m = sc.nextInt();
		long [] a = new long [n];
        for(int i=0;i<n;i++){
                             a[i] = sc.nextLong();
                            } 
           
        while(m>0){Arrays.sort(a); long max = a[n-1]; if(max==0){break;}
                  for(int i=n-1;i>=0;i--){if(a[i]>max/2){a[i]/=2;m--;if(m==0){break;}
                                                        }else{break;}
                                         } 
                  }
        long ans = 0;
        for(int i=0;i<n;i++){ans+=a[i];
                            }      
		System.out.println(ans);
	}
}


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

using namespace std;

#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(v) reverse((v).begin(),(v).end())
#define ANS(ans) cout<<(ans)<<endl;
#define UNIQUE(v) (v).erase(unique((v).begin(), (v).end()), (v).end());
typedef vector<int> VI;
typedef pair<int, int> P;

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


int main() {
	int n;
	cin >> n;
	vector<string> v(n);
	REP(i, n) {
		cin >> v[i];
	}
	int cnt = 0;
	int a = 0, b = 0, ba = 0;
	REP(i, n) {
		string s = v[i];
		REP(j, s.length()-1) {
			if (s[j] == 'A' && s[j + 1] == 'B') {
				cnt++;
			}
		}
		if (s[0] == 'B' && s.back() == 'A') {
			ba++;
		}
		else if (s.back() == 'A') {
			a++;
		}
		else if (s[0] == 'B') {
			b++;
		}
	}

	int ans=cnt;
	if (a >= 1 && b >= 1) {
		ans += min(a, b) + ba;
	}
	else if (a == 0 && b == 0) {
		ans += max(ba - 1,0);
	}
	else if (a == 0) {
		ans += ba;
	}
	else if (b == 0) {
		ans += ba;
	}
	ANS(ans);
	return 0;
}


Measured memory_bytes: 768
#include<bits/stdc++.h>
using namespace std;
int n;
long long ans;
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		if(i%3!=0&&i%5!=0)
		{
			ans+=i;
		}
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 3624