akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <functional>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <climits>

#define all(c) (c).begin(), (c).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)
#define fr first
#define sc second

const int INF=100000000;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
using namespace std;
typedef pair<int ,int > P;
typedef long long ll;

string input;

ll lcm(ll a, ll b) {
    return a/__gcd(a,b)*b;
}

struct Q {
    ll a,b;
    Q(ll a=1,ll b=1) : a(a), b(b) { }

    Q operator+(const Q& obj) {

        ll t = lcm(this->b,obj.b);
        this->a = t/this->b*this->a + t/obj.b*obj.a;
        this->b=t;

        return *this;
    }

    void tuning() {
        if(this->a<0) this->a*=-1;
        if(this->b<0) this->b*=-1;
        ll g = __gcd(this->a,this->b);
        this->a/=g;
        this->b/=g;
    }

};

void print(double a) {
    int cnt=1;
    while(ceil(a)!=(int)a) {
        cnt<<=1;
        a*=2;
    }
    if(cnt==1) {
        cout<<a<<endl;
    }
    else {
        cout<<a<<"/"<<cnt<<endl;
    }
}

void solve() {
    string s="";
    rep(i,input.size()) {
        if(input[i]=='n') {
            i+=4;
            s+="n";
        }
        else {
            i+=3;
            s+="w";
        }
    }
    int n=s.size();
    Q a;
    if(s[n-1]=='n') a=Q(0,1);
    else a=Q(90,1);

    rep(i,n-1) {
        if(s[i]=='n') {
            a = a + Q(-90,(1LL<<(n-i-1)));
        }
        else {
            a = a + Q(90,(1LL<<(n-i-1)));
        }

    }
    a.tuning();
    if(a.b==1) cout<<a.a<<endl;
    else cout<<a.a<<"/"<<a.b<<endl;

}

int main() {
    while(cin>>input) {
        if(input=="#") break;
        solve();
    }
    return 0;
}

Measured memory_bytes: 1200
import Control.Applicative
import Data.ByteString.Char8 (ByteString)
import qualified Data.ByteString.Char8 as B
import Data.Bool (bool)
import Data.Char (digitToInt)

main :: IO ()
main = solve <$> f >>= putStrLn
  where
    f = head <$> B.words <$> B.getLine

solve :: ByteString -> String
solve bs = bool "No" "Yes" $ r == 0
  where
    r = B.foldl f 0 bs
    f r c = (r + digitToInt c) `mod` 9


Measured memory_bytes: 7176
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int MAX = 2000000;
const int MOD = 998244353;
//
int fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
int COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
signed main() {
 int n,m;
 cin>>n>>m;
 COMinit();
 int ans=n*COM(m+n-2,m)%MOD;
 for(int i=m;3*m-2*i>=0;i++){
     ans=(ans + (COM(i+n-1,i) +(MOD - n*COM(i-m+n-1,i-m)%MOD))*COM(n,3*m-2*i)%MOD)%MOD;
 }
 cout<<ans;
}


Measured memory_bytes: 47104
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


H, W, h, w = map(int, input().split())
v = [[0]*W for _ in range(H)]
if H%h==0 and W%w==0:
    print("No")
else:
    for i in range(H//h):
        for j in range(W//w):
            v[(i+1)*h-1][(j+1)*w-1] = -10**9
    for i in range(H//h+1):
        for j in range(W//w+1):
            if i*h<H and j*w<W:
                v[(i)*h][(j)*w] = 10**9-1
    ss = sum(sum(vv) for vv in v)
    if ss>0:
        print("Yes")
        write("\n".join(" ".join(map(str, vv)) for vv in v))
    else:
        print("No")

Measured memory_bytes: 91572
// editorial
#include<iostream>
#include<map>
using namespace std;

typedef long long ll;

int main(){
    int n, p;
    cin >> n >> p;
    string s;
    cin >> s;
    ll ans = 0;
    if(p == 2 || p == 5){
        for(int i = 0; i < n; i++)  ans += (i+1)*((s[i]-'0')%p==0);
        cout << ans << endl;
        return 0;
    }
    map<int,int> cnt;
    cnt[0]++;
    int acc = 0, ten = 1;
    for(int i = 0; i < n; i++){
        acc = (ten*(s[n-1-i]-'0')+acc)%p;
        ans += cnt[acc];
        cnt[acc]++;
        (ten *= 10) %= p;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 900
/**
 * auther: moririn_cocoa
 */
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <bitset>
#include <stdio.h>
#include <stdlib.h>
using namespace std;

#define rep(i,n) for(int i=0;i<(n);i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define fi first
#define se second
#define ll long long
#define pll pair<ll,ll>
#define pq priority_queue
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))

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;}

int main(int argc, const char * argv[]) {
  
  int A;
  int B;
  int C;
  int D;
  
  cin >> A;
  cin >> B;
  cin >> C;
  cin >> D;
  
  if ( A + C <= A + D && A + C <= B + C && A + C <= B + D ) {
    
    cout << A + C << endl;
  }
  
  else if ( A + D <= A + C && A + D <= B + C && A + D <= B + D ) {
    
    cout << A + D << endl;
  }
  
  else if ( B + C <= A + C && B + C <= A + D && B + C <= B + D ) {
    
    cout << B + C << endl;
  }
  
  else {
    
    cout << B + D << endl;
  }
  
  return 0;
}


Measured memory_bytes: 3620
from itertools import chain


def flatten(list_of_lists):
    return chain.from_iterable(list_of_lists)


N, K = map(int, input().split())
As = []
for _ in range(K):
    d = int(input())
    A = list(map(int, input().split()))
    As.append(A)

As = set(flatten(As))
print(N - len(As))


Measured memory_bytes: 9184
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}




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

int p,q,r;
cin >> p >> q >> r;
 
int ans = min(p+q,min(q+r,r+p));
cout << ans << endl;
return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main(){
 string s,t;
  cin>>s>>t;
  for(int i=0;i<s.size();i++){
    if(s[i]!=t[i]){
      cout<<"No"<<endl;
      return 0;
    }
  }
  cout<<"Yes"<<endl;
  return 0;
}

Measured memory_bytes: 3632
N, W = map(int, input().split())

w = [0 for _ in range(N)]
v = [0 for _ in range(N)]

for i in range(N): w[i], v[i] = map(int, input().split())

dp = [[0 for i in range(W + 1)] for j in range(N + 1)]

for i in range(N):
    
    for sum_w in range(W + 1):
        
        if(w[i] > sum_w):
            dp[i + 1][sum_w] = max(dp[i][sum_w], dp[i + 1][sum_w])
        
        else:
            dp[i + 1][sum_w] = max(dp[i][sum_w], dp[i][sum_w - w[i]] + v[i])
            
print(dp[-1][-1])

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

int main(){
    string str;
    cin >> str;

    int sum = 700;
    int i = 0;
    while(str[i] != '\0'){
        if(str[i] == 'o'){
            sum += 100;
        }
        i++;
    }

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

Measured memory_bytes: 256
K,N = map(int,input().split())
A = list(map(int,input().split()))
d = [0]*N
for i in range(N):
    if(i == 0):
        d[i] = A[0]+(K-A[-1])
    else:
        d[i] = A[i]-A[i-1]
ans = K-max(d)
print(ans)

Measured memory_bytes: 26420
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <iomanip>
using namespace std;

typedef pair<int, int> P;
#define rep(i, n) for (int i=0; i<(n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007

int N, M;
bool F[200000][2];

signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  cin >> N >> M;
  rep(i, M) {
    int a, b;
    cin >> a >> b;
    a--, b--;
    if (a == 0) {
      F[b][0] = true;
    }
    if (b == N-1) {
      F[a][1] = true;
    }
  }
  bool f = false;
  rep(i, N) {
    if (F[i][0] && F[i][1]) f = true;
  }
  if (f) cout << "POSSIBLE\n";
  else cout << "IMPOSSIBLE\n";
  return 0;
}


Measured memory_bytes: 640
#include<stdio.h>
#define VMAX 10000
#define MAX 2000000
int A[MAX];
int B[MAX];

int main(){
  int i,n,j;
  int C[VMAX+1];

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


  for(i = 0;i < VMAX;i++){
    C[i] = 0;
  }

  for(j = 0;j < n;j++){
    C[A[j]]++;
  }
  for(i = 1;i < VMAX;i++){
    C[i] = C[i] + C[i-1];
  }
  for(j = n; j >= 0;j--){
    B[C[A[j]]-1] = A[j];
    C[A[j]]--;
  }

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



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

int main()
{

  int n, m;
  cin >> n >> m;

  if(n == m)
    cout << "Yes";
  else
  {
    cout << "No";
  }
  
}


Measured memory_bytes: 3604
import java.util.*;

class Main {
    public static void main(String args[]) {
        Scanner inp = new Scanner(System.in);
        do_(inp);
        inp.close();
    }
    public static void do_(Scanner inp) {
        int a = inp.nextInt();
        int b = inp.nextInt();
        int c = inp.nextInt();
        int ans = Math.min(Math.min(a + b, b + c), a + c);
        System.out.println(ans);
    }
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main()
{
    int n;
    cin >> n;
    vector<int> a;
    int j = 0;
    for (ll i = 1; i <= n; i++)
    {
        if (i * (i + 1) / 2 >= n)
        {
            j = i;
            break;
        }
    }
    a.push_back(j);
    n -= j;
    for (int i = j - 1; 0 < i; i--)
    {
        if (n - i >= 0)
        {
            a.push_back(i);
            n -= i;
        }
    }
    sort(a.begin(), a.end());
    for (int i = 0; i < a.size(); i++)
    {
        cout << a[i] << (i != n - 1 ? " " : "\n");
    }
}

Measured memory_bytes: 384
import java.util.*;
import java.io.*;

public class Main {

	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		PrintWriter pw = new PrintWriter(System.out);
		int n = sc.nextInt();
		int k = sc.nextInt();
		int q = sc.nextInt();
		int[] arr = sc.nextIntArr(n);
		int ans = (int) 2e9;
		for (int i = 0; i < arr.length; i++) {
			int j = 0;

			ArrayList<Integer> b = new ArrayList<>();
			while (j < n) {
				LinkedList<Integer> a = new LinkedList<Integer>();
				while (j < n && arr[j] >= arr[i]) {
					a.add(arr[j++]);
				}
				if (a.size() >= k) {
					Collections.sort(a);
					while (a.size() >= k) {
						b.add(a.poll());
					}
				}
				j++;
			}
			Collections.sort(b);
			if (b.size() >= q)
				if (b.get(0) == arr[i])
					ans = Math.min(ans, b.get(q - 1) - arr[i]);
		}
		pw.println(ans);
		pw.close();
	}

	static class Scanner {
		BufferedReader br;
		StringTokenizer st;

		public Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}

		public int[] nextIntArr(int n) throws IOException {
			int[] arr = new int[n];
			for (int i = 0; i < n; i++) {
				arr[i] = Integer.parseInt(next());
			}
			return arr;
		}

	}

}


Measured memory_bytes: 49220
using System;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Linq;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using System.Security.Cryptography;

class Program
{
    const string Yes = "Yes";
    const string No = "No";
    const char White = '.';
    const char Black = '#';
    const long Mod = 1000000007;

    static void Main(string[] args) {
#if DEBUG
        MyDebugger.Test(process, "../TextFile1.txt");
#else
        checked {
            object ret = process(new StreamReader(Console.OpenStandardInput()));
            Console.WriteLine(ret);
        }
#endif
    }

    static object process(TextReader input) {
        var n = int.Parse(input.ReadLine());
        var ary = ToIntArray(input.ReadLine(), n);

        //var set = new HashSet<int>(ary);
        
        long x = 0;
        for(int i=0; i<n; i++) {
            x ^= ary[i];
        }

        return x == 0 ? Yes : No;
        //if (n % 3 == 0) {
        //    return x == 0 ? Yes : No;
        //} else {
        //    return ary.Any(z=>z==x) ? Yes : No;
        //}
    }

    static long[] ToIntArray(string strs, int n) {
        var ret = new long[n];
        var spl = strs.Split(' ');
        for (int i = 0; i < n; i++)
            ret[i] = long.Parse(spl[i]);
        return ret;
    }
}


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

int main(){
    long long H, W;
    cin >> H >> W;
    if(H == 1 || W == 1){
        cout << 1 << endl;
    }else if(H % 2 == 0){
        cout << (H / 2) * W << endl;
    }else if(W % 2 == 0){
        cout << H * (W / 2) << endl;
    }else{
        cout << ((H / 2) * (W / 2)) + ((H / 2 + 1) * (W / 2 + 1)) << endl;
    }
    system("pause");
    return 0;
}

Measured memory_bytes: 504
#pragma GCC optimize("O3")

#define _GLIBCXX_DEBUG
#include <iostream>
#include <vector>
#include <string>
#include <string_view>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <cassert>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
using namespace std;

/*----------macros----------*/

//output================
#define endl '\n'
#define fcout(a) cout << fixed << setprecision((int)(a))

//typedef===============
typedef long long       ll;
typedef long double     ld;
typedef vector<int>     Vi;
typedef vector<ll>      Vl;
typedef pair<int, int>  Pii;
typedef pair<ll, ll>    Pll;

//const number==========
constexpr ll INF9   = (ll)1e9 + 1;
constexpr ll INF18  = (ll)1e18 + 1;
constexpr ll MOD1    = 1000000007;
constexpr ll MOD2   = 998244353;
constexpr ld PI     = 3.141592653589793L;

//member================
#define psb push_back
#define epb emplace_back
#define psf push_front
#define mkp make_pair
#define fst first
#define scd second

//others================
#define all(x)          (x).begin(), (x).end()
#define rall(x)         (x).rbegin(), (x).rend()
#define rep(i, n)       for(int i = 0; (i) < (n); ++(i))
#define reps(i, n)      for(int i = 1; (i) <= (n); ++(i))
#define rrep(i, n)      for(int i = n - 1; (i) >= 0 ; --(i))
#define repbit(bit, n)  for(int bit = 0; (bit) < (1 << (n)); ++(bit))
#define ifbit(bit, i)   if((bit) & (1 << (i)))
#define CtoI(c)         int((c)) - int('0')
#define ItoC(c)         char((c) + '0')

//functions=============
template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

//vector<int> dx = {1, 0, -1, 0}, dy = {0, 1, 0, -1};
//vector<int> dx2 = { 1,1,0,-1,-1,-1,0,1 }, dy2 = { 0,1,1,1,0,-1,-1,-1 };

/*--------additional--------*/



/*----------main------------*/

int main() {
/*----------fastio----------*/
    std::cin.tie(nullptr);
    std::cout.tie(nullptr);
    std::ios::sync_with_stdio(false);
/*----------solve-----------*/

    int n; cin >> n;
    int max_a = 0;
    Vi a(n);
    rep(i, n){
        cin >> a[i];
        chmax(max_a, a[i]);
    }

    Vi d; d = a;
    sort(all(d));
    int cnt = 0;
    rep(i, n){
        if(d[i] == max_a){
            ++cnt;
            d[i] = 0;
        }
    }

    sort(all(d));

    if(cnt == 1){
        rep(i, n){
            if(a[i] != max_a)
                cout << max_a << endl;
            else cout << d[n-1] << endl;
        }
    }

    else if(cnt >= 2){
        rep(i, n){
            cout << max_a << endl;
        }
    }

return 0;
}

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

using int32 = int_fast32_t;
using int64 = int_fast64_t;

const int32 INF = 1e9;
const int32 MOD = 1e9+7;
const int64 LLINF = 1e18;

#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define POSSIBLE cout << ((n) ? "POSSIBLE\n" : "IMPOSSIBLE\n"  )
#define ANS(n) cout << (n) << "\n"
#define REP(i,n) for(int64 i=0;i<(n);++i)
#define FOR(i,a,b) for(int64 i=(a);i<(b);i++)
#define FORR(i,a,b) for(int64 i=(a);i>=(b);i--)
#define ALL(obj) (obj).begin(),(obj).end()
#define pii pair<int32,int32>
#define pll pair<int64,int64>
#define pb(a) push_back(a)

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int32 a;
  string s;
  cin >> a >> s;
  if(a >= 3200){
    ANS(s);
  }else{
    ANS("red");
  }
  return 0;
}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;

public class Main{
    public static void main(String[] args)throws Exception{
        Scanner sc=new Scanner(System.in);
        int x=sc.nextInt(),y=sc.nextInt(),z=sc.nextInt();
        System.out.printf("%d %d %d\n",z,x,y);
    }
}

Measured memory_bytes: 23636
#include<stdio.h>
int main()
{
  int N;
  int A[1000];
  int i,j,k,v;

  scanf("%d",&N);
  for(i=0;i<N;i++){
    scanf("%d",&A[i]);
  }
  for(i=0;i<N-1;i++){
  printf("%d ",A[i]);
  }
  printf("%d\n",A[N-1]);
  
  for(i=1;i<=N-1;i++){
    v = A[i];
    j=i-1;
    while(j>=0 && A[j]>v){
      A[j+1] = A[j];
      j--;
      A[j+1]=v;
    }
    for(k=0;k<N-1;k++){
      printf("%d ",A[k]);
    }
    printf("%d\n",A[N-1]);
  } 
   return 0;
}



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

int main()
{
  int n;
  cin >> n;
  int A[n];
  int rev[n];
  rep(i, n) cin >> A[i];
  rep(i, n) rev[A[i] - 1] = i + 1;
  rep(i, n) cout << rev[i] << " ";
  cout << endl;
}


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

int main(){
	int n; cin >> n;
	vector<int> a(n);
	rep(i,n) cin >> a[i];
	deque<int> d;
	rep(j,n){
		int i = lower_bound(d.begin(), d.end(), a[j]) - d.begin();
		if(i == 0){
			d.push_front(a[j]);
		}else{
			d[i-1] = a[j];
		}
	}
	int ans = d.size();
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 4052
#include <stdio.h>

int main(void){
    int N, i, j, k, v;

    scanf("%d", &N);

    int A[N];
    for(i = 0; i < N; i ++) scanf("%d", &A[i]);
    for(i = 0; i < N - 1; i ++) printf("%d ", A[i]);
    printf("%d\n", A[N-1]);

    for(i = 1; i < N; i ++) {
        v = A[i];
        j = i - 1;
        while(j >= 0 && A[j] > v) {
            A[j+1] = A[j];
            j --;
            A[j+1] = v;
        }

        for(k = 0; k < N - 1; k ++) printf("%d ", A[k]);
        printf("%d\n", A[N-1]);

    }
    return 0;
}

Measured memory_bytes: 1816
s = input()
n = len(s)
gcount = 0
pcount = 0
score = 0
for i in range(n):
    if s[i] == "g":
        if gcount > pcount:
            pcount += 1
            score += 1
        else:
            gcount += 1
    else:
        if gcount > pcount:
            pcount += 1
        else:
            gcount += 1
            score -= 1
print(score)

Measured memory_bytes: 9204
MOD = 10**9+7
n = int(input())
x = list(map(int, input().split()))
g = [0]
for i in range(n-1):
	g.append(x[i+1]-x[i])
ans = 0
coef = 0
for i in range(1, n):
	coef += pow(i, MOD-2, MOD)
	ans += coef * g[i]
	ans %= MOD
for i in range(1, n):
	ans *= i
	ans %= MOD
print(ans)

Measured memory_bytes: 14252
#include <bits/stdc++.h>
#define endl '\n'
#define ll long long
using namespace std;


int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	ll t;
	string j;
	cin>>t>>j;
	string jol="";
	for(auto i:j){
		if(i!='.'){
			jol+=i;
		}
	}
	int pal= stoi(jol);
	unsigned ll hwya=t*pal/100;
	cout<<hwya<<endl;
	return 0;
}


Measured memory_bytes: 3644
import re
n,m = map(int, input().split())
a = [input().strip() for i in range(n)]
b = [input().strip() for i in range(m)]

mc = n-m+1
ans = False
for ai in range(0, mc):
  if(ans):
    break
  ind = [x.start() for x in re.finditer(b[0], a[ai])]
  if(m==1)and(len(ind)>0):
    ans=True
    break  
  for i in ind:
    if(ans):
      break
    for bi in range(1, m):
      if(a[ai+bi][i:i+m] != b[bi]):
        break
      if(bi==m-1):
        ans = True
        break
if(ans):
  print('Yes')
else:
  print('No')

Measured memory_bytes: 3188
#include <stdio.h>
int main(){
    int M,N,sum=0;
        char str[100];
    scanf("%s",str);
    for(int i=0;i<100;i++){
        if(str[M=i]=='\0')break;
        else sum+=1;
    };
    N=sum-2;
    printf("%c%d%c\n",str[0],N,str[M-1]);
    return 0;
}


Measured memory_bytes: 128
import java.util.*;

public class Main{
	public static void main(String args[]) {

		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		HashSet<String> hs = new HashSet<>();
		for(int i = 0; i < N; i++) {
			hs.add(sc.next());
		}
		System.out.println(hs.size());
	}
}

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

#define READ freopen("alu.txt", "r", stdin);
#define WRITE freopen("vorta.txt", "w", stdout);
#define INFLOOP puts("lup");getchar()
#define xx first
#define yy second

typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<int>::iterator vi_i;
typedef pair<double, double> pff;

const int MAX = 2e5 + 5;

ll arr[MAX];

int main()
{
	int n;
	scanf("%d", &n);
	for(int i = 0; i < n; i++) scanf("%lld", &arr[i]);	
	for(int i = 1; i < n; i++) arr[i] += arr[i - 1];
	ll sum = arr[n - 1];
	ll dif = 10000000000;
	for(int i = 0; i < n - 1; i++){
		ll a = arr[i];
		ll b = sum - arr[i];
		dif = min(dif, abs(a - b));
	}
	printf("%lld", dif);

    return 0;
}


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

int main() {
  int A, B, C, D;
	cin >> A >> B  >> C >> D;
     
  int E = A / D ;
  int F = C / B ;
  
  if(A % D > 0){
    E++;
  }
  if(C % B > 0){
    F++;
  }
  
  if(E >= F){
    cout << "Yes" <<endl;
  }
  else{
    cout << "No" <<endl;
  }
  
}


Measured memory_bytes: 3648
import java.util.Scanner;

public class Main {
	public static void main(String[] args)
	{
		Scanner scan = new Scanner(System.in);
		int height = scan.nextInt();
		int width = scan.nextInt();
		
		while(height != 0 || height != 0)
		{
			for(int i = 0;i < height;i++)
			{
				for(int j = 0;j < width;j++)
				{
					if(i == 0 || i == height - 1)
					{
						System.out.print("#");
					}else if(j == 0 || j == width - 1){
						System.out.print("#");
					}else{
						System.out.print(".");
					}
					
				}
				System.out.println("");
			}
			System.out.println("");
			height = scan.nextInt();
			width = scan.nextInt();
		}
	}
}

Measured memory_bytes: 25712
#include <iostream>
#include <cmath>

using namespace std;
typedef unsigned long long ullong;

ullong power(ullong n, ullong m, ullong x) {
    ullong res = 1;
    if (m == 1) {
        return n;
    } else {
        res = power(n, m/2, x);
        if (m % 2 == 0) {
            res =  res * res % x;
        } else {
            res = ((res * res) % x) * n % x;
        }
    }
    return res;
}


int main() {
    int n, m;
    cin >> n >> m;
    cout << power(n,m,1000000007) << endl;
    return 0;
}


Measured memory_bytes: 3072
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main()
{
    ll i, x, cnt;
    cin >> x;
    i = 100;
    cnt = 0;
    while(i < x){
        i += i/100;
        cnt++;
    }
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
template<typename T> istream& operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename T> ostream& operator<<(ostream &os, vector<T> &vec){ os << "["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream& operator<<(ostream &os, set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream& operator<<(ostream &os, unordered_set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream& operator<<(ostream &os, multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream& operator<<(ostream &os, unordered_multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T1, typename T2> ostream& operator<<(ostream &os, pair<T1, T2> &pa){ os << "(" << pa.first << "," << pa.second << ")"; return os; }
template<typename TK, typename TV> ostream& operator<<(ostream &os, map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename TK, typename TV> ostream& operator<<(ostream &os, unordered_map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename T> void ndarray(vector<T> &vec, int len) { vec.resize(len); }
template<typename T, typename... Args> void ndarray(vector<T> &vec, int len, Args... args) { vec.resize(len); for (auto &v : vec) ndarray(v, args...); }
#define dbg(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ") " << __FILE__ << endl;

string S;

int main()
{
    cin >> S;
    int ans = 753;
    REP(i, S.size() - 2)
    {
        int a = (S[i] - '0') * 100 + (S[i + 1] - '0') * 10 + S[i + 2] - '0';
        ans = min(ans, abs(753 - a));
    }
    cout << ans << endl;
}


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

#define LL long long
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ALL(x) (x).begin(),(x).end()
const int IINF = 1e9;
const LL LINF = 1e18;
const LL mod = 1e9+7;

int main() {
    int A, B, C, X, Y;
    cin >> A >> B >> C >> X >> Y;

    int res = 0;
    if(A + B > 2*C) {
        int d = min(X, Y);
        res += d*2*C;
        X -= d;
        Y -= d;
    }
    if(A > 2*C) {
        int d = X;
        res += d*2*C;
        X = 0;
        Y -= min(d, Y);
    }
    if(B > 2*C) {
        int d = Y;
        res += d*2*C;
        Y = 0;
        X -= min(d, X);
    }
    res += A*X + B*Y;
    cout << res << endl;
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pll = pair<ll,ll>;
const ll LINF = 0x1fffffffffffffff;
#define name3(_1,_2,_3,name,...) name
#define rep1(n) for(ll i=0;i<(n);++i)
#define rep2(i,n) for(ll i=0;i<(n);++i)
#define rep3(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(...) name3(__VA_ARGS__,rep3,rep2,rep1)(__VA_ARGS__)
#define rrep(i,a,b) for(ll i=(b)-1;i>=(a);i--)
#define each(i,a) for(auto &i : a)
#define sum(a) accumulate(all(a), 0LL)
#define all(i) begin(i), end(i)
template<class T, class U> inline bool chmin(T &a, const U &b){ if(a > b) { a = b; return 1; } else return 0; }
template<class T, class U> inline bool chmax(T &a, const U &b){ if(a < b) { a = b; return 1; } else return 0; }


int main(){
    ll n, C;
    cin >> n >> C;
    vector<vector<ll>>dp(C+1, vector<ll>(10001,-LINF));
    dp[0][0]=0;
    rep(n){
        ll a, b, c;
        cin >> a >> b >> c;
        rrep(i,c,C+1){
            rep(j,a,10001)chmax(dp[i][j],dp[i-c][j-a]+b);
            rep(j,b,10001)chmax(dp[i][j],dp[i-c][j-b]+a);
        }
    }
    ll ans=0;
    rep(C+1)rep(j,10001)chmax(ans,min(j,dp[i][j]));
    cout << ans << endl;
}



Measured memory_bytes: 10804
#include <algorithm>
#include <iostream>
#include <vector>
#include <array>
#include <string>
#include <cmath>
#include <iomanip>
#include <set>
#include <map>
#include <climits>
#include <utility>
#include <deque>
#include <list>
#include <stdexcept>
//#include <boost/graph/adjacency_list.hpp>
using namespace std;

int main()
{
	cout << fixed << setprecision(6);
	int a, b;
	cin >> a >> b;
	/*vector<unsigned> als(n);
	for (auto a : als) cin >> a;*/
	if (a > b)swap(a, b);
	int k = a + (b - a) / 2;
	cout << ((b - a) % 2 == 0 ? to_string(k) : "IMPOSSIBLE") << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
long long S, dp[20001];
main() {
	cin >> S;
	dp[0]=1;
	for (int i = 1; i <= S; i++) {
		for (int j = i; j >= 3; j--) {
			dp[i] += dp[i - j];
			if (dp[i] > (long long)(1e9+7)) 
				dp[i] -= (long long)(1e9+7);
		}
	}
	cout << dp[S];
}
// 1729

Measured memory_bytes: 3576
#include<bits/stdc++.h>
using namespace std;
int lastans,ose[10005][15],r,c;
string a="0",b="1";
map <string, int> inf;
struct check {
    int wa[10005];
};
void solve(struct check pp,int dp,string str);


int main(){
        struct check po;
    while(1){
        for(int i=0;i<10005;i++)po.wa[i]=0;
        lastans=0;
        fill(ose[0],ose[10004],0);
        //inf.clear();

        cin >> r >> c;
        if(r==0&&c==0)break;

        for(int i=0;i<r;i++){
            for(int j=0;j<c;j++){
                cin >> ose[j][i];
                po.wa[j]+=ose[j][i];
            }
        }
        //for(int i=0;i<c;i++)cout << " " << po.wa[i];
        //cout << endl;
        solve(po,0,"");
        cout << lastans << endl;

    }
return 0;
}

void solve(struct check pp,int dp,string str){
    int ans1=0,ans2=0;
    if(dp==r)return;
    else{
        for(int i=0;i<c;i++){
            ans1+=max(pp.wa[i],r-pp.wa[i]);
        }
        //cout << "ans=" << ans1 << endl;
        lastans=max(ans1,lastans);
        solve(pp,dp+1,str+a);

        for(int i=0;i<c;i++){
            if(ose[i][dp]==0)pp.wa[i]++;
            else pp.wa[i]--;
        }
        for(int i=0;i<c;i++){
            ans2+=max(pp.wa[i],r-pp.wa[i]);
        }
        //cout << "ans2=" << ans2 << endl;
        lastans=max(ans2,lastans);
        solve(pp,dp+1,str+b);

    }
    return;
}

Measured memory_bytes: 3980
#include<string>
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
using namespace std;
typedef long long int llint;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
const llint mod=1000000007;
const llint big=1e9+1e8;
const llint red=0xE869120;
const llint pro=1002001;
//2n C n
int main(void){
	llint n,a,b,i,j,bmax=big,bmin=0,bgen,ex;
	vector<llint> hp;
	cin>>n>>a>>b;
	hp.res(n);
	for(i=0;i<n;i++){cin>>hp[i];}
	sort(hp.rbegin(),hp.rend());
	while(bmax-bmin>1){
		bgen=(bmax+bmin)/2;
		ex=0;
		for(i=0;i<n;i++){
			if((hp[i]-b*bgen+a-b-1)/(a-b)<=0){break;}
			ex+=(hp[i]-b*bgen+a-b-1)/(a-b);
		}
		if(ex<=bgen){bmax=bgen;}
		else{bmin=bgen;}
	}
	cout<<bmax<<endl;
	return 0;
}


Measured memory_bytes: 1152
#include<iostream>
using namespace std;
int main(){
    int A,B;
    cin>>A>>B;
    if(A==1&&B==2)cout<<3<<endl;
    if(A==2&&B==3)cout<<1<<endl;
    if(A==3&&B==1)cout<<2<<endl;
    if(A==2&&B==1)cout<<3<<endl;
    if(A==3&&B==2)cout<<1<<endl;
    if(A==1&&B==3)cout<<2<<endl;
}

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

int main(void)
{
    int x, n;
    cin >> x >> n;
    vector<int> p(n);
    rep(i, n) cin >> p[i];
    if (n == 0) {
        cout << x << endl;
        return 0 ;
    }

    //sort(p.begin(), p.end());
    bool flag = false;
    bool downFlag, upFlag;
    int adjust = 1;
    int up, down;
    rep (i, n) {
        if (p[i] == x){
            flag = true;
            break;
        }
    }
    if (!flag) {
        cout << x << endl;
        return 0;
    }
    while (flag) {
        downFlag = true;
        down = x - adjust;
        rep(i, n) {
            if (p[i] == down) 
            {
                downFlag = false;
                break;
            }
        }
        if (downFlag) {
            cout << down << endl;
            return 0;
        }

        upFlag = true;
        up = x + adjust;
        rep(i, n){
            if (p[i] == up) 
            {
                upFlag = false;
                break;
            }
        }
        if (upFlag) {
            cout << up << endl;
            return 0;
        }
        adjust++;
    }

}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
const int INF = 1000000000;
#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);++i)
#define rep(i,n) REP(i, 0, n)

int w[101][101];
int N, M, ans;
vector<int> use;
void dfs(int depth) {
    if(depth == N) {
        if(use.size() < 2) return;
        int sum = 0;
        for(int& k : use) {
            int mi = INF;
            for(int& l : use) if(k != l)
              mi = min(mi, w[k][l]);
            sum += mi;
        }
        ans = max(ans, sum);
        return;
    }
    bool ok = true;
    for(int& k : use) if(!w[k][depth]) ok = false;
    dfs(depth + 1);
    if(ok) {
        use.push_back(depth);
        dfs(depth + 1);
        use.pop_back();
    }
    return;
}
int main() {
    scanf("%d%d", &N, &M);
    int u_, v_, w_;
    memset(w, 0, sizeof(w));
    rep(i, M) {
        scanf("%d%d%d", &u_, &v_, &w_);
        --u_; --v_;
        w[u_][v_] = w[v_][u_] = w_;
    }
    ans = 0; 
    dfs(0);
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 3296
#include <iostream>
#include <algorithm>
#include <numeric>
#include <cstdio>

using namespace std;


long long load(unsigned long long w[], int n, int k, unsigned long long p)
{
    int trucks_left = k - 1;
    unsigned long long space = p;
    int i;
    for (i = 0; i < n; ) {
        if (space < w[i] && trucks_left == 0)
            break;

        if (space < w[i] && trucks_left > 0) {
            trucks_left--;
            space = p;
        }
        if (space >= w[i]) {
            space -= w[i++];
        }
    }

    if (i == n && trucks_left >= 0) // remains
        return (trucks_left * p) + space;
    else // shortage
        return -1 * accumulate(w + i, w + n, 0);
}


int check(unsigned long long w[], int n, int k, unsigned long long p)
{
    long long tmp = load(w, n, k, p);
    if (tmp < 0) { // short
        return -1;
    }

    long long prev = load(w, n, k, p - 1);
    if (prev >= 0){ // too much
        return 1;
    }

    return 0;
}


int bin_search(unsigned long long w[], int n, int k)
{
    unsigned long long m, l, r;
    l = 0;
    r = 100000 * 10000;
    m = (l + r) / 2;

    int tmp;
    while ((tmp = check(w, n, k, m)) != 0 && l != r) {
        if (tmp > 0) { // too much
            r = m;
        } else if (tmp < 0) { // short
            l = m + 1;
        }
        m = (l + r) / 2;
    }
    return m;
}


int main()
{
    int n, k;
    unsigned long long w[100000];

    cin >> n;
    cin >> k;
    for (int i = 0; i < n; i++)
        scanf("%llu", w + i);
    int out = bin_search(w, n, k);
    cout << out << endl;

    return 0;
}


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

int main() {
  int N, K, d;
  cin >> N >> K;
  
  vector<bool> v(N, false);
  for(int i = 0; i < K; i++){
    cin >> d;
    for(int j = 0; j < d; j++){
      int a;
      cin >> a;
      v.at(a-1) = true;
    }
  }
  
  int ans = 0;
  for (int m = 0; m < N; m++ ) {
    if (v.at(m) == false) ans++;
  }
  
  cout << ans << endl;
  
}

Measured memory_bytes: 3520
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>
#define ll long long int
#define lim 100010
#define INF 1e9
#define mod 1000000007
#define MIN(x,y) ((x)<(y)?(x):(y))
#define MAX(x,y) ((x)<(y)?(y):(x))
#define ABS(x) ((x)>0?(x):-(x))

int main(void){
	int n;
	scanf("%d",&n);
	int w[101];
	int sum=0;
	for(int i=0;i<n;i++){
		scanf("%d",&w[i]);
		sum+=w[i];
	}
	int ans=sum;
	for(int i=0;i<n;i++){
		ans = MIN(ans,ABS(sum-2*w[i]));
		sum-=2*w[i];
	}
	printf("%d",ans);
	return 0;
}

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

#define rep(i, a) for (int i = 0; i < (a); ++i)
#define REP(i, a, b) for (int i = (a); i < (b); ++i)
#define FORV(a, A) for (auto &a : A)

using namespace std;
using ll = long long;
using P = pair<int, int>;
const ll INF = ll(1e10)+1;

void Main() {
  int n; // 5e5
  cin >> n;
  string s;
  cin >> s;
  set<int> M[26];
  rep(i, n) {
    M[s[i]-'a'].insert(i);
  }

  int q; // 2e4
  cin >> q;
  rep(_, q) {
    int f;
    cin >> f;
    if (f==1) {
      int i;char c;
      cin >> i >> c;
      i--;
      if (s[i] == c) continue;
      M[s[i]-'a'].erase(i);
      s[i] = c;
      M[c-'a'].insert(i);
    } else {
      int l, r;
      cin >> l >> r;
      l--; r--;
      int score = 0;
      rep(i, 26) {
        if (M[i].empty()) continue;
        auto itr = M[i].lower_bound(l);
        if (itr == M[i].end()) continue;
        if (r >= *itr) {
          score++;
        }
      }
      cout << score << endl;
    }
  }
}

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

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

N, = map(int, input().split())

ans = 10 ** 18
for i in range(1, N):
    a = sum(map(int, list(str(i))))
    b = sum(map(int, list(str(N - i))))
    ans = min(ans, a + b)

print(ans)

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

using namespace std;
typedef unsigned int uint;
typedef long long int ll;
typedef unsigned long long int ull;

#define debugv(v) printf("L%d %s => ",__LINE__,#v);for(auto e:v){cout<<e<<" ";}cout<<endl;
#define debugm(m) printf("L%d %s is..\n",__LINE__,#m);for(auto v:m){for(auto e:v){cout<<e<<" ";}cout<<endl;}
#define debuga(m,w) printf("L%d %s is => ",__LINE__,#m);for(int x=0;x<(w);x++){cout<<(m)[x]<<" ";}cout<<endl;
#define debugaa(m,w,h) printf("L%d %s is..\n",__LINE__,#m);for(int y=0;y<(h);y++){for(int x=0;x<(w);x++){cout<<(m)[x][y]<<" ";}cout<<endl;}
#define ALL(v) (v).begin(),(v).end()
#define BIGINT 0x7FFFFFFF
#define E107 1000000007

template<typename T1,typename T2>
ostream& operator <<(ostream &o,const pair<T1,T2> p){o<<"("<<p.first<<":"<<p.second<<")";return o;}

int n,len;
int himo[100001];

int main(){
    int i,j,k,l;
    
    cin>>n>>len;
    
    int point=-1;
    
    int last=-BIGINT;
    for (i=1;i<=n;i++){
        scanf("%d",&k);
        himo[i]=k;
        if (len<=last+k) point=i-1;
        last=k;
    }
    
    if (point==-1){
        puts("Impossible");
        return 0;
    }
    
    puts("Possible");
    for (i=1;i<point;i++){
        cout<<i<<endl;
    }
    for (i=n-1;point<=i;i--){
        cout<<i<<endl;
    }
    
    //debuga(himo,n+1)

    return 0;
}

Measured memory_bytes: 1152
// https: //onlinejudge.u-aizu.ac.jp/courses/lesson/8/ITP2/4/ITP2_4_A
#include <iostream>
#include <vector>
#include <algorithm>

int main()
{
    int n;
    std::cin >> n;

    std::vector<int> A(n);
    for (auto &x : A)
    {
        std::cin >> x;
    }

    int q;
    std::cin >> q;

    for (int i = 0; i < q; i++)
    {
        int b, e, t;
        std::cin >> b >> e >> t;

        std::swap_ranges(A.begin() + b, A.begin() + e, A.begin() + t);
    }

    for (auto itr = A.begin(); itr != A.end(); itr++)
    {
        std::cout << *itr;
        if (itr + 1 != A.end())
        {
            std::cout << " ";
        }
    }
    std::cout << std::endl;

    return 0;
}



Measured memory_bytes: 3100
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.util.*;

public class Main {

    private int N;
    private long[] lucaArray;

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

    void run() {
        Scanner sc = new Scanner(System.in);
        N = sc.nextInt();
        lucaArray = new long[N+1];

        System.out.println(Luca(N));
    }

    long Luca(int count){
        if(count == 0){
            return 2;
        } else if(count == 1){
            return 1;
        } else if (lucaArray[count] != 0){
            return lucaArray[count];
        } else {
            lucaArray[count] = Luca(count - 1) + Luca(count-2);
            return lucaArray[count];
        }
    }
}

Measured memory_bytes: 23764
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main(void){
    // Your code here!
    long long s;
    vector<long long> seq;
    
    cin >> s;
    seq.push_back(s);
    
    long long i = 0;
    while(true){
        if(seq[i] % 2 == 0)
            seq.push_back(seq[i] / 2);
        else
            seq.push_back(3 * seq[i] + 1);
            
        i++;
            
        bool do_exit = false;
        for(int j = 0; j < i; j++)
            if(seq[i] == seq[j]){
                do_exit = true;
                break;
            }
        
        if(do_exit)
            break;
    }
    
    cout << i + 1 << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<vector>
#include<deque>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<algorithm>
#include<functional>
#include<utility>
#include<bitset>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<cstdio>

using namespace std;

#define REP(i,n) for(int i=0;i<int(n);i++)
#define foreach(c,itr) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
typedef long long ll;
typedef pair<int,int> P;

#define T 100010
#define INF (1<<31)-1
int n,tree[4*T];

void init(int N){
  n=1;
  while(n<N) n*=2;
  REP(i,2*n-1) tree[i]=INF;
}

void update(int k, int a){
  k+=n-1;
  tree[k]=a;
  while(k>0){
    k=(k-1)/2;
    tree[k]=min(tree[2*k+1], tree[2*k+2]);
  }
}

int query(int a, int b, int k, int l, int r){
  if(r<=a || b<=l) return INF;
  if(a<=l && r<=b) return tree[k];
  else return min(query(a,b,2*k+1,l,(l+r)/2),query(a,b,2*k+2,(l+r)/2,r));
}

int main(void){
	int i;

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

	int q;
    cin >> n >> q;
    init(n);
    for (i=0;i<q;i++){
        int com,x,y;
        cin >> com >> x >> y;
        if(com==0){
            update(x,y);
        }else{
            cout << query(x,y+1,0,0,n) << endl;
        }
    }

	return 0;
}

Measured memory_bytes: 2224
N = int(input())
A = list(int(input()) for i in range(N))
A.sort()
count = 0
for i in range(N-1):
    if A[i] == A[i+1]:
        A[i] = A[i+1] = 0
for i in range(N):
    if A[i] != 0:
        count += 1
print(count)

Measured memory_bytes: 7468
#include <iostream>
#include <iomanip>
#include <sstream>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <functional>
#include <iterator>
#include <limits>
#include <numeric>
#include <utility>
#include <cmath>
#include <cassert>
#include <cstdio>
 
// #include <unordered_set>
// #include <unordered_map>
 
#define rep(i, a, n) for(int i = a; i < n; i++)
#define REP(i, n) rep(i, 0, n)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).rbegin(),(c).rend())
 
#define pb push_back
#define mp make_pair
 
int gcd(int a,int b){int c;while(b!=0){c=a%b;a=b;b=c;}return a;}
int lcm(int a,int b){int c=gcd(a,b);a/=c;return a*b;}
 
typedef std::pair<int, int> P;
typedef long long ll;
typedef long double ld;
 
const int MOD = 1000000007;
const int INF = 1e9;
const ll LINF = INF * 1ll * INF;
const ld DINF = 1e200;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
 
using namespace std;
 
#define int long long
 
signed main(){
  
 
    ios::sync_with_stdio(false);
    cin.tie(0);
    //cin高速化

    int n;
    cin>>n;

    std::vector<int> a;
    std::vector<int> b;
    std::vector<int> c;

    int tmp;

    REP(i,n){
        cin>>tmp;
        a.pb(tmp);

    }

    REP(i,n){
        cin>>tmp;
        b.pb(tmp);
    }
    
    REP(i,n){
        cin>>tmp;
        c.pb(tmp);
    }

    sort(a.begin(),a.end());
    sort(b.begin(),b.end());
    sort(c.begin(),c.end());


    // REP(i,n){
    //     cout<<a[i]<<" ";
    // }cout<<endl;

    // REP(i,n){
    //     cout<<b[i]<<" ";
    // }cout<<endl;

    // REP(i,n){
    //     cout<<c[i]<<" ";
    // }cout<<endl;

    int A,C;

    int ans=0;

    REP(i,n){
        A=lower_bound(a.begin(), a.end(),b[i])-a.begin();
        C=n-(upper_bound(c.begin(), c.end(),b[i])-c.begin());

        // cout<<A<<" "<<C<<endl;

        ans+=A*C;
    }
    cout<<ans<<endl;


    return 0;
 
}

Measured memory_bytes: 3952
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>

using namespace std;

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

int main()
{
    int s[100001];
    int n, q, key;
     
    cin >> n;
    REP(i, n) cin >> s[i];
    cin >> q;
 
    int sum = 0;
    REP(i, q)
    {
        cin >> key;
        if(*lower_bound(s, s + n, key) == key) sum++;
    }
    cout << sum << endl;
}

Measured memory_bytes: 3352
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>


using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

class B105 {
public:
    void solve(std::istream& cin, std::ostream& cout) {
        int n;
        int ans = 0;
        //string ans = "";
        cin >> n;

        for(int j=1; j<=n; j++){
            if(j%2==0) continue;
            int count = 0;

            for(int i=1; i<=j; i++){
                if(j%i == 0){
                    count++;
                }
            }
            if(count == 8){
                ans++;
            }
        }

        cout << ans << endl;
    }
};


int main() {
	B105 solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 256