akhauriyash/Code-Regression huggingface dataset:
L = [[0 for x in range(4)] for y in range(2)]

while True:
    try:
        E = [ float(x) for x in input().split()]
        for i in range(2):
            if E[i] >= 1.1:
                L[i][0] += 1
            elif E[i] >= 0.6:
                L[i][1] += 1
            elif E[i] >= 0.2:
                L[i][2] += 1
            else:
                L[i][3] += 1
            
    except EOFError:
        break

for i in range(4):
    print(L[0][i], L[1][i])





Measured memory_bytes: 5580
#include <iostream>
using namespace std;
int main(){
      int a,b;
      while(1){
          cin>>a>>b;
          if(a==0 && b==0)break;
          if(a>b){
              cout<<b<<" "<<a<<endl;
          }else{
              cout<<a<<" "<<b<<endl;
          }
      }
 
    
}

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

#define EPS (1e-10)
#define rep(i, a, b) for (int i = a; i < (int)(b); ++i)
#define rrep(i, a, b) for (int i = b - 1; i >= (int)(a); --i)
#define all(a) a.begin(), a.end()

using namespace std;
using ll = long long;
using vi = vector<int>;
using vb = vector<bool>;
using vll = vector<ll>;
using vd = vector<double>;
using vvi = vector<vi>;
using vvb = vector<vb>;

constexpr int MOD = 1000000007;

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

    int n;
    cin >> n;

    vi a(n);
    rep(i, 0, n) { cin >> a[i]; }

    vi dp(n, INT_MAX);
    rep(i, 0, n) { dp[distance(dp.begin(), upper_bound(all(dp), -a[i]))] = -a[i]; }
    cout << distance(dp.begin(), lower_bound(all(dp), INT_MAX)) << endl;

    return 0;
}

Measured memory_bytes: 1024
#include<stdio.h>
 
int main(){
   
  int a[100],i,n,j,minj,s,count=0;
   
  scanf("%d",&n);
 
  for(i=0;i<n;i++)
    scanf("%d",&a[i]);
   
  for(i=0;i<n;i++){
    minj = i;
    for(j=i;j<n;j++){
      if(a[j]<a[minj]){
    minj = j;
      }
    }
    if(a[i]>a[minj]){
    s = a[i];
    a[i] = a[minj];
    a[minj] = s;
    count++;
    }
  }
   
  for(i=0;i<n;i++){
    printf("%d",a[i]);
      if(i==n-1){
    printf("\n");
    break;
      }
      printf(" ");
  }
   
  printf("%d\n",count);
  return 0;
}

Measured memory_bytes: 604
#include <stdio.h>
int main(){
  char a[4],b[4];
  scanf("%s%s",a,b);
  if(a[0]==b[2])if(a[1]==b[1])if(a[2]==b[0]){
    puts("YES");
    return 0;
  }
  puts("NO");
  return 0;
}

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

using namespace std;
typedef long long int ll;
typedef pair<ll, ll > pi;  
typedef pair<pair<ll, ll >, ll > pii;  
vector<ll > vec;
vector<vector<ll > > vec2;
ll MOD = 1000000007;

int main(){

    ll N;
    cin >> N;

    vector<ll > ans; 

    vector<pii > input;

    for(ll i = 0; i < N - 1; i++){
        ll c, s, f; cin >> c >> s >> f;
        input.push_back(make_pair(make_pair(c, s), f));
    }

    for(ll i = 0; i < N; i++){
        ll time = 0;
        //cout << i << endl;
        for(ll j = i; j < N - 1; j++){
            ll c = input[j].first.first;
            ll s = input[j].first.second;
            ll f = input[j].second;

            //出発タイミング
            if(time < s){
                time = s;
            }else if(time % f == 0){
                //すぐ出発できる
            }else{
                time = time + f - (time % f);
            }

            time += c;

        }
        ans.push_back(time);

    }

    ans.push_back(0);


    for(ll i = 0; i < N; i++){
        cout << ans[i] << endl;
    }

}

Measured memory_bytes: 256
import           Control.Monad
import qualified Control.Monad.ST            as ST
import qualified Data.ByteString.Char8       as BS
import           Data.Maybe
import qualified Data.Vector.Unboxed         as V
import qualified Data.Vector.Unboxed.Mutable as VM

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine

-- generates a vector of prime numbers <= n
primes n = ST.runST $ do
    v <- VM.new (n+1)
    VM.write v 0 0
    VM.write v 1 0
    forM_ [2..n] $ \i -> VM.write v i i
    let sqrtN = ceiling $ sqrt $ fromIntegral n
    forM_ [2..sqrtN] $ \i -> do
      x <- VM.read v i
      when (x > 0) (forM_ [2..(n`div`i)] $ \j -> VM.write v (i*j) 0)
    v' <- V.freeze v
    return $ V.filter (> 0) v'

bisectLeft :: Ord a => (Int -> a) -> a -> Int -> Int -> Int
bisectLeft f x lo hi
  | lo >= hi  = lo
  | f mid < x = bisectLeft f x (mid+1) hi
  | otherwise = bisectLeft f x lo mid
  where
    mid = lo + (hi - lo) `div` 2

main = do
  q <- getInt

  d <- VM.new (10^5 + 1)
  VM.write d 0 (0::Int)

  let ps = primes (10^5)

      isPrime x = let i = bisectLeft (\i -> ps V.! i) x 0 (V.length ps - 1)
                  in x == ps V.! i

      like2017 x = isPrime x && isPrime ((x+1) `div` 2)

      prepD :: Int -> Int -> IO ()
      prepD i n | i > 10^5 = return ()
                | otherwise = do
                    let n' = n + if like2017 i then 1 else 0
                    VM.write d i n'
                    prepD (i+1) n'

  prepD 1 0

  replicateM_ q $ do
    [l, r] <- getIntList
    x <- VM.read d (l-1)
    y <- VM.read d r
    print (y-x)

Measured memory_bytes: 3836
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define allr(x) (x).rbegin(), (x).rend()
#define pb push_back
#define ff first
#define ss second
#define ll long long
#define ld long double
#define pll pair<ll,ll>
#define ppll pair<pll,ll>
#define vi vector <pll>
#define out(x) return cout<<x,0;
#define precision(x,d) cout<<fixed<<setprecision(d)<<x
#define f(i,x,n) for(ll i=x;i<n;i++)
#define lc(n) 2*n+1
#define rc(n) 2*n+2
#define fill(a,b) memset((a),(b),sizeof((a)))
#define FAST ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);srand(time(NULL));
ll power(ll x,ll y,ll m){ll r=1;for(;y;y>>=1){if(y&1)r=r*x%m;x=x*x%m;}return r;} 
const ll N = 2e5 + 5, M = 1e9 + 7;

int main(){
    FAST;
    ll n, x = 0, m, k, i, t, ans = 0, j, y = 0, z = 0, c = 0;
    cin >> x >> y >> n >> m >> k;
    vi v;
    f(i, 0, n){
        cin >> z;
        v.pb({z, 0});
    }

    f(i, 0, m){
        cin >> z;
        v.pb({z, 1});
    }

    f(i, 0, k){
        cin >> z;
        v.pb({z, 2});
    }

    sort(allr(v));
    z = x + y;
    i = 0;
    while(1){
        //cout << v[i].ff << " " << v[i].ss << " " << x << " " << y << "\n";
        if(c == z) break;
        if(x <= 0 && v[i].ss == 0){ i++; continue;}
        if(y <= 0 && v[i].ss == 1){ i++; continue;}

        ans += v[i].ff;
        c ++;

        if(v[i].ss == 0) x --;
        if(v[i].ss == 1) y --;
        i ++;
    }
    cout << ans;
}

Measured memory_bytes: 10604
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */

public class Main {
    public static void main(String[] args) {
        InputStream    inputStream    = System.in;
        OutputStream outputStream = System.out;
        InputReader    in                      = new InputReader(inputStream);
        PrintWriter      out                    = new PrintWriter(outputStream);
        Task                 solver               = new Task();
        solver.solve(1, in, out);
        out.close();
    }

    static class Task {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
        	int X = in.nextInt();
        	
        	if(X == 3 || X == 5 || X == 7) {
        		out.println("YES");
        	}else{
        		out.println("NO");
        	}
        }
    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

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

    }
}



Measured memory_bytes: 23380
N,Y = map(int,input().split())
A = 10000
B = 5000
C = 1000
for i in range(N+1):
  for j in range(N-i+1):
    if A*i+B*j+C*(N-i-j) == Y:
      print(i,j,N-i-j)
      break
  else:
    continue
  break
else:
  print('-1 -1 -1')

Measured memory_bytes: 3060
package main

import "fmt"

func main() {
	var (
		N, M int
	)
	fmt.Scan(&N, &M)

	var (
		s, c   int
		ss, cs []int
	)
	for i := 0; i < M; i++ {
		fmt.Scan(&s, &c)
		ss = append(ss, s)
		cs = append(cs, c)
	}

	var ans int
	var digits [3]int
	var flag [3]bool

	for i := 0; i < M; i++ {
		if flag[ss[i]-1] && cs[i] != digits[ss[i]-1] {
			ans = -1
			fmt.Printf("%d\n", ans)
			return
		}
		flag[ss[i]-1] = true
		digits[ss[i]-1] = cs[i]
	}
	if !flag[0] {
		if N == 1 {
			ans = 0
			fmt.Printf("%d\n", ans)
			return
		}
		digits[0] = 1
	}
	if digits[0] == 0  {
		if N == 1 {
			ans = 0
			fmt.Printf("%d\n", ans)
			return
		}
		ans = -1
		fmt.Printf("%d\n", ans)
		return
	}
	if N == 1 {
		ans = digits[0]
		fmt.Printf("%d\n", ans)
		return
	}
	if N == 2 {
		ans = 10*digits[0] + 1*digits[1]
		fmt.Printf("%d\n", ans)
		return
	}
	if N == 3 {
		ans = 100*digits[0] + 10*digits[1] + digits[2]
		fmt.Printf("%d\n", ans)
		return
	}


}


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

signed main()
{
    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    
    //int t=1 ; cin>>t ; while(t--)
    {
        string s;
        cin >> s;

        int n = s.size();
        int a[n] = {}, o = 0, e = 0;
        for(int i=0;i<n;i++)
        {
            if(s[i] == 'R')
            {
                if(i % 2)
                    o++;
                else
                    e++;
            }
            else
            {
                //cout << i << ' ' << o << ' ' << e << '\n';
                if(i % 2)
                {
                    a[i] += o;
                    if(i) a[i-1] += e;
                }
                else
                {
                    a[i] += e;
                    if(i) a[i-1] += o;
                }

                o = e = 0;
            }
        }

        for(int i=n-1;i>=0;i--)
        {
            if(s[i] == 'L')
            {
                if(i % 2)
                    o++;
                else
                    e++;
            }
            else
            {
                //cout << i << ' ' << o << ' ' << e << '\n';
                if(i % 2)
                {
                    a[i] += o;
                    if(i+1<n) a[i+1] += e;
                }
                else
                {
                    a[i] += e;
                    if(i+1<n) a[i+1] += o;
                }  
                e = o = 0;
            }

        }

        for(int i=0;i<n;i++)
            cout << a[i] << ' ';

        
    }
    
    cerr << "Time elapsed : " << 1.0 * clock() / CLOCKS_PER_SEC << " sec \n";
    return 0;
}



Measured memory_bytes: 1488
#define _GLIBCXX_DEBUG
#pragma GCC diagnostic ignored "-Wsign-compare"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < int(n); ++i)

using Bit = bitset<16>;

void solve() {
    int n, m;
    cin >> n >> m;

    vector<int> S[11];
    int P[11];

    rep(i, m) {
        int k;
        cin >> k;
        S[i].resize(k);
        rep(j, k) {
            cin >> S[i][j];
            --S[i][j];
        }
    }

    rep(i, m) cin >> P[i];

    auto count_on = [&](int switch_id, const Bit &bit) {
        const auto sw = S[switch_id];
        int cnt = 0;
        for (auto &idx : sw)
            if (bit[idx]) ++cnt;
        return cnt;
    };

    auto is_all = [&](const Bit &bit) {
        rep(i, m) {
            if (count_on(i, bit) % 2 != P[i]) return false;
        }
        return true;
    };

    int ans = 0;
    rep(b, 1 << n) {
        Bit bit(b);
        if (is_all(b)) ++ans;
    }
    cout << ans << "\n";
}
int main() {
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
}

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

int main(){
    int n;
    cin>>n;
    vector<int>x(n),y(n);
    rep(i,n) cin>>x[i]>>y[i];
    auto dist=[&](int i,int j){
        double dx=x[i]-x[j];
        double dy=y[i]-y[j];
        return sqrt(dx*dx+dy*dy);

    };
    vector<int>p(n);
    rep(i,n)p[i]=i;
    double len=0;
    int cnt=0;
    do {
        rep(i,n-1){
            len+=dist(p[i],p[i+1]);
        }
        cnt++;
    }while (next_permutation(p.begin(),p.end()));
    double ans=len/cnt;
    cout<<fixed<<setprecision(15)<<ans<<endl;



}

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

const int MN = 200010;

int N, V;
int X[MN], prec1[20][MN], prec2[20][MN];
vector<int> P;

int cc1[1 << 20];
int dp1(int mask) {
    int &ret = cc1[mask];
    if(ret != -1) return ret;

    ret = 0;
    for(int i = 0; i < 20; i++) {
        if(mask & (1 << i)) {
            int t = dp1(mask ^ (1 << i));
            if(t == N) return ret = N;
            ret = max(ret, t + prec1[i][t]);
        }
    }
    return ret;
}

int cc2[1 << 20];
int dp2(int mask) {
    int &ret = cc2[mask];
    if(ret != -1) return ret;

    ret = 0;
    for(int i = 0; i < 20; i++) {
        if(mask & (1 << i)) {
            int t = dp2(mask ^ (1 << i));
            if(t == N) return ret = N;
            ret = max(ret, t + prec2[i][N - 1 - t]);
        }
    }
    return ret;
}

int main() {
    scanf("%d %d", &N, &V);
    while(1) {
        P.push_back(V);
        if(!V) break;
        V /= 2;
    }
    reverse(P.begin(), P.end());

    for(int i = 0; i < N; i++) {
        scanf("%d", &X[i]);
    }

    for(int i = 0; i < P.size(); i++) {
        for(int j = N - 1; j >= 0; j--) {
            prec1[i][j] = 1;
            if(j != N - 1 && X[j + 1] - X[j] <= P[i]) prec1[i][j] += prec1[i][j + 1];
        }
        for(int j = 0; j < N; j++) {
            prec2[i][j] = 1;
            if(j && X[j] - X[j - 1] <= P[i]) prec2[i][j] += prec2[i][j - 1];
        }
    }

    memset(cc1, -1, sizeof(cc1));
    memset(cc2, -1, sizeof(cc2));
    int b = P.size();

    if(dp1((1 << b) - 1) < N) {
        for(int i = 0; i < N; i++) {
            printf("Impossible\n");
        }
        return 0;
    }

    int pos = 0;
    while(pos < N) {
        int nxt = pos + prec1[b - 1][pos];

        bool ok = false;
        for(int mask = 0; mask < (1 << (b - 1)); mask++) {
            if(dp1(mask) >= pos && dp2(((1 << (b - 1)) - 1) ^ mask) >= N - nxt) {
                ok = true;
                break;
            }
        }

        //cout << pos << ' ' << nxt << endl;

        for(int i = pos; i < nxt; i++) {
            if(ok) printf("Possible\n");
            else printf("Impossible\n");
        }
        pos = nxt;
    }
}


Measured memory_bytes: 42112
import math
X = int(input())
#100 a + 101 b + 102 c + 103 d + 104e+105f=X
#102.5(a+b+c+d+e+f)+0.5(d-c)+1.5(e-b)+2.5(f-a)=X
#205(a+b+c+d+e+f)+(d-c)+3(e-b)+5(f-a)=2X

#lower
abcdef = int(2 * X // 205)
def1 = 2 * X - 205 * abcdef
f = def1 // 5
de = def1 % 5
e = de // 3
d = de % 3
if f + e + d <= abcdef:
    print(1)
    exit()

#greater
abcdef = math.ceil(2 * X / 205)
abc = 205 * abcdef - 2 * X
a = abc // 5
bc = abc % 5
b = bc // 3
c = bc % 3
if a + b + c <= abcdef:
    print(1)
    exit()

print(0)


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

int main() {
    int N;
    cin >> N;
    int max_w, max_z, min_w, min_z;
    int x, y, w, z;
    cin >> x >> y;
    w = x - y;
    z = x + y;
    min_w = w;
    max_w = w;
    min_z = z;
    max_z = z;
    for(int i=1;i<N;i++){
        cin >> x >> y;
        w = x - y;
        z = x + y;
        min_w = min(w, min_w);
        max_w = max(w, max_w);
        min_z = min(z, min_z);
        max_z = max(z, max_z);
    }
    cout << max(max_z - min_z, max_w - min_w) << endl;

    return 0;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
#define mod 1000000007
#define ll long long int
#define ar array
#define mp make_pair
using namespace std;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	string s;
	cin>>s;
	string t; 
	for(int i = s.length()-1; i>=0; i--)
	{
		t = s.substr(0,i);
		int y = t.length();
		if(y&1)
			continue;
		y/=2;
		string f = s.substr(0,y);
		t = s.substr(y,y);
		if(t==f)
		{
			cout<<t.length()*2<<endl;
			return 0;
		}
	}
	cout<<0<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
 
using namespace std;
using sl = signed long;
using sll = signed long long;
using ll = long long;

int main(int argc, char *argv[])
{
	string st;
	cin >> st;
	string ans;
	if(st == "Sunny"){
		ans = "Cloudy";
	}else if(st == "Cloudy"){
		ans = "Rainy";
	}else{
		ans = "Sunny";
	}

	cout << ans ;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<cmath>

using namespace std;
int main()
{
    int a, b, c, d;
    scanf("%d%d%d%d", &a, &b, &c, &d);
    if (a>c)
    {
        swap(a, c);
        swap(b, d);
    }
    if (b<=c) printf("0"); else
        if (d<=b) printf("%d", d-c);
            else printf("%d", b-c);
}

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

using namespace std;

void solve()
{
	int n;
	while(cin >> n, n)
	{
		vector<int> Vec(n);
		for(int i = 0; i < n; ++i)
		{
			cin >> Vec[i];
		}
		sort(Vec.begin(), Vec.end());
		int sum = 0;
		for(int i = 1; i < n - 1; ++i)
		{
			sum += Vec[i];
		}
		cout << sum / (n - 2) << endl;
	}
}

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

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define err(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)

using namespace std;

typedef long long ll;

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n; cin >> n >> n;
	
	vector<pair<int, int>> A(n);
	vector<int> P(n);
	
	for (int i = 0; i < n; i++) cin >> A[i].first >> A[i].second;
	for (int i = 0; i < n; i++) P[i] = i;
	
	sort(P.begin(), P.end(), [&](int a, int b) { return A[a] < A[b]; });
	
	for (int i = 0; i < n; ) {
		int j = i;
		while (j < n && A[P[j]].first == A[P[i]].first) j++;
		for (int t = i; t < j; t++) {
			A[P[t]].second = t - i + 1;
		}
		i = j;
	}
	
	for (int i = 0; i < n; i++) printf("%06d%06d\n", A[i].first, A[i].second);
	return 0;
}

Measured memory_bytes: 2688
#include<cstdio>
#include<cmath>
#include<cstring>
#include<iostream>
#include<vector>
#include<map>
#include<queue> 
#include<algorithm>
using namespace std;
#define maxn
#define ll long long
int read(){
    int x=0,f=1;char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}
int n,m;
int main(){
	char s[100005];
	scanf("%s",s);
	for(int i=0;i<strlen(s);i+=2) cout<<s[i];
	cout<<endl; 
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(var,cnt) for(int (var)=0; (var)<(int)(cnt); ++(var))
#define Rep(var,init,cnt) for(int (var)=(init); (var)<(int)(cnt); ++(var))
#define ran(var,vec) for(auto &(var):(vec))
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define SORT(v) sort(all(v))
#define RSORT(v) sort(rall(v))
#define SUM(v) accumulate(all(v),0)
#define tget(tp,idx) get<idx>(tp)
#define TF(flag) ((flag)?1:0)
#define YN(flag) cout<<(flag?"YES":"NO")<<endl;
#define Yn(flag) cout<<(flag?"Yes":"No")<<endl;
#define yn(flag) cout<<(flag?"yes":"no")<<endl;
#define Cout(v) cout<<(v)<<endl
using namespace std;

using ll = long long;
using ull = unsigned long long;
using pi = pair<int,int>;
using pl = pair<ll,ll>;
using ti = tuple<int,int,int>;
using tl = tuple<ll,ll,ll>;

template<typename T>
using vec = vector<T>;
template<typename T>
using mat = vector<vec<T>>;
template<typename T>
using cub = vector<mat<T>>;
template<typename T>
using val = valarray<T>;

template<typename T>
using pq = priority_queue<T>;
template<typename T>
using rpq = priority_queue<T,vec<T>,greater<T>>;

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

template<typename T1,typename T2>
istream &operator>>(istream &is, pair<T1,T2> &p){
  is>>p.first>>p.second;
  return is;
}

template<typename T>
ostream &operator<<(ostream &os, const vector<T> &v){
  cout<<"V{";
  for(int i=0; i<(int)v.size(); ++i){
    os<<v[i]<<(i+1!=v.size()?" ":"");
  }
  cout<<"}";
  return os;
}

template<typename T>
istream &operator>>(istream &is, vector<T> &v){
  for(T &in:v) is>>in;
  return is;
}

template<typename T>
ostream &operator<<(ostream &os, const valarray<T> &v){
  cout<<"V{";
  for(int i=0; i<(int)v.size(); ++i){
    os<<v[i]<<(i+1!=v.size()?" ":"");
  }
  cout<<"}";
  return os;
}

template<typename T>
istream &operator>>(istream &is, valarray<T> &v){
  for(T &in:v) is>>in;
  return is;
}

// Usual Template End ===================

// Template End =========================

int main(void){
  int a,b,c; cin>>a>>b>>c; Cout(c/a*b);
}












Measured memory_bytes: 256
#include<bits/stdc++.h>
#define F first
#define S second
#define ll long long
#define pb push_back
#define pf push_front
#define eoi ios::sync_with_stdio(0),ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
using namespace std;
int main()
{
    eoi;
    int x,y;
    cin>>x>>y;
    if(x<y)cout<<0;
    else cout<<10;

    return 0;
}


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

typedef vector<int> vi;
typedef long long int ll;
typedef pair<int,int> pii;
typedef vector<pii > vii;
typedef vector<vi > vvi;

vi afs;

void init() {
    int i = 1;
    for(; i < 100; i*=2) {
        afs.push_back(i);
        // cout << i << endl;
    }
}

int n, i, a, f;
string s;
int main() {
    cin >> n;
    init();
    if(n == afs[0]) {
        cout << afs[0] << endl;
        return 0;
    } 
    if (n == afs[1]) {
        cout << afs[1] << endl;
        return 0;
    }
    if (n >= afs[afs.size()-1]) {
        cout << afs[afs.size()-1] << endl;
        return 0;
    }
    for(i = 1; i < afs.size(); i++) {
        if(n == afs[i]) {
            cout << afs[i] << endl;
            return 0;
        }
        if(n < afs[i]) {
            cout << afs[i-1] << endl;
            return 0;
        }
    }

    return 0;
}

Measured memory_bytes: 256
from sys import stdin
import sys
import math
from functools import reduce
import functools
import itertools
from collections import deque

n,k = [int(x) for x in stdin.readline().rstrip().split()]
p = [(int(x)+1)/2 for x in stdin.readline().rstrip().split()]

m = sum(p[0:k])
maxm = m

for i in range(1,n-k+1):
    m = m - p[i-1] + p[i+k-1]
    maxm = max([maxm,m])

print(maxm)




Measured memory_bytes: 33400
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <limits>
#include <map>
#include <stack>
#include <map>
#include <unordered_map>
#define REP(i,n) for(long (i)=0;(i)<(n);(i)++)
#define REPI(i,a,b) for(long (i)=(a);(i)<(b);(i)++)
#define INF numeric_limits<double>::infinity()
constexpr long MOD = 1e9 + 7;
using namespace std;
using P = pair<long, long>;
using VI = vector<long>;

int main() {
    int n;
    cin >> n;
    VI v;
    v.push_back(0);
    REP(i,n) {
        long a;
        cin >> a;
        v.push_back(a);
    }
    v.push_back(0);
    
    long tmp = 0;
    REP(i,n+1) {
        tmp += abs(v[i] - v[i+1]);
    }
    
    VI h;
    REPI(i,1,n+1) {
        h.push_back(abs(v[i-1] - v[i]) + abs(v[i] - v[i+1]) - abs(v[i-1] - v[i+1]));
    }
    REP(i,n) {
        cout << tmp - h[i] << endl;
    }
}


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

const int MAX_N = 200000;
int n;
int dp[MAX_N + 1];

void solve() {
    for (int i = 0; i < 10; i++) {
        dp[i] = i;
    }
    for (int i = 10; i <= MAX_N; i++) {
        string num = to_string(i);
        int digit = num.length();
        if (num.at(digit - 1) != '0' && num.at(0) > num.at(digit - 1)) {
            int sum = 0;
            for (int i = 0; i <= digit - 2; i++) {
                sum += pow(10, i);
            }
            dp[i] = dp[i - 1] + 2 * sum;
        } else if (num.at(digit - 1) != '0' && num.at(0) < num.at(digit - 1)) {
            int sum = 0;
            for (int i = 0; i <= digit - 3; i++) {
                sum += pow(10, i);
            }
            dp[i] = dp[i - 1] + 2 * sum;
        } else if (num.at(0) == num.at(digit - 1)) {
            int sum = 0;
            for (int i = 0; i <= digit - 3; i++) {
                sum += pow(10, i);
            }
            string rest = "0";
            for (int i = 1; i <= digit - 2; i++) {
                rest.push_back(num.at(i));
            }
            dp[i] = dp[i - 1] + 2 * (1 + sum + stoi(rest) + 1) - 1;
        } else if (num.at(digit - 1) == '0') {
            dp[i] = dp[i - 1];
        }
    }

    cout << dp[n] << endl;
}

int main() {
    cin >> n;    
    solve();
}

Measured memory_bytes: 1024
using System;

namespace _164_1
{
    class Program
    {
        static void Main(string[] args)
        {
            string a = Console.ReadLine();
            var b = a.Split(' ');
            if(int.Parse(b[0]) > int.Parse(b[1]))
            {
                Console.WriteLine("safe");
            }
            else
            {
                Console.WriteLine("unsafe");
            }
        }
    }
}


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

char a[4],b[4];
int main(){
	for(int i=1;i<=3;i++) scanf("%c",&a[i]);
	getchar();
	for(int i=1;i<=3;i++) scanf("%c",&b[i]);
	int cnt = 0;
	for(int i=1;i<=3;i++){
		if(a[i]==b[i]) cnt++;
	}
	printf("%d\n",cnt);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mod 1000000007
#define pb push_back
#define ll long long
#define mp make_pair
using namespace std;
ll field[100][100];
int main(){
	ll a,b;
	cin>>a>>b;
	for(int i=50;i<=99;i++){
		for(int j=0;j<=99;j++){
			field[i][j]=1;
		}
	}
	ll bx = 0, by = 0;
	ll ax = 51, ay = 0;
	for(int i=1;i<=b-1;i++){
		field[bx][by]=1;
		by = by+2;
		if(by==100){
			by=0;
			bx=bx+2;
		}
	}
	for(int i=1;i<=a-1;i++){
		field[ax][ay]=0;
		ay = ay+2;
		if(ay==100){
			ay=0;
			ax=ax+2;
		}
	}
	cout<<100<<" "<<100<<endl;
	for(int i=0;i<100;i++){
		for(int j=0;j<100;j++){
			if(field[i][j]==0){
				cout<<".";
			}
			else{
				cout<<"#";
			}
		}
		cout<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define nl cout<<'\n';
int main()
{
    string s,t;
    cin>>s>>t;
    sort(s.begin(),s.end());
    sort(t.begin(),t.end());
    reverse(t.begin(),t.end());
    if(s<t)
      cout<<"Yes";
    else
      cout<<"No";
    nl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define all(x) (x).begin(), (x).end()

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin >> s;
    reverse(all(s));
    ll ans = 0;
    int b=0, w=0;
    for (char c : s) {
        if (c == 'B') {
            ans += w;
            b++;
        }
        else {
            w++;
        }
    }
    cout << ans << '\n';
}


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

#define infi            5e9
#define infl            5e18
#define MX              100005
#define pi              2*acos(0.0)
#define ll              long long int
#define rr              read()
#define ff              first
#define ss              second
#define pb              push_back
#define pii             pair<int,int>
#define ms(a,b)         memset(a, b, sizeof(a))
#define loop(i,n)       for(register int i=0;i<n;i++)
#define pool(i,n)       for(register int i=n-1;i>=0;i--)
#define loop1(i,n)      for(register int i=1;i<=n;i++)
#define pool1(i,n)      for(register int i=n;i>0;i--)

using namespace std;

inline ll read(){char c=getchar();ll num,sign=1;for(;c<'0'||c>'9';c=getchar())if(c=='-')sign=-1;for(num=0;c>='0'&&c<='9';){c-='0';num=num*10+c;c=getchar();}return num*sign;}
inline ll pw(ll b, ll p){ll ans=1;while(p>0){if(p&1)ans*=b;p>>=1;b*=b;}return ans;}
// inline bool isPrime(ll n){if(n==1)return false;if(n==2)return true;if(!(n%2))return false;for(ll i=3;i<=sqrt(n);i+=2)if(!(n%i))return false;return true;}
// inline ll gcd(ll a, ll b){if(a==0)return b;return gcd(b%a,a);}

// //*************************************  Bitmask Opereations  **********************************//
// int Set(int N,int pos){return N=N | (1<<pos);}
// int reset(int N,int pos){return N= N & ~(1<<pos);}
// bool check(int N,int pos){return (bool)(N & (1<<pos));}
// //********************************************************************************************//


int main(){
    ios_base::sync_with_stdio(false);cin.tie(NULL);
    //#ifdef rid.dle
    //freopen("in.txt", "r", stdin);//#endif
    
    int n=rr;
    if(n<1200)cout << "ABC" << endl;
    else cout << "ARC" << endl;

    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {

    Scanner scan = new Scanner(System.in);

    while (true) {

      int n = scan.nextInt();

      if (n == 0) {
        break;
      }

      long sum = 0;
      long sqsum = 0;

      for (int i = 0; i < n; i++) {
        int tmp = scan.nextInt();
        sum += tmp;
        sqsum += Math.pow(tmp, 2);
      }

      double ave = 1.0 * sum / n;
      double sqave = 1.0 * sqsum / n;

      System.out.println(Math.sqrt(sqave - Math.pow(ave, 2)));

    }

  }

}


Measured memory_bytes: 31296
#include <bits/stdc++.h>
using namespace std;
int dp[405][405];
int main() {
    ios :: sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int n, ma, mb; cin >> n >> ma >> mb;
    memset(dp, 0x3f, sizeof(dp));
    dp[0][0] = 0;
    for (int i = 0; i < n; ++ i) {
        int a, b, c; cin >> a >> b >> c;
        for (int A = 400; A >= a; -- A) {
            for (int B = 400; B >= b; -- B) {
                dp[A][B] = min(dp[A][B], dp[A - a][B - b] + c);
            }
        }
    }
    int ans = 0x3f3f3f3f;
    for (int i = 1; i * ma <= 400 && i * mb <= 400; ++ i) {
        ans = min(ans, dp[i * ma][i * mb]);
    }
    cout << (ans == 0x3f3f3f3f ? -1 : ans) << endl;
    return 0;
}

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

using namespace std;
// ascending order
#define vsort(v) sort(v.begin(), v.end())
// descending order
#define vsort_r(v) sort(v.begin(), v.end(), greater<int>())
#define vunique(v) unique(v.begin(), v.end())
#define mp make_pair
#define ts(x) to_string(x)
#define rep(i, a, b) for(int i = (int)a; i < (int)b; i++)
#define repm(i, a, b) for(int i = (int)a; i > (int)b; i--)
#define bit(a) bitset<8>(a)
#define des_priority_queue priority_queue<int, vector<int>, greater<int> >
typedef long long ll;
typedef pair<int, int> P;

#define INF 1000000000001
#define MAX_E 100000
#define MAX_V 100000

struct edge {
	int from, to, cost;
};
ll d[MAX_V];
int V, E;

edge es[MAX_E];

void shortest_path(int s) {
	rep(i, 0, V) d[i] = INF;
	d[s] = 0;
	while(true) {
		bool update = false;
		rep(i, 0, E) {
			edge e = es[i];
			if(d[e.from] != INF && d[e.to] > d[e.from] + e.cost) {
				d[e.to] = d[e.from] + e.cost;
				update = true;
			}
		}
		if(!update) break;
	}
}

bool find_negative_loop(int s) {
	//memset(d, 0, sizeof(d));
	fill(d, d + V, INF);
	d[s] = 0;
	rep(i, 0, 2 * V) {
		rep(j, 0, E) {
			edge e = es[j];
			if(d[e.to] > d[e.from] + e.cost) {
				d[e.to] = d[e.from] + e.cost;
				if(i >= V - 1 && e.to == V - 1) return true;
			}
		}
	}
	return false;
}

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

	int N, M;
	cin >> N >> M;
	V = N, E = M;
	rep(i, 0, E) {
		ll a, b, c;
		cin >> a >> b >> c;
		a--, b--;
		es[i].from = a;
		es[i].to = b;
		es[i].cost = -c;
	}

	if(find_negative_loop(0)) {
		cout << "inf" << endl;
		return 0;
	}

	cout << -d[N - 1] << endl;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int m=3e5+1;
int  a[m];
main(){
    int n; cin >> n;
    for(int i=0;i<3*n;i++) cin >> a[i];
    sort(a,a+3*n);
    long long ans = 0ll;

    for(int i=n;i<3*n;i+=2)
        ans+=a[i];
    cout << ans << endl;
}

Measured memory_bytes: 1408
#include <stdio.h>
#include <vector>
#include <algorithm>
using namespace std;
#define PB push_back

constexpr int kN = int(2E5 + 10), kInf = int(2E9 + 10);
vector<int> graph[kN];
int ans[kN], p[kN], a[kN], n, nsz;
void dfs(int pos, int from = 1) {
	int l = lower_bound(p, p + n, a[pos]) - p, tmp;

	tmp = p[l];
	p[l] = a[pos];

	if (tmp == kInf) nsz++;
	ans[pos] = nsz;

	for (int i : graph[pos]) if (i != from) dfs(i, pos);	
	
	p[l] = tmp;
	if (tmp == kInf) nsz--;
	return ;
}

int main() {
	int l, r;
	scanf("%d", &n);
	for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
	for (int i = 1; i < n; i++) {
		scanf("%d%d", &l, &r);
		graph[l].PB(r);
		graph[r].PB(l);
	}
	for (int i = 1; i < kN; i++) p[i] = kInf;
	nsz = p[0] = 0;
	dfs(1);

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


Measured memory_bytes: 30764
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] x = new int[n];
        int sum = 0;
        for (int i = 0; i < n; i++) {
            x[i] = sc.nextInt();
            sum += x[i];
        }
        int pos1 = sum / n;
        int pos2 = sum / n + 1;
        int result1 = 0;
        int result2 = 0;
        for (int i = 0; i < n; i++) {
            result1 += Math.pow((x[i] - pos1), 2);
            result2 += Math.pow((x[i] - pos2), 2);
        }
        System.out.println(Math.min(result1, result2));
    }

}


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

using namespace std;

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

int main(){
    int n;
    cin >> n;
    if (n % 10 == 9 || n / 10 == 9){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    
}

Measured memory_bytes: 256
import java.util.Scanner;
class Main{
  public static void main(String[] args){
  Scanner sc = new Scanner(System.in);
  
  int tate = sc.nextInt();
  int yoko = sc.nextInt();
  int a = tate*yoko;
  int b = tate*2+yoko*2;
  System.out.println(a+" "+b);
  }
}


Measured memory_bytes: 25896
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <atcoder/all>

#define F first
#define S second
#define int long long
#define ll long long
//#define int  unsigned long long
#define pb push_back
//#define double long double

using namespace std;
using namespace atcoder;
using namespace __gnu_pbds;
typedef  tree< int , null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int N = 3000000;
const int K = 100000;
const int mod = 1e9 + 7;
main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int n, m;
    cin >> n >> m;
    vector <int> a(n), b(m);
    for (int i = 0; i < n; i++) cin >> a[i];
    for (int i = 0; i < m; i++) cin >> b[i];
    vector <int> res = convolution(a, b);
    for (int i = 0; i < n + m - 1; i++){
        cout << res[i] << " ";
    }
}


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

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
#define FOR(i, n) for(int (i)=0; (i)<(n); (i)++)
#define FOR1(i, n) for(int (i)=1; (i)<=(n); (i)++)
#define FORI(i, n) for(int (i)=n-1; (i)>=0; (i)--)


int main(int argc, char** argv) {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cout << setprecision(15);
    if (argc == 2 && atoi(argv[1]) == 123456789) {
        freopen("d:\\code\\cpp\\stdin", "r", stdin);
        //freopen("d:\\code\\cpp\\stdout", "w", stdout);
    }

    int n;
    cin >> n;
    vector<int> w(n+1);
    FOR1(i, n)
        cin >> w[i];

    vector<ll> s(n+1, 0);
    FOR1(i, n)
        s[i] = w[i] + s[i-1];

    ll sol = s[n];
    FOR1(i, n){
        ll s1 = s[i];
        ll s2 = s[n]-s[i];
        ll diff = abs(s1-s2);
        sol = min(sol, diff);
    }
    cout << sol << '\n';


    //if (argc == 2 && atoi(argv[1]) == 123456789)        cerr << clock()*1.0/CLOCKS_PER_SEC << " sec\n";
    return 0;
}

Measured memory_bytes: 256
while True:
 a,op,b=input().split()
 a=int(a)
 b=int(b)
 if op=="?":	
   break 
 if op=="+":
  w=a+b
  print(int(w)) 
 elif op=="-":
  x=a-b
  print(int(x))
 elif op=="*":
  y=a*b
  print(int(y))
 elif op=="/":
  z=a/b
  print(int(z))


Measured memory_bytes: 5596
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
int main(){
    long long h, w;
    cin >> h >> w;
    long long hd = h/2;
    long long c = w * hd;
    if(h%2==1){
        if(w%2==1){
            c+=(w+1)/2;
        }else{
            c+=w/2;
        }
    }
    if(h==1 || w==1) c=1;
    cout << c << endl;
    return 0;
}

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

int main(void)
{
    int W, H;
    char buf[16], row[302], *p, tmp;
    memset(row, '.', 301);
    row[301] = 0;
    for (p = row; p - row < 301; p += 2)
        *p = '#';

    while (1)
    {
        fgets(buf, 16, stdin);
        sscanf(buf, "%d %d", &H, &W);
        if (!(W | H)) break;

        while (H)
        {
            if (p != row)
                p = row;
            else
                p = row + 1;
            tmp = p[W];
            p[W] = 0;
            printf("%s\n", p);
            p[W] = tmp;
            --H;
        }
        p = row + 1;
        printf("\n");
    }
    return 0;
}



Measured memory_bytes: 2104
#include <bits/stdc++.h>
#define lli long long int
#define endl "\n"
using namespace std;

int main()
{
    int n,m,c; cin>>n>>m>>c;
    int brr[m],arr[n][m]; for(int i=0;i<m;i++) cin>>brr[i];
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<m;j++) cin>>arr[i][j];
    } 
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<m;j++)
        {
            arr[i][j]*=brr[j];
        }
    }
    int count=0;
    lli zeke=0;
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<m;j++)
        {
            zeke+=1LL*(arr[i][j]);
        }
        if(zeke+c>0) ++count;
        zeke=0;
    }
    cout<<count<<endl;
}


Measured memory_bytes: 256
using System;

class AOJ{
  static void Main()
  {
    double ans = 100000;
    int n = int.Parse(Console.ReadLine());

    for (int i = 0; i < n; i++)
      ans = Math.Ceiling(ans * 1.05 / 1000) * 1000;

    Console.WriteLine(ans);
  }
}

Measured memory_bytes: 9104
#include<bits/stdc++.h>
using namespace std;
const int N=2e5+5;
int n,m,ans[N],a[N],b[N],t[N<<2],t1[N<<2],t2[N<<2];
void update(int l,int r,int k)
{
    t1[k]=t[k]+r-l;t2[k]=t[k];
    if(l!=r)
    {
        int m=l+r>>1;
        t[k<<1]=t[k];t[k<<1|1]=t[k]+m+1-l;
    }
    t[k]=0;
}
int query(int l,int r,int k,int x)
{
    if(t[k]) update(l,r,k);
    if(l>x) return m+1;
    if(r<=x) return t1[k];
    int m=l+r>>1;
    int a=query(l,m,k<<1,x),b=query(m+1,r,k<<1|1,x);
    if(x<=r) a+=x>=m?x-m:0;
    else a+=r-m;
    t2[k]=min(t2[k<<1],t2[k<<1|1]);
    t1[k]=min(t1[k<<1]+r-m,t1[k<<1|1]);
    return min(a,b);
}
void update(int l,int r,int k,int x,int y,int d)
{
    if(t[k]) update(l,r,k);
    if(r<x||l>y) return;
    if(l>=x&&r<=y)
    {
        t[k]=d+l-x;
        update(l,r,k);
        return;
    }
    int m=l+r>>1;
    update(l,m,k<<1,x,y,d);update(m+1,r,k<<1|1,x,y,d);
    t2[k]=min(t2[k<<1],t2[k<<1|1]);
    t1[k]=min(t1[k<<1]+r-m,t1[k<<1|1]);
}
int main()
{
    scanf("%d%d",&n,&m);
    for(int i=1;i<=n;i++) scanf("%d%d",&a[i],&b[i]);
    for(int i=1;i<=n;i++)
    {
        int d=min(m+1,query(1,m,1,a[i]-1)+1);
        update(1,m,1,a[i],b[i],d);
        ans[i]=t2[1];
    }
    for(int i=1;i<=n;i++)
    {
        if(ans[i]>=m) ans[i]=-1;
        else ans[i]+=i;
        printf("%d\n",ans[i]);
    }
}


Measured memory_bytes: 12108
#include<iostream>
using namespace std;
int main(){
  int a,b,c,d,e;
  cin >> a >> b >> c >> d >> e;
  if(a==0){
    cout << 1 << endl;
  }
  else if(b==0){
    cout << 2 << endl;
  }
  else if(c==0){
    cout << 3 << endl;
  }
  else if(d==0){
    cout << 4 << endl;
  }
  else if(e==0){
    cout << 5 << endl;
  }
return 0;
}

Measured memory_bytes: 3492
#include<cstdio>
#include<algorithm>
int main(){
	int n;
	scanf("%d",&n);
	char s[n+1]={};
	scanf("%s",s);
	int a[n]={};
	if(s[0]=='.')a[0]=1;
	for(int i=1;i<n;i++){
		a[i]=a[i-1];
		if(s[i]=='.')a[i]++;
	}
	int ans=a[n-1];
	for(int i=0;i<n-1;i++){
		ans=std::min(ans,(i+1+a[n-1]-2*a[i]));
	}
	ans=std::min(ans, n-a[n-1]);
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 1152
s=1
while(s!=0):
    a,op,b=map(str,input().split())
    a=int(a)
    b=int(b)
    if op=='+':
        print(a+b)
    elif op=='-':
        print(a-b)
    elif op=='*':
        print(a*b)
    elif op=='/':
        print(a//b)
    else:
        break


Measured memory_bytes: 5592
#include<iostream>
#include<string>
#include<vector>
using namespace std;
int main(){
	int n;
	char p = 'n', w = 'n', g = 'n', y = 'n';
	cin >> n;
	vector<char> s(n);
	for (int i = 0; i < n; i++){
		cin >> s.at(i);
	}

	for (int i = 0; i < n; i++){
		if (s.at(i) == 'P'){
			p = 'P';
		}

		else if (s.at(i) == 'W'){
			w = 'W';
		}

		else if (s.at(i) == 'G'){
			g = 'G';
		}

		else{
			y = 'Y';
		}
	}

	if (p == 'P'&&w == 'W'&&g == 'G'&&y == 'Y'){
		cout << "Four" << endl;
	}

	else{
		cout << "Three" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1e9+7;
int main() {
    ll n;
    cin >> n;
    vector<ll>x(n),y(n),h(n);
    for(ll i=0;i<n;i++){
        cin >> x[i] >> y[i] >> h[i];
    }
    ll cx,cy,H;
    for(ll ix=0;ix<=100;ix++){
        bool judge=true;
        for(ll iy=0;iy<=100;iy++){
            judge=true;
            for(ll i=0;i<n;i++){
                if(h[i]!=0){
                    H=h[i]+abs(x[i]-ix)+abs(y[i]-iy);
                    break;
                }
            }
            for(ll i=0;i<n;i++){
                if(h[i]==0){
                    if(H-abs(x[i]-ix)-abs(y[i]-iy)>0){
                        judge=false;
                        break;
                    }
                }
                else{
                    if(H!=h[i]+abs(x[i]-ix)+abs(y[i]-iy)){
                        judge=false;
                        break;
                    }
                }
            }
            if(judge){
                cx=ix,cy=iy;
                break;
            }
        }
        if(judge){
            break;
        }
    }
    cout << cx << " " << cy << " " << H << endl;
}

Measured memory_bytes: 3640
#B問題
N,K = map(int,input().split())
A = list(map(int,input().split()))
count = 0
for i,a in enumerate(A):
    for j,b in enumerate(A):
        if a > b:
            if i < j:
                count+=(K*(K+1))//2
            else:
                count+=(K*(K-1))//2
                
print(count%1000000007)
    

Measured memory_bytes: 3188
using DataStructures
const double = Float64
const int = Int64

parseint(x) = parse(int, x)
readint() = map(parseint, split(readline()))

function main()
  H,W = readint()
  Ch,Cw = readint()
  Dh,Dw = readint()
  
  S = Array{Char,2}(undef,H+4,W+4)
  S .= '#'

  for i in 1:H
    s = readline()
    for j in 1:W
    S[2+i,2+j] = s[j]
    end
  end

  #println(S)
  checked = Array{int,2}(undef, H+4,W+4)
  uncheck = 10^8
  checked .= uncheck
  
  Q1 = Queue{Pair{int,int}}()
  Q2 = Queue{Pair{int,int}}()

  enqueue!(Q1,Pair(Ch+2,Cw+2))
  checked[Ch+2,Cw+2] = 0
  dis = 0
  while true
    
    if isempty(Q1)
      if isempty(Q2)
        break
      end
      dis += 1
      Q1 = Q2
      Q2 = Queue{Pair{int,int}}()
    end
    
    s = dequeue!(Q1)
    x = s.first
    y = s.second
    checked[x,y]<dis && continue

    for dy in -2:2
      for dx in -2:2
        xx = x + dx
        yy = y + dy
      
        S[xx,yy]=='#' && continue

        if abs(dx) + abs(dy) == 0
          continue
        elseif abs(dx)+abs(dy)==1
          if checked[xx,yy]>dis 
            enqueue!(Q1,Pair(xx,yy))
            checked[xx,yy] = dis
          else
            continue
          end  
        else
          if checked[xx,yy]>dis+1
            enqueue!(Q2,Pair(xx,yy))
            checked[xx,yy] = dis+1
          end
        end
      end
    end
   
  end
  if checked[Dh+2,Dw+2] == uncheck
    println(-1)
  else
    println(checked[Dh+2,Dw+2])
  end



end

main()

Measured memory_bytes: 234048
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
)

var (
	sc = bufio.NewScanner(os.Stdin)
	mod int = 1e9 + 7
)

func init() {
	sc.Split(bufio.ScanWords)
}

func main() {
	n := getInt()

	var bs []int

	for i := 0; i < n-1; i++ {
		bs = append(bs, getInt())
	}

	var as []int
	as = append(as, bs[0])
	for i := 0; i < n-2; i++ {
		b1 := bs[i]
		b2 := bs[i+1]

		if b1 <= b2 {
			as = append(as, b1)
		} else {
			as = append(as, b2)
		}
	}
	as = append(as, bs[n-2])

	sum := 0
	for _, a := range as {
		sum += a
	}
	fmt.Println(sum)
}

func getInt() int {
	sc.Scan()
	str := sc.Text()
	value, _ := strconv.Atoi(str)
	return value
}

func getString() string {
	sc.Scan()
	return sc.Text()
}

func abs(a int) int {
	return int(math.Abs(float64(a)))
}

func pow(p, q int) int {
	return int(math.Pow(float64(p), float64(q)))
}

func min(nums ...int) int {
	if len(nums) == 0 {
		panic("funciton min() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Min(float64(res), float64(nums[i])))
	}
	return res
}

func max(nums ...int) int {
	if len(nums) == 0 {
		panic("funciton max() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Max(float64(res), float64(nums[i])))
	}
	return res
}

func strSearch(a []string, b string) bool {
	for i := 0; i < len(a); i++ {
		if a[i] == b {
			return true
		}
	}
	return false
}

func printIntArray(array []int) {
	strArray := fmt.Sprint(array)
	fmt.Println(strArray[1 : len(strArray) - 1])
}

func calcMod(x int) int {
	return x % mod
}


Measured memory_bytes: 640
import Control.Monad

showp s r = (s : ' ' : show r)

suit = "SHCD"
rank = [1..13]

main = do
    n <- readLn
    cards <- replicateM n getLine
    mapM_ putStrLn $ flip filter [showp s r | s <- suit, r <- rank] $ not . flip elem cards

Measured memory_bytes: 3636
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <stdio.h>
#define REP(i, n) for(int i = 0;i < n;i++)

using namespace std;

static const int N = 1000000;

int n, t, cnt = 0;
vector<int> vec;

void BS(int x)
{
	int left = 0, right = n, mid;
	while (left < right)
	{
		mid = (left + right) / 2;
		if (vec[mid] == x)
		{
			cnt++;
			return;
		}
		else if (x < vec[mid])
			right = mid;
		else
			left = mid + 1;
	}
}

int main()
{
	int input;
	cin >> n;
	REP(i, n)
	{
		cin >> input;
		vec.push_back(input);
	}	

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

	cin >> t;
	REP(i, t)
	{
		cin >> input;
		BS(input);
	}

	cout << cnt << endl;
	return 0;
}

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

typedef long long ll;
using namespace std;

static const int MOD = 1000000007;

int main() {
    int n, m;
    cin >> n >> m;

    vector<int> oks(n + 1, true);
    for (int i = 0; i < m; ++i) {
        int a;
        cin >> a;
        oks[a] = false;
    }

    vector<ll> dp(n + 1);
    dp[0] = 1;
    for (int now = 0; now < n; ++now) {
        for (int next = now + 1; next <= min(n, now + 2); ++next) {
            if (oks[next]) {
                dp[next] += dp[now];
                dp[next] %= MOD;
            }
        }
    }
    cout << dp[n] << endl;

    return 0;
}


Measured memory_bytes: 1408