akhauriyash/Code-Regression huggingface dataset:
import math
import fractions
import copy
import numpy as np
def j(q):
    if q==1: print("Yes")
    elif q == 0:print("No")
    exit(0)
rem = pow(10,9)+7
"""
def ct(x,y):
    if (x>y):print("+")
    elif (x<y): print("-")
    else: print("?")
"""

def ip():
    return int(input())
def iprow():
    return [int(i) for i in input().split()]
def ips():
    return (int(i) for i in input().split())
def printrow(a):
    for i in a:
        print(i)
"""
#decomment when needed
def combinations(n,r):
    if n<r:return 0
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
def permutations(n,r):
    if n<r:return 0
    return math.factorial(n) // math.factorial(n - r)
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)
"""
n = ip()
a = []
for i in range(n):
    b = input()
    c = [b[i] for i in range(len(b))]
    c.sort()
    a.append(''.join(c))
a.sort()
ans = 0
current = a[0]
count = 1
for i in range(1,n):
    if a[i] != current:
        ans+=(count*(count-1)//2)
        current = a[i]
        count = 1
    else:count+=1
ans+=(count*(count-1)//2)
current = 1
print(ans)

Measured memory_bytes: 20808
#include <iostream>
using namespace std;
int main(){
    int H, W, k, i;
    while (1){
        cin >> H >> W;
        if (H==0 && W==0){
            break;
        }else{
            for (k=0; k<H; k++){
                for (i=0; i<W; i++){
                    if ((i+k)%2==0){
                        cout << "#";
                    } else{
                        cout << ".";
                    }
                }
                cout << endl;
            }
            cout << endl;
        }
    }
}


Measured memory_bytes: 3092
import java.util.*;

public class Main{

    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);

        // input
        final int NUM = scan.nextInt();
        char[] input = scan.next().toCharArray();

        // search
        int[] west = new int[NUM+1];
        int[] east = new int[NUM+1];
        for(int i = 0; i < NUM; i++){
            west[i+1] += west[i];
            if(input[i] == 'W'){
                west[i+1] += 1;
            }
            east[i+1] += east[i];
            if(input[i] == 'E'){
                east[i+1] += 1;
            }

        }
        int answer = Integer.MAX_VALUE;
        for(int i = 0; i < NUM; i++){
            int temp = west[i] + east[NUM] - east[i + 1];
            if(temp < answer){
                answer = temp;
            }
        }

        // answer
        System.out.println(answer);


    }
}

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

import sys
from decimal import Decimal

def main():
    a,b=input().split()
    a = Decimal(a)
    b = Decimal(b)
    ans = a * b
    ans = str(ans)
    idx = ans.index(".")
    print(ans[:idx])

if __name__ == "__main__":
    main()

Measured memory_bytes: 9868
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var Arr=input.trim().split("\n");
while(true){
   if(Arr.length==0)break;
   var arr=Arr.shift().split(" ");
   var s=[];
   arr.forEach(function(v){
      if(/\d/.test(v)){
         s.unshift(v-0);
      }else{
         var a=s.shift();
         var b=s.shift();
         if(v=="+")s.unshift(b+a);
         if(v=="-")s.unshift(b-a);
         if(v=="*")s.unshift(b*a);
         if(v=="/")s.unshift(b/a);
      }
   });
   console.log(s[0].toFixed(6));
}

Measured memory_bytes: 7644
package main

import "fmt"

func main() {
	var N int
	fmt.Scan(&N)
	A := make([]int, N)
	for i := range A {
		fmt.Scan(&A[i])
	}
	ans := 0
	stop := -1
	for {
		if stop == 1 {
			break
		} else {
			for i, v := range A {
				if v % 2 == 0 {
					A[i] = A[i] / 2
				} else {
					stop = 1
					break
				}
			}
			ans++
		}
	}
	ans--
	fmt.Println(ans)
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define sorted(a) sort(a.begin(), a.end());
#define ALL(a) (a).begin(), (a).end()
typedef long long unsigned int ll;
const long mod = 1e9 + 7;

int main(void) {
#ifdef DEBUG
  freopen("input.txt", "r", stdin);
#endif

  ios_base::sync_with_stdio(false);
  cin.tie(0);

  int A, B;
  cin >> A >> B;

  if (A > 12) {
    cout << B << endl;
  } else if (A < 6) {
    cout << 0 << endl;
  } else {
    cout << B / 2 << endl;
  }

  return 0;
}


Measured memory_bytes: 256
using System;
using System.Linq;

class Program
{
    static void Main(string[] args) {
        int[] s = Console.ReadLine().Split().Select(int.Parse).ToArray();
        int x = Console.ReadLine().Split().Select(int.Parse).ToArray().Concat(new[] {s[2]}).Max();
        int y = Console.ReadLine().Split().Select(int.Parse).ToArray().Concat(new[] {s[3]}).Min();
        Console.WriteLine(x < y ? "No War" : "War");
    }
}

Measured memory_bytes: 13396
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl ("\n")
#define pi (3.141592653589)
#define mod 1e9+7
#define INF 1e9+9
#define float double
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define so sizeof 
#define pii pair<ll,ll>
#define all(c) c.begin(), c.end()
#define min3(a, b, c) min(c, min(a, b))
#define min4(a, b, c, d) min(d, min(c, min(a, b)))
#define max3(a, b, c) max(c, max(a, b))
#define max4(a, b, c, d) max(d, max(c, max(a, b)))
#define repe(i,a) for(auto i:a)
#define st string
#define rep(i,a,b) for(ll i=a;i<=b;i++)
#define rrep(i,a,b) for(ll i=b;i>=a;i--)
#define fast ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr); 
ll dp[100005];
bool visited[100005];
vector<ll> adj[100005];
void dfs(ll src){
     visited[src]=true;
     repe(nbr,adj[src]){
        if(!visited[nbr]){
            dfs(nbr);
        }
        dp[src]=max(dp[nbr]+1,dp[src]); 
     }
}
void solve(){
  ll n,m;
  cin>>n>>m;
  rep(i,1,m){
      ll x,y;
      cin>>x>>y;
      adj[x].push_back(y);
  }
  memset(dp,0,so(dp));
  dp[1]=0;
  rep(i,1,n){
    if(!visited[i]){
        dfs(i);
    }
  }
  ll res=0;
  rep(i,1,n){
     res=max(res,dp[i]);
  }
  cout<<res<<endl;
}
int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt","r", stdin);
    freopen("output.txt","w", stdout);
#endif
    fast
    solve();
    return 0;
}

Measured memory_bytes: 12596
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading.Tasks;

namespace AtCorder
{
	public class Program
	{
		static void Main(string[] args)
		{
			var cin = new Scanner2();
			int n = cin.Int();
			var a = cin.ArrayInt(n);

			bool ok = false;
			int ans = 0;
			int number = 1;
			for (int i = 0; i < n; i++) {
				if (a[i] == number) {
					ok = true;
					number++;
				} else {
					ans++;
				}
			}

			if (ok) {
				Console.WriteLine(ans);
			} else {
				Console.WriteLine(-1);
			}
		}


	}

	public class Scanner2
	{
		private readonly char[] delimiter_ = new char[] { ' ' };
		private readonly string filePath_;
		private readonly Func<string> reader_;
		private string[] buf_;
		private int index_;

		public Scanner2(string file = "")
		{
			if (string.IsNullOrWhiteSpace(file)) {
				reader_ = Console.ReadLine;
			} else {
				filePath_ = file;
				var fs = new StreamReader(file);
				reader_ = fs.ReadLine;
			}
			buf_ = new string[0];
			index_ = 0;
		}

		public string Next()
		{
			if (index_ < buf_.Length) {
				return buf_[index_++];
			}

			string st = reader_();
			while (st == "") {
				st = reader_();
			}

			buf_ = st.Split(delimiter_, StringSplitOptions.RemoveEmptyEntries);
			if (buf_.Length == 0) {
				return Next();
			}

			index_ = 0;
			return buf_[index_++];
		}

		public int Int() => int.Parse(Next());
		public long Long() => long.Parse(Next());
		public double Double() => double.Parse(Next());

		public int[] ArrayInt(int N, int add = 0)
		{
			int[] Array = new int[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Int() + add;
			}
			return Array;
		}

		public long[] ArrayLong(int N, long add = 0)
		{
			long[] Array = new long[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Long() + add;
			}
			return Array;
		}

		public double[] ArrayDouble(int N, double add = 0)
		{
			double[] Array = new double[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Double() + add;
			}
			return Array;
		}

		public void Save(string text)
		{
			if (string.IsNullOrWhiteSpace(filePath_)) {
				return;
			}

			File.WriteAllText(filePath_ + "_output.txt", text);
		}
	}
}

Measured memory_bytes: 29020
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  int a[10];
  fill(a,a+10,0);
  for(int i=0;i<4;i++){
    int b;cin>>b;
    a[b]++;
  }
  if(a[1]==1&&a[9]==1&&a[7]==1&&a[4]==1)cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
}

Measured memory_bytes: 764
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <algorithm>
#include <cmath>
#include <cstring>

using namespace std;

#define REP(i,n) for(int i = 0; i < n; i++)
#define RREP(i,n) for(int i = n - 1; i >= 0; i--)

#define ALL(v) v.begin(),v.end()
#define pb push_back
#define mp make_pair
#define F first
#define S second

#define UNIQUE(v) do{sort(v.begin(), v.end()); v.erase( unique(v.begin(), v.end()), v.end() );} while(0)


#define y0 y3487465
#define y1 y8687969

#define m0(x) memset(x,0,sizeof(x))
#define m1(x) memset(x,63,sizeof(x))

typedef long long ll;
typedef pair<int,int> pi;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pi> vpi;
typedef vector<ll> vll;
typedef vector<vll> vvll;

double EPS = 1e-9;
int INFi = 1000000005;
long long INFll = 1000000000000000005ll;
double PI = acos(-1);
int dirx[8] = {-1,0,0,1,-1,-1,1,1};
int diry[8] = {0,1,-1,0,-1,1,-1,1};
ll MOD = 1000000007;

int N;
const int MAX_N = 100000;
int u[MAX_N], v[MAX_N], w[MAX_N];

struct edge {
  int t, d;
};
vector<edge> G[MAX_N];
bool used[MAX_N];
int color[MAX_N];

void dfs(int n) {
  used[n] = true;
  REP(i, G[n].size()) {
    edge c = G[n][i];
    if(c.d % 2 == 0) color[c.t] = color[n];
    else color[c.t] = 1 - color[n];
    if(!used[c.t]) dfs(c.t);
  }
  return;
} 

int main(){
  cin >> N;
  REP(i, N - 1) cin >> u[i] >> v[i] >> w[i];
  REP(i, N - 1) {
    G[u[i] - 1].pb(edge{v[i] - 1, w[i]});
    G[v[i] - 1].pb(edge{u[i] - 1, w[i]});
  }

  REP(i, N) used[i] = false;
  color[0] = 1;
  dfs(0);

  REP(i, N) cout << color[i] << endl;
  
  return 0;
}


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

int main(){


  int N;

  string str;

  cin>>N;

  cin>>str;

  int cnt1=0,cnt2=0;
  
  for(int i=0;i<str.length();i++){
	if(str[i]=='R'){
	  cnt1++;
	}else{
	  cnt2++;
	}
  }

  if(cnt1>cnt2){
	cout<<"Yes"<<endl;
  }else{
	cout<<"No"<<endl;
  }

  return 0;

}


Measured memory_bytes: 256
var input = require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n");
var obj = {
  "list" : input,
  "index" : 0,
  "max" : input.length,
  "next" : function(){
    if(!this.hasNext()){throw "NoSuchElementException:次に要素は無いよ";}
    var returnObj = this.list[this.index];
    this.index++;
    return returnObj;
  },
  "hasNext" : function(){return (this.index < this.max);}
}
Main();
function next(){return obj.next();}
function nextInt(){return myconv(next(),1);}
function nextStrArray(){return myconv(next(),2);}//半角スペース分割
function nextIntArray(){return myconv(next(),4);}//半角スペース + 数値化
function nextCharArray(){return myconv(next(),6);}//1文字分割
function hasNext(){return obj.hasNext();}
function myout(t){console.log(t);}//標準出力
function myerr(t){console.error(t);}//標準エラー出力
//[no]要素の扱い。数値型
//不明値、異常時:引数そのまま返す　1:数値へ変換
//2:半角SPで分割 4:半角SPで分割し、数値配列へ
//6:1文字で分割  7:1文字で分割し、数値配列へ
//8:半角SPで結合 9:改行で結合 0:文字なしで結合
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(" ");case 4:return i.split(" ").map((a)=>Number(a));case 6:return i.split("");case 7:return i.split("").map((a)=>Number(a));case 8:return i.join(" ");case 9:return i.join("\n");case 0:return i.join("");default:return i;}}catch(e){return i;}}
function Main(){
  var one = nextIntArray();
  var A = one[0];
  var P = one[1];
  myout(Math.floor((A * 3 + P) / 2));
}

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

//ABC172E
//ABC172D
//ABC172C
//ABC172B
int main(void) {
  int n, k, i, cou=0, tmp;
  char s[2*100010], t[2*100010];
  scanf(" %s", s);
  scanf(" %s", t);
  for(i=0; s[i]!='\0'; ++i){
    if(s[i]!=t[i]) cou++; //文字数
  }
  printf("%d", cou);
}


Measured memory_bytes: 2116
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

priority_queue<ll> a;
int main() {
	ll n,m;
	cin>>n>>m;
	for(ll i=0;i<n;i++){
		ll x;
		cin>>x;
		a.push(x);
	}
	for(ll i=0;i<m;i++){
		ll now=a.top();
		a.pop();
		now/=2;
		a.push(now);
	}
	ll ans=0;
	for(ll i=0;i<n;i++){
		ll now=a.top();
		a.pop();
		ans+=now;
	}
	cout <<ans;
	// your code goes here
	return 0;
}

Measured memory_bytes: 1400
/**
 * author  : UshanGhosh
 * created : 2020-09-19 17:13:12
**/ 

#include<bits/stdc++.h>
using namespace std;

#define    ll      long long
#define    pii     pair<int,int>
#define    vii     vector<int>
#define    vcc     vector<char>
#define    pll     pair<long long, long long>
#define    mem     memset
#define    sof     sizeof
#define    co1     __builtin_popcountll
#define    PB      push_back
#define    UB      upper_bound
#define    LB      lower_bound
#define    MP      make_pair
#define    TS      to_string
#define    F       first
#define    S       second
#define    pi      acos(-1)
#define    mod     (int)1e9+7
#define    inf     (long long)1e18
#define    endl    '\n'

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    long long a,b,c,d,e,f,i,j,k,m,n,o,x,y;
    cin>>a>>b>>c>>d;
    ll ans = max(a*c,max(a*d,max(b*c,b*d)));
    cout<<ans<<"\n";
}

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






#define pf                  printf
#define sf(a)               scanf("%d",&a)
#define sfl(a)              scanf("%lld",&a)
#define sff(a,b)            scanf("%d %d",&a,&b)
#define sffl(a,b)           scanf("%lld %lld",&a,&b)
#define sfff(a,b,c)         scanf("%d %d %d",&a,&b,&c)
#define sfffl(a,b,c)        scanf("%lld %lld %lld",&a,&b,&c)
#define sffff(a,b,c,d)      scanf("%d %d %d %d",&a,&b,&c,&d)
#define sffffl(a,b,c,d)     scanf("%lld %lld %lld %lld",&a,&b,&c,&d)
#define sfffff(a,b,c,d,e)   scanf("%d %d %d %d %d",&a,&b,&c,&d,&e)
#define sfffffl(a,b,c,d,e)  scanf("%lld %lld %lld %lld %lld",&a,&b,&c,&d,&e)
#define sfc(a)              scanf("%c",&a)
#define pii                 pair<int,int>
#define ms(a,b)             memset(a,b,sizeof(a))
#define pb(a)               push_back(a)
#define pbp(a,b)            push_back({a,b})
#define db                  double
#define ft                  float
#define ll                  long long
#define ull                 unsigned long long
#define pii                 pair<int,int>
#define ff                  first
#define ss                  second
#define sz(x)               x.size()
#define all(x)              x.begin(),x.end()
#define CIN                 ios_base::sync_with_stdio(0); cin.tie(0)
#define max3(a, b, c)       max(a, b) > max(b, c) ? max(a, b) : max(b, c)
#define min3(a, b, c)       min(a, b) < min(b, c) ? min(a, b) : min(b, c)
#define for0(i,n)           for(int i=0;i<n;i++)
#define for1(i,n)           for(int i=1;i<=n;i++)
#define forrev(i,n)         for(int i=n-1; i>=0; i--)
#define forab(i,a,b)        for(int i=a;i<=b;i++)
#define forba(i,b,a)        for(int i=b;i>=a;i--)
#define stlloop(x)          for(__typeof(x.begin()) it=x.begin();it!=x.end();it++)
#define gcd(a, b)           __gcd(a, b)
#define lcm(a, b)           ((a)*((b)/gcd(a,b)))
#define case1(z)            cout<<"Case "<<z<<": "
#define case2(z)            printf("Case %d: ",z)
#define PI                  acos(-1) //3.14159265358979323846264338328
#define valid(tx,ty)        tx>=0 && tx<row && ty>=0 && ty<col
#define intlim              2147483648
#define N                   200005
#define inf                 100000008
#define mod                 1000000007

/*------------------------------Graph Moves----------------------------*/
//const int fx[]={+1,-1,+0,+0};
//const int fy[]={+0,+0,+1,-1};
//const int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};   // Kings Move
//const int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};  // Kings Move
//const int fx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move
//const int fy[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move
/*---------------------------------------------------------------------*/









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
































Measured memory_bytes: 256
def main():
    n, m = map(int, input().split())
    a = [0 for _ in range(m)]
    for _ in range(n):
        *aa, = map(int, input().split())
        for b in aa[1:]:
            a[b-1] += 1
    print(len([aa for aa in a if aa == n]))


main()


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


int main(){
  int k, s;
  cin >> k >> s;
  int cnt = 0;
  for(int x = 0;x<=k;x++){
    for(int y = x;y<=k;y++){
      for(int z = y;z<=k;z++){
        if(x+y+z==s){
          if(x==y&&y==z) cnt += 1;
          else if(x==y||y==z) cnt += 3;
          else cnt += 6;
        }
      }
    }
  }
  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ll long long
#define ld long double
#define all(a) (a).begin(),(a).end()
#define mk make_pair
ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=100000000000000000;

int main() {
    int n,t;
    cin >> n >> t;
    vector<pp> a(n);
    rep(i,n) cin >> a[i].first >> a[i].second;
    sort(all(a));
    vector<vector<int>> dp(n+1,vector<int>(t+1,-1));
    rep(i,n+1) dp[i][0]=0;
    int ans=0;
    rep(i,n){
        dp[i+1]=dp[i];
        rep(j,t){
            int y=j+a[i].first;
            if (y>t) y=t;
            if (dp[i][j]!=-1)dp[i+1][y]=max(dp[i][j]+a[i].second,dp[i+1][y]);
            ans=max(ans,dp[i+1][y]);
        }
    }
    cout << ans << endl;
}


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

# include <ext/pb_ds/assoc_container.hpp>
# include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;
 
template<typename T> using ordered_set = tree <T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define _USE_MATH_DEFINES_
#define ll long long
#define ld long double
#define Accepted 0
#define pb push_back
#define mp make_pair
#define sz(x) (int)(x.size())
#define every(x) x.begin(),x.end()
#define F first
#define S second
#define lb lower_bound
#define ub upper_bound
#define For(i,x,y)  for (ll i = x; i <= y; i ++) 
#define FOr(i,x,y)  for (ll i = x; i >= y; i --)
#define SpeedForce ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
// ROAD to...                                                                                                                                                                                                                Red

inline void Input_Output () {
	//freopen(".in", "r", stdin);
   //freopen(".out", "w", stdout);
}

const double eps = 0.000001;
const ld pi = acos(-1);
const int maxn = 1e7 + 9;
const int mod = 1e9 + 7;
const ll MOD = 1e18 + 9;
const ll INF = 1e18 + 123;
const int inf = 2e9 + 11;
const int mxn = 1e6 + 9;
const int N = 6e5 + 123;                                          
const int M = 22;
const int pri = 997;
const int Magic = 2101;

const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};
 
int n, m, k;
int cnt[N];
string s;
int a[N];
vector < int > g[N];
int u[N];
int ans, res;
int cur;



int main () {
	SpeedForce;
	cin >> n;
	For(i, 1, n) {
		cin >> a[i];
		u[a[i]]++;
	}

	int mx = *max_element(a + 1, a + n + 1);
	int mn = *min_element(a + 1, a + n + 1);

	if ((mx + 1) / 2 > mn) {
		cout << "Impossible\n";
		exit(0);
	}

	if (u[mn] != 1 + (mx % 2)) {
		cout << "Impossible\n";
		exit(0);
	}

	for (int i = mn + 1; i <= mx; i++) {
		if (u[i] < 2) {
			cout << "Impossible\n";
			exit(0);
		}
	}

	cout << "Possible\n";
		
   	return Accepted;
}

// B...a

Measured memory_bytes: 18688
#include <iostream>
#include <utility>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <math.h>
#include <stack>
#include <set>
#include <deque>
#include <cmath>
#include <cassert>

using namespace std;
typedef long long ll;
ll mod = 1e9+7;
#define rep(i,n) for(int i = 0; i < (n); ++i)

int main(){
    ll x;
    cin >> x;
    ll ans = (x / 11LL)*2LL;
    if (x%11LL > 6LL) {
        ans += 2;
    }
    else if (x%11LL != 0LL) {
        ans += 1;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cassert>
#include <vector>

long long MOD = 1000000007;

int main()
{
  int N, K;
  std::cin >> N >> K;

  std::vector<std::vector<std::vector<long long>>> dp(N + 1);
  for (int i = 0; i <= N; ++i) {
    dp[i].resize(N + 1);
    for (int j = 0; j <= N; ++j)
      dp[i][j].assign(N * (N + 3), 0);
  }

  dp[0][0][0] = 1;

  for (int i = 0; i < N; ++i) {
    for (int j = 0; j <= i; ++j) {
      for (int k = 0; k <= K; ++k) {
        if (dp[i][j][k] == 0)
          continue;
        (dp[i + 1][j][k + 2 * j] += dp[i][j][k]) %= MOD;
        (dp[i + 1][j + 1][k + 2 * (j + 1)] += dp[i][j][k]) %= MOD;
        (dp[i + 1][j][k + 2 * j] += dp[i][j][k] * 2 * j) %= MOD;
        if (j >= 1)
          (dp[i + 1][j - 1][k + 2 * (j - 1)] += dp[i][j][k] * j * j) %= MOD;
      }
    }
  }

  std::cout << dp[N][0][K] << std::endl;

  return 0;
}


Measured memory_bytes: 54144
#include <stdio.h>
 
int main (void)
{
 
    int a, b;
    int shu, area;
 
    scanf("%d %d", &a, &b);
 
    shu = a*2 + b*2;
    area = a * b;
 
    printf("%d %d\n", area, shu );
   
   return 0;
}

Measured memory_bytes: 596
#include <iostream>
#include <string>
#include <vector>
#include <climits>
#include <set>
#include <algorithm>
#include <unordered_map>
#include <queue>
#include <iomanip>
#include <map>
#include <utility>
#include <numeric>

#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define P pair<int, int>
#define debug(x) cout << #x << ": " << x << ", "
#define debugln(x) cout << #x << ": " << x << '\n'

using namespace std;
using ll = long long;
const int mod = 1e9+7;

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

  vector<int> v(11);

  int a, b, c; cin >> a >> b >> c;
  v.at(a)++;
  v.at(b)++;
  v.at(c)++;

  if (v.at(5) == 2 && v.at(7) == 1) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <map>
#include <numeric>
#include <cmath>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <complex>
#include <string.h>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <iomanip>
#include <sys/time.h>
#include <tuple>
#include <random>
using namespace std;

#define endl '\n'
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define UNIQ(v) (v).erase(unique((v).begin(), (v).end()), (v).end())

typedef long long ll;
typedef long double ld;
typedef pair<ll, int> P;
typedef tuple<int, int, int> T;
typedef vector< vector<ld> > matrix;
struct pairhash {
public:
    template<typename T, typename U>
    size_t operator()(const pair<T, U> &x) const {
	size_t seed = hash<T>()(x.first);
	return hash<U>()(x.second) + 0x9e3779b9 + (seed<<6) + (seed>>2);
    }
};
const int inf = 1e9 + 9;
const ll mod = 1e9 + 7;
const double eps = 1e-8;
const double pi = acos(-1);

int n;
int a[200100];

bool p[1000100];

int solve() {
    map<int, int> m;
    for (int i = 0; i < n; i++) m[a[i]]++;
    int res = 0;
    for (auto v : m) {
        if (v.second == 1 && !p[v.first]) {
            res++;
        }
        for (int i = v.first; i < 1000100; i += v.first) {
            p[i] = true;
        }
    }
    return res;
}

void input() {
    cin >> n;
    for (int i = 0; i < n; i++) cin >> a[i];
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(15);

    input();
    cout << solve() << endl;
}


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

namespace CSharpSample01
{

    class Program
    {

        static bool[] visit;
        static List<int>[] g;
        static int timer;
        static int[] prenum;
        static int[] parent;
        static int[] lowest;
        static int N;

        static void Dfs(int current, int prev)
        {
            visit[current] = true;
            prenum[current] = lowest[current] = timer;
            timer++;

            for(int i = 0; i < g[current].Count; i++)
            {
                int next = g[current][i];

                if (!visit[next])
                {
                    parent[next] = current;

                    Dfs(next, current);

                    lowest[current] = Math.Min(lowest[current], lowest[next]);
                }
                else if(next != prev)
                {
                    lowest[current] = Math.Min(prenum[next], lowest[current]);
                }


            }

        }

        static void Solve()
        {

            for(int i = 0; i < N; i++)
            {
                visit[i] = false;            
            }

            //lowestを求める
            Dfs(0, -1);

            var ans = new SortedSet<int>();

            int son_root = 0;

            //lowestをもとに関節点かどうかを判断
            for(int i = 1; i < N; i++)
            {
                int p = parent[i];
                if(p == 0)
                {
                    son_root++;
                }
                else if (prenum[p] <= lowest[i])
                {
                    ans.Add(p);
                }

            }

            if(son_root >= 2)
            {
                ans.Add(0);
            }

            

            foreach(var s in ans)
            {
                Console.WriteLine(s);
            }

        }

        
        static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split(' ');

            N = int.Parse(str[0]);
            int m = int.Parse(str[1]);

            visit = new bool[N];
            g = new List<int>[N];
            timer = 1;
            prenum = new int[N];
            parent = new int[N];
            lowest = new int[N];

            for(int i = 0; i < N; i++)
            {
                g[i] = new List<int>();
            }


            for(int i = 0; i < m; i++)
            {
                string[] input = Console.ReadLine().Split(' ');

                int u = int.Parse(input[0]);
                int v = int.Parse(input[1]);

                g[u].Add(v);
                g[v].Add(u);
            }

            Solve();

        }
    }
}



Measured memory_bytes: 22836
#include<bits/stdc++.h>
#define __ ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long int
#define N 100005

using namespace std;

int main()
{
    __

    string s;
    int a=0,b=0;

    cin>>s;

    for(int i=0;i<3;i++){
        if(s[i]=='A') a++;
        else b++;
    }

    if(a>0 && b>0) cout << "Yes";

    else cout << "No";
    return 0;
}


Measured memory_bytes: 256
from collections import defaultdict
import itertools

n, c = map(int, input().split())
D = [list(map(int, input().split())) for _ in range(c)]
C = [list(map(int, input().split())) for _ in range(n)]

dic = [defaultdict(int) for _ in range(3)]

for i in range(n):
    for j in range(n):
        dist = (i+j) % 3
        num = C[i][j] - 1
        dic[dist][num] += 1


value = [[] for _ in range(3)]
for distance in range(3):
    count_dic = dic[distance]
    for color in range(c):
        res = 0
        for num, count in count_dic.items():
            point = D[num][color] * count
            res += point

        value[distance].append([res, color])

for i in range(3):
    value[i].sort()

A = value[0][:3]
B = value[1][:3]
C = value[2][:3]

ans = 10**9
patterns = itertools.product(A, B, C)
for pattern in patterns:
    (v1, color1), (v2, color2), (v3, color3) = pattern
    check = {color1, color2, color3}
    if len(check) != 3:
        continue
    ans = min(ans, v1+v2+v3)

print(ans)

Measured memory_bytes: 5868
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define BIG 1000000010
#define EPS 1e-9
#define fst first
#define scd second

#define debug(x) cout<<x<<endl;
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
#define int long long


signed main(){
  int p,q,r;
  cin>>p>>q>>r;
  int ans=min(p+q,p+r);
  cout<<min(ans,q+r)<<endl;

  return 0;
}


Measured memory_bytes: 764
<?php
$hi = fopen('php://stdin', "r");
$ho = fopen('php://stdout', "w");

# 空の配列を作成
$arr = array();

# 標準入力からデータをセット
for($i = 0; $i < 10; $i++)
{
	fscanf($hi, "%d", $arr[]);
}

# 降順ソート
rsort($arr);

# 出力
for($i = 0; $i < 3; $i++)
{
	fwrite($ho, sprintf("%d\n", $arr[$i]));
}

fclose($ho);
fclose($hi);

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

int main(){
  int w,a,b;
  cin >> w >> a >> b;
  if(a + w < b){
    cout << b - a - w << endl;
  }else if( b + w < a){
    cout << a - b - w << endl;
  }else{
    cout << 0 << endl;
  }
  return 0;
}

Measured memory_bytes: 256
// Problem : D - Alter Altar
// Contest : AtCoder - AtCoder Beginner Contest 174
// URL : https://atcoder.jp/contests/abc174/tasks/abc174_d
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include<bits/stdc++.h>
#include<set>
#define lli long long int
#define pb push_back
#define cio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define rep(i,a,n) for(i=a;i<n;i++)
#define all(v) (v.begin(),v.end())
#define ppb pop_back
#define vsz v.size()
#define pi 3.141592653589793238
using namespace std;
int main()
{
	lli t=0,n,i,w=0,r=0;
	string s;
	cin>>n>>s;
	for(i=0;i<n;i++){
		if(s[i]=='W')
		w++;
		else 
		r++;
	}
	for(i=0;i<r;i++){
		if(s[i]=='W')
		t++;
	}
	cout<<t;
	return 0;
}

Measured memory_bytes: 3732
#define _USE_MATH_DEFINES
#include <array>
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>
#include <random>
#include <ctime>

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;

int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  priority_queue<int> Q;
  for (int i = 0; i < n; ++i) {
    int x;
    scanf("%d", &x);
    Q.push(x);
  }
  while (m--) {
    int x = Q.top();
    Q.pop();
    Q.push(x / 2);
  }
  int64 ret = 0;
  while (!Q.empty()) {
    int x = Q.top();
    Q.pop();
    ret += x;
  }
  printf("%lld\n", ret);
  return 0;
}


Measured memory_bytes: 892
def resolve():
    s = input()
    t = input()
    ans = 10**18
    for i in range(len(s) - len(t) + 1):
        a = 0
        for j in range(len(t)):
            if s[i + j] != t[j]:
                a += 1
        if ans > a:
            ans = a

    print(ans)

resolve()

Measured memory_bytes: 73064
p=[True for _ in range(10**5)]
max_loop=int((10**5)**0.5)
for j in range(2,max_loop):
    if(p[j]==True):
        i=j*2
        while True:
            if(i>=10**5):
                break
            p[i]=False
            i+=j

ans=[0 for _ in range(10**5)]
for j in range(2,10**5):
    if(j%2==1 and p[j] and p[(j+1)//2]):
        ans[j]+=1
    ans[j]=ans[j]+ans[j-1]

N=int(input())
for j in range(N):
    x,y=map(int,input().split())
    print(ans[y]-ans[x-1])

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

const int INF = 1e9 + 10;

double cross_product(complex<double> a, complex<double> b) {
  return (conj(a) * b).imag();
}

int main() {
  double x, y;
  vector<complex<double>> P;
  while (~scanf("%lf,%lf", &x, &y)) {
    P.push_back(complex<double>(x, y));
  }
  double sum = 0.0;
  for (int i = 0; i + 2 < P.size(); i++) {
    complex<double> a = P[0], b = P[i + 1], c = P[i + 2];
    sum += cross_product(b - a, c - a) / 2;
  }
  printf("%.6f\n", abs(sum));
}



Measured memory_bytes: 3148
#include<iostream>
#include<cassert>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<limits>
#include<set>
#include<deque>
#include<queue>
using namespace std;
#define int long  long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }
typedef pair<int, int>P;
const int MOD = 1e9 + 7;
const int INF = 1e10;
const long double PI = (acos(-1));


signed main() {
	int K;
	cin >> K;
	int sum = 0;
	for (int i = 1; i <= K; i++)sum += i;
	for (int i = 1; i <= K; i++) {
		for (int j = i + 1; j <= K; j++) {
			int g = gcd(i, j);
			sum += 6 * g;
		}
	}
	for (int i = 1; i <= K; i++) {
		for (int j = i + 1; j <= K; j++) {
			for (int k = j + 1; k <= K; k++) {
				int g = gcd(i, gcd(j, k));
				sum += 6 * g;
			}
		}
	}
	cout << sum;
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
#define del(a,i) memset(a,i,sizeof(a))
#define ll long long
#define inl inline
#define il inl void
#define it inl int
#define ill inl ll
#define re register
#define ri re int
#define rl re ll
#define mid ((l+r)>>1)
#define lowbit(x) (x&(-x))
#define INF 0x3f3f3f3f
using namespace std ;
template< class T > inl T read() {
	T x = 0 ; int f = 1 ; char k = getchar() ;
	for( ; k > '9' || k < '0'; k = getchar() ) if( k == '-' ) f = -1 ;
	for( ; k >= '0' && k <= '9'; k = getchar() ) x = x * 10 + k - '0' ;
	return x * f ;
}
template< class T > inl T read( T &x ) { return x = read<T>() ; }
int _num, _buf[20];
template< class T > il print( T x ) {
   	if( x == 0 ) return putchar( '0' ) ,void() ;
	if( x < 0 ) putchar( '-' ), x = -x ;
	while( x ) _buf[++_num] = x % 10, x /= 10 ;
	while( _num ) putchar( _buf[_num--] + '0' ) ;
}
ll mul( ll a, ll b, ll mod ) { long double c = 1. ; return ( a * b - (ll)( c * a * b / mod ) * mod ) % mod ; }
it qpow( int x, int m, int mod ) {
	int res = 1, bas = x ;
	while(m) {
		if( m & 1 ) res = ( 1ll * res * bas ) % mod ;
		bas = ( 1ll * bas * bas ) % mod, m >>= 1 ;
	}
	return res ;
}
int n;
int main() {
//	freopen( ".in", "r", stdin ) ;
//	freopen( ".out", "w", stdout ) ;
	n = read<int>(), n %= 10;
	if( n == 3 ) return puts( "bon" ), 0 ;
	if( n == 0 || n == 1 || n == 6 || n == 8 ) return puts( "pon" ), 0 ;
	puts( "hon" ) ;
	cerr << 1. * clock() / CLOCKS_PER_SEC << "\n" ;
	return 0;
}

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

int main(){
	int N,L;
	cin>>N>>L;
	vector<string> S(N);
	for(int i=0;i<N;i++) cin>>S[i];
	sort(S.begin(),S.end());
	for(int i=0;i<N;i++) cout<<S[i];
	cout<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
using ll = long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(), v.end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;

int main(){
  ll n, a, b;
  cin >> n >> a >> b;
  ll c = n * a;
  chmin(c, b);
  cout << c << endl;
}

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

int main()
{
  int a,b,c,x;
  cin >> a >> b >> c;
  if(a > b){
      x=a; a=b; b=x;
  }
  if(c < b){
      x=b; b=c; c=x;
  }
  if(a > b){
      x=a; a=b; b=x;
  }  
  cout << a << " " << b << " " << c << endl;
}


Measured memory_bytes: 3060
#include <iostream>
#include <array>
#include <algorithm>
#include <vector>
#include <bitset>
#include <set>
#include <unordered_set>
#include <cmath>
#include <complex>
#include <deque>
#include <iterator>
#include <numeric>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
#include <functional>
#include <cassert>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define ALL(v) v.begin(),v.end()
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; }
#define DEBUG_VLL(vec) for(int sz=0;sz<int(vec.size());sz++) std::cerr<<vec[sz]<<(sz==vec.size()-1?'\n':' ');

const long long MOD = 1000000007;
const long long HIGHINF = (long long)1e18;
const int INF = (int)1e9;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    V<string> a(n);
    for (int i = 0; i < n; i++) cin >> a[i];
    vll aa(n, 0);
    for (int i = 0; i < n; i++) {
        int j = 0;
        while (j < a[i].size() && a[i][j] != '.') {
            aa[i] = aa[i] * 10LL + ll(a[i][j] - '0');
            j++;
        }
        j++;
        for (int jj = j; jj < j + 9; jj++) {
            if (jj >= int(a[i].size())) aa[i] *= 10LL;
            else aa[i] = aa[i] * 10LL + ll(a[i][jj] - '0');
        }
    }
    // DEBUG_VLL(aa)
    V< P<int, int> > a25(n, make_pair(0, 0));
    for (int i = 0; i < n; i++) {
        while (aa[i] % 2 == 0) a25[i].first++, aa[i] /= 2;
        while (aa[i] % 5 == 0) a25[i].second++, aa[i] /= 5;
    }

    sort(ALL(a25), [&](P<int, int> i, P<int, int> j) {
        if (i.first == j.first) return i.second > j.second;
        else return i.first > j.first;
    });

    ll ans = 0;
    V< V<int> > plot(50, V<int>(25, 0));
    for (int i = 0; i < n; i++) {
        int rem2 = max(0, 18 - a25[i].first), rem5 = max(18 - a25[i].second, 0);
        for (int i2 = rem2; i2 < 50; i2++) {
            for (int i5 = rem5; i5 < 25; i5++) {
                ans += ll(plot[i2][i5]);
            }
        }
        plot[a25[i].first][a25[i].second]++;
    }
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 12576
mod = 10 ** 9 + 7

L = input()
N = len(L)

dp = [[0] * 2 for _ in range(N + 10)]
dp[0][0] = 1

for i in range(N):
    nd = int(L[i])
    for a in range(2):
        for b in range(2):
            if a == b == 1:  # 繰り上がっちゃう(a+b>L)
                continue
            for k in range(2):
                ni = i + 1
                nk = k
                if nk == 0:
                    if nd == 1 and a == 0 and b == 0:
                        nk += 1
                    if nd == 0 and a | b > 0:
                        continue
                dp[ni][nk] += dp[i][k]
                dp[ni][nk] %= mod

ans = 0
for k in range(2):
    ans += dp[N][k]
    ans %= mod

print(ans)

Measured memory_bytes: 19644
/*
  AtCoder Beginner Contest 090
  A - Diagonal String
*/

#include<iostream>
using namespace std;

char c[9];

int main() {
  for (int i = 0; i < 3; ++i) {
    for (int j = 0; j < 3; ++j) {
      scanf("%c", &c[i*3+j]);
      if (j == 2) getchar();
    }
  }

  printf("%c%c%c\n", c[0], c[4], c[8]);
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <string>
#include <cstdio>
#include <cstring>
#include <queue>
#include <stack>
#include <set>
#include <cmath>

typedef long long ll;
using namespace std;

#define FALSE printf("false\n");
#define TRUE printf("true\n");
#define all(x) (x).begin(),(x).end()
#define print(x) cout<<x<<endl
#define rep(i,n) for(int i = 0;i < ((int)(n));++i)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define SUM(vec) accumulate(all(vec),0LL)
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define test(a) cout<<#a<<':'<<a<<endl

const ll INF = 1e9+7;

template<typename T>inline T digit(T num){T sum = 0;while(num){sum+=num%10;num/=10;}return sum;} // 各桁の和
template<typename T>inline T gcd(T a,T b){if(b == 0)return a;return gcd(b,a%b);}
template<typename T>inline T lcm(T a, T b){T g = gcd(a,b);return a/g*b;}
template<typename T>inline T power(T a,T b){T tmp=1;rep(i,b){tmp*=a;}return tmp;}

bool isOk(int key,int value){
  return value >= key;
}

int binary_search(vector<int> a,int key){
  int ok = a.size();
  int ng = -1;

  while(abs(ok - ng) > 1){
    int mid = (ok + ng) / 2;
    if(isOk(key,a[mid]))ok = mid;
    else ng = mid;
  }
  return ok;
}

int main() {
  cin.tie(0); ios::sync_with_stdio(0);
  int n;cin>>n;
  vector<ll> a(n);rep(i,n)cin>>a[i];
  vector<ll> sums(n);rep(i,n)sums[i] = a[i];
  ll sum = SUM(a);

  for(int i = 1;i < n;++i){
    sums[i] += sums[i-1];
  }

  ll mini = 1000000000000;
  rep(i,n){
    mini = min(abs(abs(abs(sums[n-1] - sums[i]) - abs(sums[i]))),mini);
  }

  ll ans = mini;
  print(ans);
  return 0;
} 


Measured memory_bytes: 3456
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = s; i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << '\n';
#define CFYN(n) cout << ( (n) ? "YES":"NO") << '\n';
#define OUT(n) cout << (n) << '\n';
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

int main(void)
{
    IOS
    int n, q;
    cin >> n >> q;
    string s; cin >> s;
    vector<int> ac(s.size());
    FOR(i,1,s.size()) {
        if (s[i-1] == 'A' && s[i] == 'C') ac[i] = ac[i-1] + 1;
        else ac[i] = ac[i-1];
    }

    REP(_,q) {
        int l, r;
        cin >> l >> r;
        OUT(ac[r-1]-ac[l-1])
    }

    return 0;
}

Measured memory_bytes: 1488
#include <iostream>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <map>

using namespace std;

typedef long long ll;
typedef pair <int, int> pii;
typedef pair <int, pii> piii;

#define F first
#define S second
#define mkp make_pair
#define pb push_back
#define ppb pop_back
#define sz(a) (int)a.size()
#define all(a) a.begin(), a.end()
#define show(x) cerr << "# " << #x << " = " << (x) << endl

const int szT = (1 << 17) - 1;

int n, q, t[szT * 4];
string s;

void upd(int pos, int x) {
    pos += szT;
    t[pos] = x;
    while((pos /= 2) >= 1) {
        t[pos] = t[pos * 2] + t[pos * 2 + 1];
    }
}

int get(int l, int r) {
    int res = 0;
    for(l += szT, r += szT; l <= r; l /= 2, r /= 2) {
        if(l % 2 == 1) res += t[l++];
        if(r % 2 == 0) res += t[r--];
        if(l > r) break;
    }
    return res;
}

int main () {
//    freopen(".in", "r", stdin);
//    freopen(".out", "w", stdout);
    ios_base :: sync_with_stdio(0);
    cin >> n >> q;
    cin >> s;
    for(int i = 1; i < sz(s); ++i) {
        if(s[i - 1] == 'A' && s[i] == 'C') {
            upd(i + 1, 1);
        }
    }
    for(int i = 1; i <= q; ++i) {
        int l, r;
        cin >> l >> r;
        int ans = get(l, r);
        if(s[l - 1] == 'C' && l - 2 >= 0 && s[l - 2] == 'A') --ans;
        cout << ans <<'\n';
    }
    return 0;
}


Measured memory_bytes: 1872
#pragma GCC optimize("O3")
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

using ll = long long;
using P = pair<int, int>;
using T = tuple<int, int, int>;

template <class T> inline T chmax(T &a, const T b) {return a = (a < b) ? b : a;}
template <class T> inline T chmin(T &a, const T b) {return a = (a > b) ? b : a;}

constexpr int MOD = 1e9 + 7;
constexpr int inf = 1e9;
constexpr long long INF = 1e18;
constexpr double pi = acos(-1);
constexpr double EPS = 1e-10;

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

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

    int n; cin>>n;

    vector<P> v;
    for(int i=1; i<=n; i++){
        v.emplace_back((i * 108 / 100), i);
    }

    for(int i=0; i<n; i++){
        if(v[i].first == n){
            cout << v[i].second << endl;
            return 0;
        }
    }

    cout << ":(" << endl;

    return 0;
}

Measured memory_bytes: 892
a = list(map(int, input().split()))
cnt = 0
while True:
    keys = [i for i,k in enumerate(a) if k==min(a)]
    if len(keys) == 1:
        a[keys[0]] += 2
    elif len(keys) == 2:
        a[keys[0]] += 1
        a[keys[1]] += 1
    else:
        break
    cnt += 1
print(cnt)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i=0; i < n; i++)
#define FOR(i, m, n) for(ll i = m; i < n; i++)
#define all(vec) vec.begin(), vec.end()
#define tmax(x, y, z) max((x), max((y), (z)))
#define tmin(x, y, z) min((x), min((y), (z)))
ll MM = 1000000000; ll mod = MM + 7; ll MMM=9223372036854775807;//2^63 -1
ll GCD(ll x, ll y){ if(y == 0) return x; else return GCD(y, x % y);}
ll LCM(ll x, ll y){ return x / GCD(x, y) * y;}
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;}
//cout << fixed << setprecision(10);

int main(){
    ll n; cin>>n;
    bool ok=false;
    while(n>=0){
        if(n%7==0){
            ok=true;
            break;
        }
        n-=4;
    }
    if(ok) cout<<"Yes";
    else cout<<"No";
}

Measured memory_bytes: 256
function Main(input) {
  input = input.split("\n");
  var length = parseInt(input[0]);
  input.shift();
  for(var i = 0; i < input.length; i++){
    input[i] = parseInt(input[i]);
  }
  var tmpInput = JSON.parse(JSON.stringify(input));
  tmpInput.sort(function(a,b){
  	return b - a;
  });
  var max1 = tmpInput[0];
  var max2 = tmpInput[1];
  var max1Index = input.indexOf(max1);
  //console.log("max1:" + max1Index);
  if(max2 == max1){
     //最大値が2回以上出てきている場合は、最大値をN回出力して終わり
    var output = "";
    for(var i = 0; i < length; i++){
      if(i == 0){
         output += max1;
      }else{
         output += "\n" + max1;
      }
    }
    console.log(output);
    return;
  }else{
    var output = "";
    for(var i = 0; i < length; i++){
      if(i != max1Index){
        if(i == 0){
           output = max1;
        }else{
           output += "\n" + max1;
        }
      }else{
        if(i == 0){
           output = max2;
        }else{
           output += "\n" + max2;
        }
      }
    }
    console.log(output);
    return;
  }
}

Main(require("fs").readFileSync("/dev/stdin","utf8"));


Measured memory_bytes: 65456
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int N, M;
    cin >> N >> M;
    long long int dp[N+1];
    int tmp;
    for (int i = 0; i < N+1; i++)
    {
        dp[i] = -1;
    }
    dp[0] = 1;
    dp[1] = 1;
    for (int i = 0; i < M; i++) 
    {
        cin >> tmp;
        dp[tmp] = 0;
    }
    
    
    for (int i = 2; i < N+1; i++)
    {
        if (dp[i] != 0)
        {
            dp[i] = dp[i - 1] + dp[i - 2];
            dp[i] %= 1000000007;
        }
    }
    //for (int i = 0; i < N+1; i++)   cout << dp[i] <<endl;
    cout << dp[N] << endl;
    return 0;
}


Measured memory_bytes: 1024