akhauriyash/Code-Regression huggingface dataset:
package main

import "fmt"

func get_mark_index(mark string) int {
    marks := []string{"S", "H", "C", "D"}
    var i int

    for i=0; i<4; i++ {
        if marks[i] == mark {
            break
        }
    }
    return i
}

func main() {
    var cards [4][13]bool
    marks := []string{"S", "H", "C", "D"}

    // カード初期化
    for i:=0; i<4; i++ {
        for j:=0; j<13; j++ {
            cards[i][j] = true
        }
    }

    // カードデータを読み込み、読み取ったカードをfalseにする
    var n int
    var mark string
    var rank int

    fmt.Scanf("%d", &n)

    /*
    fmt.Printf("mark:[%s]\n", mark)
    fmt.Printf("rank:[%d]\n", rank)
    fmt.Printf("mindex:[%d]\n", get_mark_index(mark))
    */

    for i:=0; i<n; i++ {
        fmt.Scanf("%s %d", &mark, &rank)
        cards[get_mark_index(mark)][rank-1] = false
    }


    // カードの表示
    for i:=0; i<4; i++ {
        for j:=0; j<13; j++ {
            if cards[i][j] {
                // カード表示
                fmt.Printf("%s %d\n", marks[i], j+1)
            }
        }
    }
}


Measured memory_bytes: 1140
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>

#include <algorithm>
#include <bitset>
#include <complex>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#include <cassert>
#include <functional>

typedef long long ll;
using namespace std;

#ifndef LOCAL
#define debug(...) ;
#else
#define debug(...) cerr << __LINE__ << " : " << #__VA_ARGS__ << " = " << _tostr(__VA_ARGS__) << endl;

template<typename T>
ostream &operator<<(ostream &out, const vector<T> &v);

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

template<typename T>
ostream &operator<<(ostream &out, const vector<T> &v) {
  out << '{';
  for (const T &item : v) out << item << ", ";
  out << "\b\b}";
  return out;
}

void _tostr_rec(ostringstream &oss) {
  oss << "\b\b \b";
}

template<typename Head, typename... Tail>
void _tostr_rec(ostringstream &oss, Head &&head, Tail &&... tail) {
  oss << head << ", ";
  _tostr_rec(oss, forward<Tail>(tail)...);
}

template<typename... T>
string _tostr(T &&... args) {
  ostringstream oss;
  int size = sizeof...(args);
  if (size > 1) oss << "{";
  _tostr_rec(oss, forward<T>(args)...);
  if (size > 1) oss << "}";
  return oss.str();
}
#endif

#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 200010

double calc(int X, int P) {
  debug(X, X / 2 * 100.0 / P);
  X /= 2;

  return X * 100.0 / P;
}

int main() {
  int X, P;

  cin >> X >> P;

  double ans = 0;

  if (X % 2) {
    ans = (calc(X - 1, P) * P + calc(X + 1, P) * (100 - P)) / 100.0 + 1;
  } else {
    ans = calc(X, P);
  }

  printf("%.10lf\n", ans);

  return 0;
}

Measured memory_bytes: 3652
#include<stdio.h>

struct Card
{
  char suit;
  int value;
};

void bubble(struct Card A[],int n);
void selection(struct Card A[],int n);
void print(struct Card A[],int n);
int isStable(struct Card c1[],struct Card c2[],int n);


int main(void)
{
  int i;
  struct Card c1[100],c2[100];
  int n;

  scanf("%d",&n);
  for(i=0;i<n;i++)
    {
      scanf(" %c %d",&c1[i].suit,&c1[i].value);
    }

  for(i=0;i<n;i++)
    {
      c2[i]=c1[i];
    }

  bubble(c1,n);
  selection(c2,n);

  print(c1,n);
  puts("Stable");
  
  print(c2,n);
  if(isStable(c1,c2,n)==1)
    {
      puts("Stable");
    }
  else
    {
      puts("Not stable");
    }

  return 0;
}

void bubble(struct Card A[], int n)
{
  int i,j;
  for(i=0;i<n;i++)
    {
      for(j=n-1;j>=i+1;j--)
	{
	  if(A[j].value<A[j-1].value)
	    {
	      struct Card t=A[j];
	      A[j]=A[j-1];
	      A[j-1]=t;
	    }
	}
    }
}

void selection(struct Card A[],int n)
{
  int i,j;
  int minj;
  
  for(i=0;i<n;i++)
    {
      minj=i;
    
      for(j=i;j<n;j++)
	{
	  if(A[j].value<A[minj].value)
	    {
	      minj=j;
	    }
	}
    
      struct Card t=A[i];
      A[i]=A[minj];
      A[minj]=t;
    }
}

void print(struct Card A[],int n)
{
  int i;
  
  for(i=0;i<n;i++)
    {
      if(i>0)
	{
	  putchar(' ');
	}
    
      printf("%c%d",A[i].suit,A[i].value);
    }
  
  putchar('\n');
}

int isStable(struct Card c1[],struct Card c2[],int n)
{  
  int i;
 
  for(i=0;i<n;i++)
    {
      if(c1[i].suit!=c2[i].suit)
	{
	  return 0;
	}
    }
  return 1;
}



Measured memory_bytes: 2104
/*
ID: learnin7
TASK: test
LANG: C++                 
*/
/* LANG can be C++11 or C++14 for those more recent releases */
#include<bits/stdc++.h>

/*  Macros from Endagorion */
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)

using namespace std;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef double ld;


int main(){
        
    ios_base::sync_with_stdio(0);
    
    //ofstream fout ("test.out");
    //ifstream fin ("test.in");
    //fin >> a >> b;
    //fout << a+b << endl;
    int n,m,x;
    cin>>n>>m>>x;
    int a[n+1]={0};
    forn(i,m){
        int b;
        cin>>b;
        a[b] = 1;
    }
    //forn(i,n+1)   cout<<a[i]<<endl;
    int e=x;
    int c1=0;
    while(e<=n) c1 += a[e], e++;
    int c2=0;
    e=x;
    while(e>=0) c2 += a[e], e--;
    cout<<min(c1, c2)<<endl;
    return 0;
}



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

int main() {
  int n;
  cin >> n;
  vector<int> d(n);
  for(int i=0;i<n;i++) cin >> d.at(i);
  sort(d.begin(),d.end());
  cout << d.at(n/2)-d.at(n/2-1) << endl;
}

Measured memory_bytes: 640
#include<iostream>
typedef long long ll;
using namespace std;
int main() {
	int n;
	cin >> n;
	int color[10] = {};
	int a;
	int sum = 0, count = 0;
	for (int i = 0; i < n; i++) {
		cin >> a;
		if (a < 400) {
			color[0] += 1;
		}
		if (a >= 400 && a < 800) {
			color[1] += 1;
		}
		if (a >= 800 && a < 1200) {
			color[2] += 1;
		}
		if (a >= 1200 && a < 1600) {
			color[3] += 1;
		}
		if (a >= 1600 && a < 2000) {
			color[4] += 1;
		}
		if (a >= 2000 && a < 2400) {
			color[5] += 1;
		}
		if (a >= 2400 && a < 2800) {
			color[6] += 1;
		}
		if (a >= 2800 && a < 3200) {
			color[7] += 1;
		}
		if(a>=3200){
			color[8] += 1;
			count++;
		}
	}
	if (count == n) {
		cout << "1" <<" "<< n << endl;
		return 0;
	}
	if (color[8] == 0) {
		for (int i = 0; i < 8; i++) {
			if (color[i] > 0) {
				sum++;
			}
		}
		cout << sum << " " << sum << endl;
		return 0;
	}
	else {
		for (int i = 0; i < 8; i++) {
			if (color[i] > 0) {
				sum++;
			}
		}
		int ans = sum + color[8];
			cout << sum << " " << ans << endl;
	}

	return 0;
}

Measured memory_bytes: 256
import java.util.HashMap;
import java.util.Scanner;


public class Main {

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

		int n = scanner.nextInt();
		HashMap<Integer, String> a = new HashMap<Integer, String>();

        for(int i = 0; i < n; i++){
        	a.put(scanner.nextInt(),null);
        }
		int o = scanner.nextInt();
		int count =0;
        for(int i = 0; i < o; i++){
        	if(a.containsKey(scanner.nextInt())) {
        		count++;
        	}
        }
		scanner.close();
        System.out.println(count);
	}
}


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

using namespace std;

#define int ll
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<double> vd;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<pi> vp;
typedef vector<pl> vpl;

const int mod = 1e9 + 7;

signed main()
{
    ios_base::sync_with_stdio(false); 
    cin.tie(nullptr); 
    cout.tie(nullptr); 
    cerr.tie(nullptr);    

    int n, k;
    cin >> n >> k;

    vi a(n);
    for (auto& i : a)
        cin >> i;

    int dp[n + 1][k + 1];
    int pref[n + 1][k + 1];
    for (int i = 0; i <= n; ++i){
        for (int j = 0; j <= k + 1; ++j){
            dp[i][j] = 0;
            pref[i][j] = 0;
        }
    }

    for (int j = 0; j <= n; ++j){
        dp[j][0] = 1;
    }

    pref[0][0] = 1;
    for (int j = 1; j <= k; ++j)
        pref[0][j] = 1;

    for (int i = 1; i <= n; ++i){
        for (int j = 1; j <= k; ++j){

            int z;
            if (j < a[i - 1] + 1)
                z = 0;
            else
                z = pref[i - 1][j - a[i - 1] - 1];
            dp[i][j] = (pref[i - 1][j] - z + 2 * mod) % mod;
        }

        pref[i][0] = dp[i][0];
        for (int j = 1; j <= k; ++j)
            pref[i][j] = (pref[i][j - 1] + dp[i][j] + 2 * mod) % mod;
    }

    cout << dp[n][k] << '\n';
}

Measured memory_bytes: 158080
#include <bits/stdc++.h>
#include <regex>
#define FOR(i, s, e) for (int i = int(s); i < int(e); ++i)
//#define FOR(i, s, e) for (ll i = ll(s); i < ll(e); ++i)
#define REP(i, e) FOR(i, 0, e)
#define INF (INT_MAX / 2)
#define LINF (LLONG_MAX / 2)
#define EPS (1.0e-8)
#define mkpr make_pair
#define AST(exp, msg) if(!(exp)){EPR((msg))} assert((exp));
#define TAST(exp, msg) if(!(exp)){EPR((msg))} while(!(exp)){}
#define EPR(msg) cerr << (msg) << endl;
using namespace std;
using ll = long long; using ull = unsigned long long;
using vi = vector<int>; using vvi = vector<vi>;
using vb = vector<bool>; using vvb = vector<vb>;
using vl = vector<ll>; using vvl = vector<vl>;
using vd = vector<double>; using vvd = vector<vd>;
using vc = vector<char>; using vvc = vector<vc>;
using vs = vector<string>;
using pli = pair<long, int>; 
using pll = pair<ll, ll>; using psl = pair<string, ll>;

void get_dist(vi& ds, vvi& es, int s) {
  const int N = es.size();
  queue<int> que;
  que.push(s);
  vb vis(N, false);
  ds = vi(N, INF);
  ds[s] = 0;
  while(!que.empty()) {
    int x = que.front(); que.pop();
    vis[x] = true;
    
    for (int nx : es[x]) {
      if (vis[nx]) continue;
      ds[nx] = min(ds[nx], ds[x]+1);
      que.push(nx);
    }
  }
}

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


  int N,X,Y; cin>>N>>X>>Y;
  X--;Y--;

  vvi es(N);
  REP(i,N-1) {
    es[i].push_back(i+1);
    es[i+1].push_back(i);
  }
  es[X].push_back(Y);
  es[Y].push_back(X);

  vi toX, fromY;
  get_dist(toX, es, X);
  get_dist(fromY, es, X);

  vvi dist(N, vi(N, INF));
  map<int, int> ans;
  REP(i,N) {
    FOR(j,i+1,N) {
      dist[i][j] = min(j-i, toX[i] + fromY[j]);
      dist[j][i] = dist[i][j];
      ans[dist[i][j]] += 1;
    }
  }

  FOR(k, 1, N) {
    cout << ans[k] << endl;
  }


  return 0;
}


Measured memory_bytes: 16256
n=int(input())

divisors = []
for i in range(1, int(n**0.5)+1):
    if n % i == 0:
        divisors.append(i)
        if i != n // i:
            divisors.append(n//i)

divisors.sort()
length=len(divisors)
if length == 2:
    A=str(divisors[0])
    B=str(divisors[1])
elif length%2 == 0:
    A=str(divisors[length//2-1])
    B=str(divisors[length//2])
else:
    A=str(divisors[length//2])
    B=str(divisors[length//2])

#print(A,B)

ans=max(len(A),len(B))
print(ans)

Measured memory_bytes: 63892
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("Failed to read bytes") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let r:usize = read();
    let g:usize = read();
    let b:usize = read();
    let n:usize = read();
    let mut cnt = 0;
    for i in 0..=n/r {
        for j in 0..=n/g {
            let tmp = r * i + j * g;
            if n >= tmp && (n - tmp) % b == 0 {
                cnt += 1;
            }
        }
    }
    println!("{}", cnt);
}


Measured memory_bytes: 2084
#include <iostream>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <queue>
#include <functional>
#include <string>
#include <stack>
#include <set>
#include <sstream>
#include <iomanip>
#include <limits>
#include <cstring>

using namespace std;

int main() {
	int i, N, x, sum;
	cin >> N;
	sum = 0;
	for (i = 0; i < N; i++) {
		cin >> x;
		sum += (x - 1);
	}
	cout << sum << endl;
}

Measured memory_bytes: 256
N,M,X = map(int,input().split())
CA= [list(map(int,input().split())) for i in range(N)]
ans = float('inf')
for i in range(2**N):
    ci = 0
    lista = [0 for i in range(M)]
    for j in range(N):
        if (i >> j)&1 == 1:
            ci += CA[j][0]
            for k in range(M):
                lista[k] += CA[j][k+1]
    if min(lista) >= X:
        ans = min(ans,ci)
if ans == float('inf'):
    print(-1)
else:
    print(ans)

Measured memory_bytes: 9228
#include <stdio.h>
#include <string.h>
  
int main(void) {
    char str[1001], order[10], tmp[1001];
    int q, a, b;
    int i;
     
    scanf("%s", str);
    scanf("%d", &q);
     
    while (q--){
        scanf("%s %d %d", order, &a, &b);
         
        if (strcmp(order, "print") == 0){
            for (i = a; i <= b; i++) printf("%c", str[i]);
            printf("\n");
        }
        else if (strcmp(order, "replace") == 0){
            scanf("%s", tmp);
            strncpy(&str[a], tmp, b-a+1);
        }
        else {
            strcpy(tmp, str);
            for (i = 0; i <= b-a; i++) tmp[a+i] = str[b-i];
            strcpy(str, tmp);
        }
    }
     
    return 0;
}

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

using namespace std;

int main()
{
	int n,m;
	cin>>n>>m;
	int first=n%2019,last=m%2019;
	
	if (m-n>=2019)
	    last=last+2019;
	
	int t=100000;
	for (int i=first;i<=last;++i){
		for (int j=first;j<=last;++j){
			if (i!=j){
				if (i%2019==0 || j%2019==0){
					cout<<0<<endl;
					return 0;
				}
			    t=min(t,(i*j)%2019);	
			}
		}
	}
	
	cout<<t<<endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = getInt(sc);
		int b = getInt(sc);

		int answer=1;
		while(true) {
			int tax8=answer*8/100;
			int tax10=answer*10/100;

			if(tax8==a&&tax10==b) {
				System.out.println(answer);
				break;
			}else if(tax8>a&&tax10>b) {
				System.out.println(-1);
				break;
			}
			answer++;

		}


	}

	/**
	 * *汎用メソッド <br>
	 * スキャナーからの入力値をlongで返却
	 *
	 * @return
	 */
	public static long getLong(Scanner sc) {

		return Long.parseLong(sc.next());
	}

	/**
	 * *汎用メソッド <br>
	 * スキャナーからの入力値をintで返却
	 *
	 * @return
	 */
	public static int getInt(Scanner sc) {

		return Integer.parseInt(sc.next());
	}

}


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

#define MAX 2000000
#define FOR(i,m,n) for(int i = (m); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define pb push_back
#define mp make_pair
#define fst first
#define snd second
#define all(v) v.begin(),v.end()


typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> ii;

int main(){
	
	int n,x, m[3][MAX];
	ll dp[3][MAX];
	cin>>n;

	REP(i,3*n){
		cin>>x;
		m[i%3][i/3]=x;
	}

	dp[0][0]=m[0][0];
	dp[1][0]=m[1][0];
	dp[2][0]=m[2][0];

	REP(i,n-1){
		dp[0][i+1]=m[0][i+1]+max(dp[1][i], dp[2][i]);
		dp[1][i+1]=m[1][i+1]+max(dp[2][i], dp[0][i]);
		dp[2][i+1]=m[2][i+1]+max(dp[0][i], dp[1][i]);
	}

	cout<<max(dp[0][n-1],max(dp[1][n-1],dp[2][n-1]))<<endl;
	


	return 0;
	
}

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

set<int> pos[128];

int main() {
    string s;
    cin >> s;
    for (int i = 0; i < s.size(); i++)
        pos[s[i]].insert(i + 1);
    string t;
    cin >> t;
    long long p   = 0;
    long long cnt = 0;
    for (char c : t) {
        if (pos[c].empty()) {
            cout << -1 << endl;
            return 0;
        }
        auto it = pos[c].lower_bound(p + 1);
        if (it == pos[c].end()) {
            p = *pos[c].begin();
            cnt++;
        } else {
            p = *it;
        }
    }
    cout << (cnt * s.size() + p) << endl;
}

Measured memory_bytes: 5248
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = (A); I < (B); ++I)
#define FORR(I,A,B) for(ll I=(B-1);I>=(A);I--)
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //ai>=v  x is sorted
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //ai>v  x is sorted
#define NUM(x,v) (POSU(x,v)-POSL(x,v))  //x is sorted
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define REV(x) (reverse(x.begin(),x.end())) //reverse
#define TO(x,t,f) ((x)?(t):(f))
#define CLR(mat) memset(mat, 0, sizeof(mat))
#define FILV(x,a) fill(x.begin(),x.end(),a)
#define FILA(ar,N,a) fill(ar,ar+N,a)
#define NEXTP(x) next_permutation(x.begin(),x.end())
ll gcd(ll a,ll b){if(a<b)swap(a,b);if(a%b==0)return b;else return gcd(b,a%b);}
ll lcm(ll a,ll b){ll c=gcd(a,b);return ((a/c)*(b/c)*c);}//saisyo kobaisu
#define pb push_back
#define pri(aa) cout<<(aa)<<endl
#define mp(x,y) make_pair(x,y)
#define fi first
#define se second
const ll INF=1e18+7;
const ll MOD=1e9+7;
const ll N = 1003;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll n,k;
	cin>>n>>k;
	if(n%k)pri(1);
	else pri(0);

}

Measured memory_bytes: 256
s=input()
q=int(input())

rev=0

left=""
right=""

for i in range(q):
    
    x = list(map(str,input().split()))
    
    if int(x[0]) == 1:
        rev ^= 1
        
    else:
        if int(x[1])-1 ^ rev == 0:
            left = x[2] + left
        else:
            right = right + x[2]
            
ans = left + s + right

if rev==1:
    ans=ans[::-1]
        
print(ans)


Measured memory_bytes: 175924
#include <iostream>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <complex>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <bitset>
#include <ctime>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cassert>
#include <cstddef>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <sstream>
#include <fstream>

using namespace std;
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define FOR(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define RREP(i, a) for(int (i) = (a) - 1; (i) >= 0; (i)--)
#define FORR(i, a, b) for(int (i) = (a) - 1; (i) >= (b); (i)--)
#define DEBUG(C) cerr << #C << " = " << C << endl;
using LL = long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<LL>;
using VVL = vector<VL>;
using VD = vector<double>;
using VVD = vector<VD>;
using PII = pair<int, int>;
using PDD = pair<double, double>;
using PLL = pair<LL, LL>;
using VPII = vector<PII>;
#define ALL(a) begin((a)), end((a))
#define RALL(a) rbegin((a)), rend((a))
#define SORT(a) sort(ALL((a)))
#define RSORT(a) sort(RALL((a)))
#define REVERSE(a) reverse(ALL((a)))
#define MP make_pair
#define FORE(a, b) for (auto &&a : (b))
#define FIND(s, e) ((s).find(e) != (s).end())
#define EB emplace_back

const int INF = 1e9;
const int MOD = INF + 7;
const LL LLINF = 1e18;

void solve(int a, int b, int c) {
    int me = 0;
    int v[] = {a, b};
    bool id = 0;
    set<int> se;
    for(int i = 0;;i++) {
        int st = 60 * i + c;
        while (true) {
            if (me + v[id] >= st) {
                if (!id) {
                    cout << st << endl;
                    return;
                }
                me += v[id];
                if (FIND(se, me % 60)) {
                    cout << -1 << endl;
                    return;
                }
                se.insert(me % 60);
                id = !id;
                break;
            }
            me += v[id];
            id = !id;
        }
    }
    return;
}

signed main(void) {
    int n, m, p, a, b, c, x, y, z, q;
    string s;
    bool f = false;
    while (cin >> n >> m >> p, n) {
        solve(n, m, p);
        return 0;
    }
}

Measured memory_bytes: 3112
#include <bits/stdc++.h>
using namespace std;
int main(void){
  int n,m,i,r,l,ans=0;
  cin >> n >> m;
  vector<int> g(n+3,0);
  for (i=0;i<m;i++){
    cin >> r >> l;
    g.at(r-1)++;
    g.at(l)--;
  }
  for (i=1;i<n;i++) g.at(i)+=g.at(i-1);
  for (i=0;i<n;i++) if (g.at(i)==m) ans++;
  cout << ans << endl;
  return 0;
}

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

int main() {
    long long n; cin >> n;
    
    long long mn = 0;
    for(long long a = 1; a * a <= n; ++a) {
        if(n % a == 0) mn = n / a;
    }
    
    int res = 0;
    while(mn) {
        mn /= 10;
        ++res;
    }
    
    cout << res << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <queue>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;

int main() {
    int n, m;
    cin >> n >> m;
    priority_queue<int> q;
    rep(i, n) {
        int a;
        cin >> a;
        q.push(a);
    }
    rep(i, m) {
        int a = q.top(); q.pop();
        q.push(a / 2);
    }
    ll ans = 0;
    rep(i, n) {
        ans += q.top(); q.pop();
    }
    cout << ans << endl;
    return 0;
}


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

using namespace std;

#define INF 1000000007
#define LINF (1LL << 62)
#define PI 3.14159265358979

typedef long long i64;
typedef pair<i64,i64> P;

inline i64 mod(i64 a, i64 m) { return (a % m + m) % m; }

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }



int n, k, a[101010];
void solve(){
	cin >> n >> k;
	for(int i = 0; i < n; i++){
		cin >> a[i];
	}
	
	k--;
	int ans = INF;
	for(int i = 0; i+k < n; i++){
		chmin(ans, a[i+k]-a[i]+min(abs(a[i+k]),abs(a[i])));
	}
	cout << ans << endl;
}

int main(){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	int t = 1;
	//cin >> t;
	while(t--){
		solve();
	}
	
	return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>

using namespace std;
typedef long long ll;

int main(){
  ll N;
  cin >> N;
  ll a[N];
  ll tab[100000];
  for(int i=1;i<100001;i++){
    tab[i]=0;
  }
  ll sum=0;
  for(ll i=0;i<N;i++){
    cin >> a[i];
    sum += a[i];
    tab[a[i]]++;
  }
  ll Q;
  cin >> Q;
  ll b[Q],c[Q];
  for(ll i=0;i<Q;i++){
    cin >> b[i] >> c[i];
  }
  ll change = 0;
  for(ll i=0;i<Q;i++){
    if(tab[b[i]]>0){
      tab[c[i]] += tab[b[i]];
      change = tab[b[i]]*(c[i]-b[i]);
      tab[b[i]] = 0;
    }
    sum = sum + change;
    cout << sum  << endl;
    change = 0;
  }
}


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

int main(){
  int Q;
  cin>>Q;
  int rmax;
  vector<int> qr(Q);
  vector<int> ql(Q);
  for(int i=0;i<Q;i++){
    cin>>ql[i]>>qr[i];
    if(qr[i]>rmax){
      rmax = qr[i];
    }
  }

  vector<int> prime;
  prime.push_back(2);
  for(int x=3;x<rmax+1;x++){
    bool pflag = true;
    for(auto n: prime){
      if(x%n==0){
        pflag = false;
        break;
      }
      if(x<n*n){
        break;
      }
    }
    if(pflag){
      prime.push_back(x);
    }
  }

  vector<int> acc(rmax+1, 0);
  for(int n=0;n<rmax+1;n++){
    if(find(prime.begin(),prime.end(),n)!=prime.end()
      && find(prime.begin(),prime.end(), (n+1)/2)!=prime.end()){
      acc[n] += 1;
    }
    if(n<rmax){
      acc[n+1] += acc[n];
    }
  }

  // for(auto x: prime){
  //   cout<<x<<" ";
  // }
  // cout<<endl;
  // for(auto x: acc){
  //   cout<<x<<" ";
  // }
  // cout<<endl;
  for(int i=0;i<Q;i++){
    cout<<acc[qr[i]]-acc[ql[i]-1]<<endl;
  }
}


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

Measured memory_bytes: 1152
#include <iostream>
#include <utility>
#include <cstdio>
#include <queue>
#include <stack>
#include <algorithm>
#include <numeric>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstring>
using namespace std;

#define ALL(a) (a).begin(), (a).end()

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

struct State {
    int v, cost;

    State(int v, int cost): v(v), cost(cost) {}

    // 昇順
    bool operator<(const State& s) const {
        return cost < s.cost;
    }
    // 降順
    bool operator>(const State& s) const {
        return cost > s.cost;
    }
};

void dump_vector(vector<int> vec) {
    for (int i = 0; i < vec.size(); i++) {
        cout << vec[i] << (i < vec.size() - 1 ? " " : "\n");
    }
}

int main() {
    int n, e = 0, o = 0;

    cin >> n;
    for (int i = 0; i < n; i++) {
        ll a;
        cin >> a;

        if (a % 2 == 0) e++;
        else o++;
    }
    if (o % 2 == 1) {
        cout << "NO" << endl;
    } else {
        cout << "YES" << endl;
    }

    return 0;
}


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

using namespace std;
int n,dat[100005];
long long res=0;
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++) scanf("%d",&dat[i]);
	for(int i=1;i<=n-1;i++)
	{
		res+=dat[i]/2;dat[i]%=2;
		if(dat[i+1]>dat[i]) dat[i+1]-=dat[i],res+=dat[i];
	}
	res+=dat[n]/2;
	printf("%lld",res);
	return 0;
}

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

int main() {

    int n; string s; cin >> n >> s;
    int cnt_w = 0;
    int cnt_b = 0;
    for (int i = 0; i < n; i++) {
        if (s[i] == '.') cnt_w++;
        if (s[i] == '#') cnt_b++;
    }
    vector<int> rev_accum_w(n + 1, 0);    
    for (int i = n - 1 ; i >= 0; i--) {
        if (s[i] == '.') rev_accum_w[i]++;
        if (i == n) continue;
        rev_accum_w[i] += rev_accum_w[i + 1];
    }
    vector<int> accum_b(n + 1, 0);
    for (int i = 1; i <= n; i++) {
        accum_b[i] += accum_b[i - 1];
        if (s[i - 1] == '#') accum_b[i]++;        
    }
    int ans = 100000000;
    for (int i = 0; i <= n; i++) {
        int tmp = 0;
        tmp += accum_b[i];
        tmp += rev_accum_w[i];
        ans = min(ans, tmp);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 5236
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define endl "\n"
#define speed() ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define sz(x) (int)(x).size()
#define _USE_MATH_DEFINES
using namespace std;
typedef long long int lli;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

int main() {
    speed();
    ll N, A, B; cin >> N >> A >> B;
    ll ans = N / (A+B)*A;
    ll rem = N % (A+B);
    ans += min(rem, A);
    cout << ans << endl;
    return 0;
}

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

namespace ConsoleApp112 {
    class Program {
        static void Main(string[] args) {
            var st = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int N = st[0];
            int W = st[1];

            var w = new int[N];
            var v = new int[N];

            for (int i = 0; i < N; i++) {
                var x = Console.ReadLine().Split().Select(int.Parse).ToArray();
                w[i] = x[0];
                v[i] = x[1];
            }

            var dp = new long[N + 2, W + 2];

            for (int i = 0; i < N; i++) {
                dp[i, 0] = 0;
            }

            for (int j = 0; j <= W; j++) {
                if (j >= w[0]) {
                    dp[0, j] = v[0];
                } else {
                    dp[0, j] = 0;
                }
            }

            for (int i = 0; i < N - 1; i++) {
                for (int j = 0; j <= W; j++) {
                    if (j - w[i + 1] >= 0) {
                        dp[i + 1, j] = Math.Max(
                                                dp[i + 1, j], 
                                                dp[i, j - w[i + 1]] + v[i + 1]
                                                                                );
                    }
                    dp[i + 1, j] = Math.Max(dp[i + 1, j], dp[i, j]);
                }
            }

            Console.WriteLine(dp[N - 1, W]);
        }
    }
}


Measured memory_bytes: 92768
#include<iostream>
#include<algorithm>
#include<string.h>
#include<string>
#include<cmath>
#include<cstdlib>
#include<vector> 

using namespace std;

int main() {
	int s[4];
	for (int i = 0; i < 4; i++) {
		cin >> s[i];
	}
	int x, y, ans;
	if (s[0] > s[2])x = s[0];
	if (s[0] < s[2])x = s[2];
	if (s[1] > s[3])y = s[3];
	if (s[1] < s[3])y = s[1];
	ans = y - x;
	if (ans >= 0)cout << ans << endl;
	if (ans < 0)cout << "0" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <stdio.h>
#include <time.h>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
# define ll int64_t
# define rep(i,n) for(ll i=0;i<n;i++)
# define rrep(i,n) for(ll i=1;i<=n;i++)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
# define mod 1000000007
# define PI 3.141592653589793
# define vec vector
#define dump(x) cerr<<#x<<"="<<x<<endl
using namespace std;

bool compare_by_b(pair<string,ll> a,pair<string,ll> b){
    if(a.second != b.second) return a.second<b.second;
    else return a.first<b.first;
}

bool my_compare(pair<string,ll> a,pair<string,ll> b){
    if(a.first != b.first) return a.first<b.first;
    if(a.second != b.second) return a.second>b.second;
    else return true;
}

ll factorial(ll n){
    ll x=1;
    rrep(i,n) (x*=i)%=mod;
    return x;
}

ll gcd(ll a,ll b){
   if (a%b == 0) return(b);
   else return(gcd(b,a%b));
}

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



int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    ll n,k,r,s,p;
    cin>>n>>k>>r>>s>>p;
    string t;
    cin>>t;
    vec<ll> a(n,0);
    
    rep(i,n){
        if(i<k) a[i]=1;
        else{
            if(t[i]!=t[i-k]) a[i]=1;
            
            if(i>=2*k){
                if(a[i-k]!=a[i-2*k] && a[i]==a[i-k]){
                    if(t[i-k]==t[i-2*k] && t[i]==t[i-k]) a[i]=1;
                }
            }
        }
    }
    ll sum=0;
    rep(i,n){
        if(a[i]==1){
            if(t[i]=='r') sum+=p;
            else if(t[i]=='s') sum+=r;
            else sum+=s;
        }
    }
    cout<<sum<<endl;
    return 0;
}


Measured memory_bytes: 1232
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fi first
#define se second

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
	ll n,m,k;
	cin>>n>>m>>k;
	vector<ll> a(n),b(m);
	for(int i=0;i<n;i++) cin>>a[i];
	for(int i=0;i<m;i++) cin>>b[i];
	for(int i=1;i<n;i++) a[i]=a[i-1]+a[i];
	for(int i=1;i<m;i++) b[i]+=b[i-1];
	ll ans=0;
	for(int i=0;i<n;i++){
	    if(a[i]<=k){
	        ll rem=k-a[i];
	        auto it=lower_bound(b.begin(),b.end(),rem);
	        ll ind=it-b.begin();
	        if(it==b.end()){
	            ans=max(ans,m+i+1);
	        }else{
	            if(b[ind]>rem){
	                ind--;
	            }
	            ans=max(ans,i+1+ind+1);
	        }
	    }
	}
	if(a[0]>k){
		auto it=lower_bound(b.begin(),b.end(),k);
		if(it==b.end()) ans=m-1;
		else{
			ans=it-b.begin();
			if(b[ans]>k) ans--;
		}
		cout<<ans+1;
		return 0;
	}
	auto it=lower_bound(b.begin(),b.end(),k);
	ll in=it-b.begin();
	if(it==b.end()) in=m-1;
		else{
			in=it-b.begin();
			if(b[in]>k) in--;
		}
		ans=max(ans,in+1);
	cout<<ans;
    return 0;
}


Measured memory_bytes: 6328
#include<bits/stdc++.h>
#define rep(i,b) for(int i=1;i<=b;i++)
#define drep(i,b) for(int i=b;i>=1;i--)
#define Rep(i,a,b) for(int i=a;i<=b;i++)
#define int long long
#define endl '\n'
using namespace std;
const int N=2e5+5;
const int mod=1e9+7;
int n,m,k,t,x,y,z;
//pr
//
#define mid (l+r)/2
#define ls i<<1
#define rs i<<1|1
//vec
//alg


void solve(int sum=0) {
    int a,b;
    cin>>n;
    cin>>a>>b;
    if(a%n==0) {
        cout<<"OK"<<endl;
        return ;
    }
    n=n*(a/n+1);
    if(n<=b) cout<<"OK"<<endl;
    else cout<<"NG"<<endl;
}

#undef int
int main() {
    ios::sync_with_stdio(false);
    //int T;cin>>T;
    //while(cin>>n>>m)
        solve();
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i, a, b) for (int i = (a); i < int(b); ++i)
#define RFOR(i, a, b) for (int i = (b)-1; i >= int(a); --i)
#define rep(i, n) FOR(i, 0, n)
#define rep1(i, n) FOR(i, 1, int(n) + 1)
#define rrep(i, n) RFOR(i, 0, n)
#define rrep1(i, n) RFOR(i, 1, int(n) + 1)
#define all(c) begin(c), end(c)
const int MOD = 1000000007;

template <typename T>
void __dump__(std::ostream &os, const T &first) {
    os << first;
}
template <typename First, typename... Rest>
void __dump__(std::ostream &os, const First &first, const Rest &... rest) {
    os << first << ", ";
    __dump__(os, rest...);
}
#define dump(...)                                         \
    do {                                                  \
        std::ostringstream os;                            \
        os << __LINE__ << ":\t" << #__VA_ARGS__ << " = "; \
        __dump__(os, __VA_ARGS__);                        \
        std::cerr << os.str() << std::endl;               \
    } while (0)

#define int ll

signed main() {
    int N, T;
    while (cin >> N >> T) {
        int ans = 0;
        int prev = -1;
        rep (i, N) {
            int t;
            cin >> t;
            if (i != 0) {
                int add = min(T, t - prev);
                dump(i, add);
                ans += add;
            }
            prev = t;
        }
        cout << ans + T << endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define itn int
typedef long long ll;
int n;
void getans(string sn,char nw){
	if(sn.size()==n){
		cout<<sn<<'\n';
		return;
	}
	for(char nwi='a';nwi<nw;nwi++){
		getans(sn+nwi,nw);
	}
	getans(sn+nw,nw+1);
}
int main(){
	cin>>n;
	getans("",'a');
	return 0;
}


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

using namespace std;

int main() {
	int w, h, n;
	cin >> w >> h >> n;
	int b = 0, c = 0;
	for (int i = 0; i < n; i++) {
		int x, y, a;
		cin >> x >> y >> a;
		if (a == 1) {
			b = max(b, x);
		}
		else if (a == 2) {
			w = min(w, x);
		}
		else if (a == 3) {
			c = max(c, y);
		}
		else {
			h = min(h, y);
		}

	}
	cout << max(0, w - b)*max(0, h - c) << endl;
	return 0;
}

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

int main(){
	long long int a,b,c,d;
	cin >> a;
	cin >> b;
	cin >> c;
	cin >> d;
	long long int prod[4];
	int i;
	prod[0] = a * c;
	prod[1] = a * d;
	prod[2] = b * c;
	prod[3] = b * d;
	long long int maxi = prod[0];
	for(i=0;i<4;i++){
		if(maxi<=prod[i]){
			maxi = prod[i];
		}
	}
	cout << maxi << endl;
	return 0;
}

Measured memory_bytes: 3620
import scala.io.StdIn._

object Main extends App {
  val Array(n,k) = readLine().split(" ").map(_.toInt)
  val Array(r,s,p) = readLine().split(" ").map(_.toInt)
  val T = readLine().split("")

  def solve() = {
    val scoreMap = Map("r" -> r, "s" -> s, "p" -> p)
    val myHands = Array.fill(n)("")
    T.zipWithIndex.foldLeft(0) { case (acc, (t, i)) =>
      if(i < k) {
        myHands(i) = winHandMap(t)
        acc + scoreMap(winHandMap(t))
      }
      else {
        if(myHands(i-k) != winHandMap(t)) {
          myHands(i) = winHandMap(t)
          acc + scoreMap(winHandMap(t))
        } else {
          myHands(i) = if(i+k < n) nonWinHand(t, Some(T(i+k))) else nonWinHand(t)
          acc
        }
      }
    }
  }

  def winHandMap(machineHand: String): String = {
    val winHand = Map("r" -> "p", "s" -> "r", "p" -> "s")
    winHand(machineHand)
  }

  def nonWinHand(machineHand: String, machineNextHand: Option[String] = None): String = {
    val hands = Seq("r", "s", "p")
    if(machineNextHand.isEmpty) machineHand
    else hands.diff(Seq(winHandMap(machineHand), winHandMap(machineNextHand.get))).head
  }

  println(solve())

}



Measured memory_bytes: 75416
N, M = map(int, input().split())
A = list(map(lambda x: int(x), input().split()))
Q = []

for i in range(M):
    Q.append(tuple(map(int, input().split())))

A.sort()

Q.sort(key=lambda x: x[1], reverse=True)

cur = 0
for i in range(M):
    cnt = Q[i][0]
    while cnt > 0 and cur < N:
        if A[cur] >= Q[i][1]:
            break
        A[cur] = Q[i][1]
        cur += 1
        cnt -= 1

print(sum(A))

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

int N, M;
typedef pair<int, int> pint;

vector<pint> A;
bool cmp(pint a, pint b) { return a.second < b.second ;}

int main(){
    cin >> N >> M;
    A.resize(M);
    for(int i = 0; i < M; ++i) cin >> A[i].first >> A[i].second;
    sort(A.begin(), A.end(), cmp);
    int res = 0;
    int endtime = 0;
    for(int i = 0; i < M; ++i){
        if (A[i].first >= endtime) {
            endtime = A[i].second;
            ++res;
        }
    }

    cout << res << endl;
}

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

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;
#define NIL NULL

Node root;

void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;

  while (x != NIL) {
    y = x;
    if (z->key < x->key) {
      x = x->left;
    } else {
      x = x->right;
    }
  }
  z->parent = y;

  if (y == NIL) {
    root = z;
  } else if (z->key < y->key) {
    y->left = z;
  } else {
    y->right = z;
  }
}

void inorder(Node u){
  if (u == NIL) return;
  inorder(u->left);
  printf(" %d", u->key);
  inorder(u->right);
}

void preorder(Node u){
  if (u == NIL) return;
  printf(" %d", u->key);
  preorder(u->left);
  preorder(u->right);
}


int main(void) {
  int n, i, x;
  char com[20];
  scanf("%d", &n);

  for (i = 0; i < n; i++) {
    scanf("%s", com);
    if (com[0] == 'f') {
    } else if (com[0] == 'i') {
      scanf("%d", &x);
      insert(x);
    } else if (com[0] == 'p') {
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    } else if (com[0] == 'd') {

    }
  }

  return 0;
}



Measured memory_bytes: 25128
N = int(input())
A = [int(a) for a in input().split()]
A.insert(0, 0)
A.append(0)

B = []
for i in range(len(A)-1):
  B.append(A[i+1] - A[i])

B_abs = [abs(b) for b in B]
B_abs_cusum = [0]
cusum = 0
for j in B_abs:
  cusum += j
  B_abs_cusum.append(cusum)

for k in range(1, N+1):
  M1 = B_abs_cusum[k-1]
  M2 = abs(B[k-1] + B[k])
  M3 = B_abs_cusum[-1] - B_abs_cusum[k+1]
  M = M1 + M2 + M3
  print(M)

Measured memory_bytes: 18640
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define fin(ans) cout<<(ans)<<endl
#define STI(s) atoi(s.c_str())
#define mp(p,q) make_pair(p,q)
#define pb(n) push_back(n)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define Sort(a) sort(a.begin(),a.end())
#define Rort(a) sort(a.rbegin(),a.rend())
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
const int P = 1000000007;
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;


int main(void){ios::sync_with_stdio(false);cin.tie(0);
//////////////////////////////////////////////////////
    
    int n;
    cin>>n;
    int odd=0,even=0;
    for(int i=1;i<=n;i++){
        if(i%2==0)even++;
        else odd++;
    }
    printf("%.7f\n",(double)odd/n);
    
//////////////////////////////////////////////////////
return 0;}


Measured memory_bytes: 256
#include <stdio.h>

int main(void){
    char S[3];
    int whenSun;
    
    /* input */
    scanf("%s", S);

    switch(S[0]){
    case 'S':
        if(S[1]=='U'){ /* 'SU'N */
            whenSun = 7;
        }else{         /* 'SA'T */
            whenSun = 1; 
        }
        break;
    case 'M':          /* 'M'ON */
        whenSun =6; 
        break;
    case 'T':
        if(S[1]=='U'){ /* 'TU'E */
            whenSun = 5;
        }else{         /* 'TH'U */
            whenSun = 3;
        }

        break;
    case 'W':        /* 'W'ED */
        whenSun = 4;
        break;
    case 'F':        /* 'F'RI */
        whenSun = 2;
        break;
    }

    /* output */
    printf("%d\n", whenSun);

    return 0;
}


Measured memory_bytes: 128
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder.Abc
{
    class QuestionB
    {
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            // 整数配列の入力
            var inputLongArray = Console.ReadLine().Split(' ').Select(q => long.Parse(q)).ToArray();

            var a = inputLongArray[0];
            var b = inputLongArray[1];
            var c = inputLongArray[2];
            var d = inputLongArray[3];

            string result = "No";

            var turn1 = (a + d - 1) / d;
            var turn2 = (c + b - 1) / b;

            if(turn1 >= turn2) {
                result = "Yes";
            }

            Console.WriteLine(result);

            Console.Out.Flush();
        }
    }
}


Measured memory_bytes: 28224
h, w = map(int, input().split())
c = [list(map(int, input().split())) for _ in range(10)]
a = [list(map(int, input().split())) for _ in range(h)]
for k in range(10):
    for i in range(10):
        for j in range(10):
            c[i][j] = min(c[i][j], c[i][k] + c[k][j])
ans = 0
for i in range(h):
    for j in range(w):
        if a[i][j] != -1:
            ans += c[a[i][j]][1]
print(ans)

Measured memory_bytes: 3444
#include <iostream>
#include<vector>
using namespace std;
int main() 
{
    int n;
    cin>>n;
    vector<int>v;
    for(int i=0;i<n;i++)
    {
        int x;
        cin>>x;
        v.push_back(x);
    }
    int dp[100000];
    dp[0]=0;
    dp[1]=abs(v[0]-v[1]);
    for(int i=2;i<n;i++)
    {
        dp[i]=min( abs(v[i]-v[i-2])+dp[i-2] , abs(v[i]-v[i-1])+dp[i-1] );
    }
    cout<<dp[n-1];
}


Measured memory_bytes: 3712
#include<cstdio>

int main(){
    int n;
    int ans=0;
    int a, b;
    scanf("%d",&n);
    for(int i=1;i<=n;i++){
        scanf("%d%d",&a,&b);
        ans=ans+b-a+1;
    }
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
//#define cerr if (false) cerr
#define db(x) cerr << #x << "=" << x << endl
#define db2(x, y) cerr << #x << "=" << x << "," << #y << "=" << y << endl
#define db3(x, y, z) cerr << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z << endl
#define dbv(v) cerr << #v << "="; for (auto _x : v) cerr << _x << ", "; cerr << endl
#define dba(a, n) cerr << #a << "="; for (int _i = 0; _i < (n); ++_i) cerr << a[_i] << ", "; cerr << endl
template <typename A, typename B>
ostream& operator<<(ostream& os, const pair<A, B>& x) {
	return os << "(" << x.first << "," << x.second << ")";
}
typedef long long ll;
typedef long double ld;
int main() {
	int n;
	scanf("%d", &n);
	vector<int> X(n), Y(n), P(n), ids(n);
	for (int i = 0; i < n; ++i) {
		scanf("%d%d%d", &X[i], &Y[i], &P[i]);
		ids[i] = i;
	}
	sort(ids.begin(), ids.end(), [&](int a, int b) {
		return X[a] < X[b];
	});
	const ll INF = 1LL << 60;
	vector<ll> ans(n + 1, INF);
	for (int b = 0; b < (1 << n); ++b) {
		vector<int> dy(n);
		vector<vector<ll>> C(n + 2, vector<ll>(n + 2));
		vector<vector<ll>> dp(n + 2, vector<ll>(n + 2, INF));
		for (int i = 0; i < n; ++i) {
			dy[i] = min(abs(Y[i]), abs(X[i]));
			for (int j = 0; j < n; ++j) {
				if (b & (1 << j)) {
					dy[i] = min(dy[i], abs(Y[i] - Y[j]));
				}
			}
		}
		for (int i = 0; i < n; ++i) {
			for (int j = i + 1; j <= n + 1; ++j) {
				for (int k = i; k + 1 < j; ++k) {
					int val = dy[ids[k]];
					if (i) val = min(val, X[ids[k]] - X[ids[i - 1]]);
					if (j <= n) val = min(val, X[ids[j - 1]] - X[ids[k]]);
					C[i][j] += (ll)val * P[ids[k]];
				}
			}
		}
		int t = __builtin_popcount(b);
		dp[0][t] = 0;
		for (int i = 1; i <= n + 1; ++i) {
			for (int u = t; u <= n; ++u) {
				for (int j = 0; j < i; ++j) {
					if (u && i != n + 1) dp[i][u] = min(dp[i][u], dp[j][u - 1] + C[j][i]);
					if (i == n + 1) dp[i][u] = min(dp[i][u], dp[j][u] + C[j][i]);
				}
			}
		}
		for (int u = t; u <= n; ++u) ans[u] = min(ans[u], dp[n + 1][u]);
	}
	for (int u = 0; u <= n; ++u) printf("%lld\n", ans[u]);
}


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

typedef long long ll;
typedef long double ld;
typedef vector<ll> v1;
typedef vector<v1> v2;

typedef unordered_map<ll, unordered_map<ll, ll>> graph;

const ll INF = 1ll << 50;
const ll mod = 1000000007;

ll n,k,c;
string s;
ll dplr[2*100000+3];
ll dprl[2*100000+3];
ll ans[2*100000+3];
priority_queue<ll,v1,greater<ll>> pq;

int main(){
    cin >> n >> k >> c;
    cin >> s;
    dplr[0] = 1;
    for(ll i = 1;i < n;i++){
        if(s[i] == 'x'){
            dplr[i] = max(dplr[i], dplr[i-1]);
            // cerr << dplr[i] << " ";
            continue;
        }
        if(i-c-1 >= 0){
            dplr[i] = max(dplr[i], dplr[i-1]);
            dplr[i] = max(dplr[i], dplr[i-c-1]+1);
        }else{
            dplr[i] = max(dplr[i], dplr[i-1]);
        }
        // cerr << dplr[i] << " ";
    }
    // cerr << endl;
    dprl[n-1] = 1;
    for(ll i = n-1-1;i >= 0;i--){
        if(s[i] == 'x'){
            dprl[i] = max(dprl[i], dprl[i+1]);
            // cerr << dprl[i] << " ";
            continue;
        }
        if(i+c+1 <= n-1){
            dprl[i] = max(dprl[i], dprl[i+1]);
            dprl[i] = max(dprl[i], dprl[i+c+1]+1);
        }else{
            dprl[i] = max(dprl[i], dprl[i+1]);
        }
        // cerr << dprl[i] << " ";
    }
    // cerr << endl;

    for(ll i = 0;i+1 < n;i++){
        if(dprl[i+1] >= k){
            ans[i] = 1;
        }
    }
    for(ll i = n-1;i-1 >= 0;i--){
        if(dplr[i-1] >= k){
            ans[i] = 1;
        }
    }
    for(ll i = 0;i < n;i++){
        pq.push(i);
    }
    for(ll i = 0;i < n;i++){
        if(i+c+1 > n-1){
            break;
        }
        if(dplr[i]+dprl[i+c+1] >= k){
            while(!pq.empty() && pq.top() < i+1) pq.pop();
            while(!pq.empty() && pq.top() < i+c+1){
                ans[pq.top()] = 1;
                pq.pop();
            }

        }

    }
    for(ll i = 0;i < n;i++){
        pq.push(i);
    }
    for(ll i = 0;i < n;i++){
        if(i+c+2 > n-1){
            break;
        }
        if(dplr[i]+dprl[i+c+2] >= k){
            while(!pq.empty() && pq.top() < i+1) pq.pop();
            while(!pq.empty() && pq.top() < i+c+2){
                ans[pq.top()] = 1;
                pq.pop();
            }

        }

    }
    for(ll i = 0;i < n;i++){
        if(ans[i] == 0 && s[i] == 'o'){
            cout << i+1 << endl;
        }
    }


}


Measured memory_bytes: 7288