akhauriyash/Code-Regression huggingface dataset:
#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 <time.h>
#define int long long
#define endl '\n'
#define INF 1000000000000000000
#define EPS 1e-10
#define PI 3.141592653589793238
#define all(a) a.begin(),a.end()
#define rep(i, n) for (int i = 0; i < (n); i++)
#define fi first
#define se second
#define pb push_back
#define double long double
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;
typedef complex<double> com;
template<class T, class S> bool chmax(T &a, const S &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T, class S> bool chmin(T &a, const S &b) { if (a > b) { a = b; return 1; } return 0; }
ll gcd(ll n, ll m) { return (m ? gcd(m, n%m) : n); }
ll lcm(ll n, ll m) { return n / gcd(n, m)*m; }

vector<vector<int>> solve(int n) {
	vector<vector<int>> res(n, vector<int>(n));
	if (n == 2) {
		res[1][1] = 1;
		return res;
	}
	int m = n / 2;
	vector<vector<int>> pre = solve(m);
	rep(i, n) {
		rep(j, n) {
			if (i >= m && j >= m) {
				res[i][j] = pre[i%m][j%m] ^ 1;
			}
			else {
				res[i][j] = pre[i%m][j%m];
			}
		}
	}
	return res;
}

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(20);
	//modcalc();

	int n, m;
	cin >> n >> m;
	int x = (1 << n);
	int y = (1 << m);
	int z = min(x, y);
	vector<vector<int>> sum(x, vector<int>(y));
	vector<vector<int>> tmp = solve(z);
	rep(i, x) {
		rep(j, y) {
			sum[i][j] = tmp[i%z][j%z];
		}
	}
	vector<vector<int>> ans(x - 1, vector<int>(y - 1));
	rep(i, x - 1) {
		rep(j, y - 1) {
			ans[i][j] = (sum[i][j] + sum[i][j + 1] + sum[i + 1][j] + sum[i + 1][j + 1]) % 2;
			cout << ans[i][j];
		}
		cout << endl;
	}
}

Measured memory_bytes: 25908
# include <iostream>

using namespace std;

int main()
{
	int N;
	int* L;

	cin >> N;

	L = new int[N];

	for (int i = 0; i < N; i++)
	{
		cin >> L[i];
	}

	int triangle=0;

	for (int i = 0; i < N-2; i++)
	{
		for (int j = i+1; j < N-1; j++)
		{
			for (int k = j+1; k < N; k++)
			{
				if (L[i] + L[j] > L[k] && L[i] + L[k] > L[j] && L[j] + L[k] > L[i])
				{
					if (L[i] != L[j] && L[i] != L[k] && L[j] != L[k])
					{
						triangle++;
					}
				}

			}
		}
	}

	cout << triangle;

	return 0;
}

Measured memory_bytes: 3640
#include <stdio.h>
#define N 8

int col[N],dpos[N+N],dneg[N+N],row[N], x[N], y[N];
char h[N][N];

void printBoard()
{
  int i, j;
  for( i=0 ; i<N ; i++ ){
    for( j=0 ; j<N ; j++ ){
      if(h[i][j]=='Q' && row[i]!=j)
	return;
    }
  }
  for( i=0 ; i<N ; i++ ){
    for( j=0 ; j<N ; j++ ){
      if(row[i]==j)
	printf("Q");
      else
	printf(".");
    }
    printf("\n");
  }
}

void putQueen(int i)
{
  int j, k=0;
  if(i==N){
    printBoard();
    return;
  }

  for( j=0 ; j<N ; j++ ){
    
    if(col[j]==1 || dpos[i+j]==1 || dneg[i-j+N-1]==1)
      continue;
    
    row[i] = j;
    col[j] =1;
    dpos[i+j] = 1;
    dneg[i-j+N-1] = 1;
    
    putQueen(i+1);
    
    row[i] = 0;
    col[j] =0;
    dpos[i+j] = 0;
    dneg[i-j+N-1] = 0;
  }
}

int main()
{
  int k, i, j;

  scanf("%d",&k);
  for( i=0 ; i<N ; i++ ){
    for( j=0 ; j<N ; j++ ){
    h[i][j] = '.';
    }
  }
  for( i=0 ; i<N+N ; i++ ){

    dpos[i]=0;
    dneg[i]=0;
  }
  
  for( i=0 ; i<N ; i++ ){
    col[i] = 0;
    row[i] = 0;
  }
  
  for( i=0 ; i<k ; i++ ){
    scanf("%d %d",&x[i],&y[i]);
    h[x[i]][y[i]] = 'Q';
  }
  

  putQueen(0);


  return 0;
}

Measured memory_bytes: 572
import math
n = int(input())
 
def koch(n, p1_x, p2_x, p1_y, p2_y):
  if n == 0:
    return
 
  s_x = (2*p1_x + p2_x) / 3
  s_y = (2*p1_y + p2_y) / 3
  t_x = (p1_x + 2*p2_x) / 3
  t_y = (p1_y + 2*p2_y) / 3
 
  u_x = (t_x - s_x)/2 - (t_y - s_y) * math.sqrt(3)/2 + s_x
  u_y = (t_x - s_x) * math.sqrt(3)/2 + (t_y - s_y)/2 + s_y
 
  koch(n-1, p1_x, s_x, p1_y, s_y)
  print (s_x, s_y)
  koch(n-1, s_x, u_x, s_y, u_y)
  print (u_x, u_y)
  koch(n-1, u_x, t_x, u_y, t_y)
  print (t_x, t_y)
  koch(n-1, t_x, p2_x, t_y, p2_y)
 
p1_x = 0.0
p1_y = 0.0
p2_x = 100.0
p2_y = 0.0
 
print (p1_x, p1_y)
koch(n, 0, 100, 0, 0)
print (p2_x, p2_y)

Measured memory_bytes: 7856
#include <algorithm>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <cstdio>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>

using namespace std;

int main(int argc, char *argv[])
{
  int n,  ans = 1;
  long long a[200000], b[200000];
  cin >> n;

  cin >> a[0];
  for (int i = 1; i < n; i++) {
    cin >> a[i];
    b[i] = a[i] - a[i-1];
  }

  int dig = 0;
  for (int i = 1; i < n; i++) {
    if (dig == 0) {
      if (!b[i]) continue;
      dig = b[i];
    } else if (dig * b[i] < 0) {
      ans++;
      dig = 0;
    }
  }

  printf("%d\n", ans);
  return 0;
}


Measured memory_bytes: 3072
// {{{
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdint>
#include <cstdio>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;
// }}}

using ll = long long;

int N;
int A[2][100];

int dp[2][100];

int main() {
    cin >> N;
    for (int j = 0; j < N; ++j) cin >> A[0][j];
    for (int j = 0; j < N; ++j) cin >> A[1][j];

    dp[0][0] = A[0][0];
    for (int j = 1; j < N; ++j) dp[0][j] = dp[0][j-1] + A[0][j];
    dp[1][0] = A[1][0] + A[0][0];
    for (int j = 1; j < N; ++j) dp[1][j] = A[1][j] + max(dp[1][j-1], dp[0][j]);
    cout << dp[1][N-1] << endl;

    return 0;
}
	


Measured memory_bytes: 764
#include <iostream>
#include <algorithm>

using namespace std;
typedef long long ll;
const int N = 100010;
ll a[N];
int cnt;

void dfs(ll u)
{
    if(u>3234566667) return;
    a[cnt++] = u;
    ll tmp = u%10;
    dfs(u*10+tmp);
    if(tmp!=0) dfs(u*10+tmp-1);
    if(tmp!=9) dfs(u*10+tmp+1);
}

int main()
{
    int k;
    cin >> k;
    for(int i=1;i<=9;i++) dfs(i);
    sort(a,a+cnt);
    cout << a[k-1] << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
 
int main() {
 
   ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
   
 	ll ans=0,i,l;//,s;
 	
 	cin >> l;
 	
 	for(i=1; i<=l; i++){
 		
 		//s=i;
 		
 		if(i%3==0||i%5==0){
		 ans=ans+0;
		 }else{
		 ans=ans+i;	
		 }
		 
	 }
	 
	 cout << ans << endl;
 	
return 0;   
}


Measured memory_bytes: 3668
#include <iostream>
#include <string>

using namespace std;

int main(){
    int a[5];
    int k;
    int count=0;
    for (int i=0; i<5; i++) cin >> a[i];
    cin >> k;
    for (int i=0; i<5; i++){
        for (int j=i+1; j<5; j++){
            if (abs(a[j] - a[i]) > k) count = count + 1;
        }
    }
    if (count == 0) cout << "Yay!" << endl;
    else cout << ":(" << endl;
    
}

Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <vector>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define Sort(Array) sort(Array.begin(), Array.end())
#define Reverse(a) reverse(a.begin(), a.end())
#define out(ans) cout << ans << endl;
const int MOD = 1000000007;
const int INF = 2147483647;

//------------↓------------- M -------------- E ---------------- M --------------- O ---------------↓--------------//
// コンパイル 
// g++ -std=c++1z
//
// -------型変換--------
// int を string に変換
// string s = to_string(n);
// string を int に変換
// int n = stoi(s);
//
// -------二分探索---------
// k以上の値が最初に現れる時のイテレータ
// lower_bound(data.begin(), data.end(), k)
// kより大きい値が最初の現れる時のイテレータ O(logN)
// upper_bound(data.begin(), data.end(), k)
// kがdataに存在するかをtrue or falseで返す O(logN)
// binary_search(data.begin(), data.end(), k)
// 
//
//
//
//
//
// 
//------------↑------------- M -------------- E ---------------- M --------------- O ---------------↑--------------//






int main() {

    string s; cin >> s;
    Sort(s);
    if (s == "abc") cout << "Yes" << endl;
    else cout << "No" << endl;


    return 0;
}







Measured memory_bytes: 760
package main

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

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

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

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer([]byte{}, 1000000)

	N, s := getInt(), getString()

	e := make([]int, N)
	w := make([]int, N)
	sume := 0
	sumw := 0
	for i := 0; i < N; i++ {
		if s[i] == 'W' {
			sume++
		}
		if s[N-1-i] == 'E' {
			sumw++
		}
		e[i] = sume
		w[N-1-i] = sumw
	}

	m := N + 100000
	for i := 0; i < N; i++ {
		if e[i]+w[i] < m {
			m = e[i] + w[i]
		}
	}
	//out(e)
	//out(w)
	out(m - 1)
}


Measured memory_bytes: 6656
#include<bits/stdc++.h>
using namespace std;
int main(){
  cin.tie(NULL);
  ios::sync_with_stdio(false);
  int a,b,c,d;
  cin>>a;
  if(a<1000) cout<<"ABC"<<'\n';
  else cout<<"ABD"<<'\n';
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
#define MOD 1000000007
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3f
#define EPS (1e-10)
using namespace std;
typedef long long ll;
typedef pair<int,int>P;

int c[5][5];
int a[5],b[5];

signed main(){
	rep(i,3)rep(j,3)cin>>c[i][j];
	for(int i=-2000;i<=2000;i++){//a[0]
		rep(j,3)b[j]=c[0][j]-i;
		rep(j,3)a[j]=c[j][0]-b[0];
		bool flag=true;
		rep(j,3)rep(k,3){
			if(a[j]+b[k]!=c[j][k]){
				flag=false;
			}
		}
		if(flag){
			puts("Yes");return 0;
		}
	}
	puts("No");
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>

using namespace std;

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

int main(){
    int k;
    cin >> k;
    long long sum = 0;
    for (int i=1; i<=k; i++){
        for (int j=1; j<=k; j++){
            for (int l=1; l<=k; l++){
                sum += gcd(i, gcd(j,l));
            }
        }
    }
    cout << sum << endl;
}

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

int main(){
	char f[10];
	char ans;

	while( cin >> f ){
		ans = 'd';
		for(int i=0 ; i < 3 ; ++i ){
			if( f[i*3+0] == f[i*3+1] && f[i*3+1] == f[i*3+2] && f[i*3+0] != 's' )
				ans = f[i*3+0];
			if( f[0*3+i] == f[1*3+i] && f[1*3+i] == f[2*3+i] && f[0*3+i] != 's' )
				ans = f[i];
		}
		if( f[0] == f[4] && f[4] == f[8] && f[0] != 's' )
				ans = f[0];
		if( f[2] == f[4] && f[4] == f[6] && f[2] != 's' )
				ans = f[2];
		cout << ans << endl;
	}
}

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

//#pragma GCC optimize("O3")
//#pragma GCC target("sse4")

#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define RFOR(i, b, a) for(int i = (b) - 1; i >= (a); --i)
#define ITER(it, a) for(__typeof(a.begin()) it = a.begin(); it != a.end(); it++)
#define FILL(a, value) memset(a, value, sizeof(a))

#define SZ(a) (int)((a).size())
#define ALL(a) a.begin(), a.end()
#define PB push_back
#define MP make_pair

typedef long long LL;
typedef pair<int, int> PII;

const double PI = acos(-1.0);
const int INF = 1000 * 1000 * 1000 + 7;
const LL LINF = (LL)INF * INF;

int main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	//freopen("In.txt", "r", stdin);
	int n;
	cin >> n;
	cout << 180 * (n - 2);
	return 0;
}

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

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

	int nums[N];
	vector<int> a;
	int cur;
	for (int i = 0; i < N; i++) {
		cin >> cur;
		a.push_back(cur);
	}
	sort(a.begin(), a.end());

	if (a[0] == a[a.size()-1]) {
		if (N/a[0] >= 2 || N == a[0]+1) {
			cout << "Yes" << endl;
		}
		else cout << "No" << endl;
	}
	else {
		if (a[a.size()-1]!=a[0]+1) {
			cout << "No" << endl;
		}
		else {
			int t1 = 0, t2 = 0;
			for (int i = 0; i < N; i++) {
				if (a[i] == a[0]) t1++;
				else t2++;
			}
			if (t1 < a[a.size()-1] && (a[a.size()-1]-t1) <= t2/2) cout << "Yes" << endl;
			else cout << "No" << endl;
			
		}
	}
	// cin >> N;
}

Measured memory_bytes: 892
#include<iostream>
using namespace std;
int main(){
	int a=1,b=1;
	while(!(a==0&&b==0)){
		cin >> a >> b;
		for (int i=1;i<=a;i++){
			for(int j=1;j<=b;j++)
				if ((i+j)%2==0)
					cout << '#';
				else cout << '.';
			cout << endl;
		}
		if(!(a==0&&b==0))
			cout << endl;
	}
    return 0;
}


Measured memory_bytes: 3108
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.Deque;

public class Main {

  final int INF = 100_000_000;
  int H,W,N;
  char[][] map;
  int[][] minD;
  int[] dx = {1, 0, -1, 0}, dy = {0, 1, 0, -1};
  Deque<Point> que = new ArrayDeque<>();

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

  public void run() {
    
    try(BufferedReader in = new BufferedReader(new InputStreamReader(System.in))) {

      String[] lines = in.readLine().split(" ");
      H = Integer.parseInt(lines[0]);
      W = Integer.parseInt(lines[1]);
      N = Integer.parseInt(lines[2]);

      map = new char[H][W];
      Point[] point = new Point[N+1];

      for(int i=0; i<H; i++) {
        map[i] = in.readLine().toCharArray();

        int x = 0;
        for (char c : map[i]) {
          if(Character.isDigit(c)) {
            int m = Character.getNumericValue(c);
            point[m] =  new Point(x, i);
          }
          else if(c == 'S')
            point[0] = new Point(x, i);

          x++;
        }
      }

      int ans = 0;
      minD = new int[H][W];

      for(int i=0; i<N; i++) {
        for (int[] a : minD)
          Arrays.fill(a, INF);

        ans += bfs(point[i],point[i+1]);
        que.clear();
      }

      System.out.println(ans);
    }
    catch(IOException e) {
      System.err.println(e);
    }
  }

  private int bfs(Point S, Point G) {
    int sx = S.x;
    int sy = S.y;
    int gx = G.x;
    int gy = G.y;

    que.offer(S);
    minD[sy][sx] = 0;

    while(!que.isEmpty()) {
      Point p = que.poll();

      if(p.x == gx && p.y == gy) break;

      for(int i=0; i<4; i++) {
        int nx = p.x + dx[i], ny = p.y + dy[i];

        if(0 <= nx && nx < W && 0 <= ny && ny < H && map[ny][nx] != 'X'
          && minD[ny][nx] == INF) {
          
          que.offer(new Point(nx,ny));
          minD[ny][nx] = minD[p.y][p.x] + 1;
        }
      }
    }
    return minD[gy][gx];
  }
}

class Point {
  int x;
  int y;

  public Point() {
    x = 0;
    y = 0;
  }
  public Point(int x, int y) {
    this.x = x;
    this.y = y;
  }
}


Measured memory_bytes: 71892
import std.stdio;
import std.algorithm;
import std.math;
import std.string;
import std.conv;
import std.range;

void main() {
    while (true) {
        int sum = readln.chomp.to!int;
        if (sum == 0) break;

        foreach (i; 0..9) {
            sum -= readln.chomp.to!int;
        }

        sum.writeln;
    }
}

Measured memory_bytes: 1048
#include<stdio.h>
	int main(){
		int A ;
		int B ;
		scanf("%d",&A) ;
		scanf("%d",&B) ;
		if (A+B > A-B & A+B > A*B){
          printf("%d",A+B) ;
        }else if(A-B>A*B){
			printf("%d",A-B) ;
        }else{
         	printf("%d",A*B) ;
        }
    }


Measured memory_bytes: 128
Scanf.scanf "%d %d" @@ fun a b ->
  let sa, sb = string_of_int a, string_of_int b in
  let ab = String.init b (fun i -> sa.[0]) in
  let ba = String.init a (fun i -> sb.[0]) in
  List.sort compare [ab; ba]
  |> List.hd |> print_endline


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

#define gcd(a,b)     __gcd(a,b)
#define lcm(a,b)     (a*(b/gcd(a,b)))

#define pb   push_back
#define endl "\n"

#define ll  long long
#define ull unsigned long long

#define W(t)            while(t--)
#define rep(i,n)      for(i = 0; i < n; i++)
#define repit(it,type)  for(auto it = type.begin(); it != type.end(); it++)
#define IOS ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
using namespace std;

int main()
{
    IOS
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    ll t,n,i;
    string s;
    cin>>n;
    if(n>=30)
    	cout<<"Yes\n";
    else
    	cout<<"No\n";

     return 0;
}

Measured memory_bytes: 3604
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <iomanip>
#include <array>
#include <numeric>
#include <regex>
#include <bitset>
#include <deque>

using namespace std;
typedef long long ll;
typedef pair<int, int> p_ii;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)

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

int main() {
    
    int n;
    cin>>n;
    vector<vector<int>> F(n,vector<int>(10));
    vector<vector<int>> P(n,vector<int>(11));
    rep(i,n)rep(j,10)cin>>F[i][j];
    rep(i,n)rep(j,11)cin>>P[i][j];

    ll res = -1e15;
    for(int i=1;i<(1<<10);i++){
        vector<int> open;
        for(int j=0;j<10;j++){
            if((i>>j)&1)open.push_back(j);
        }
        
        vector<int>cnt(n,0);
        for(int a=0;a<n;a++){
            for(auto it : open){
                cnt[a]+=F[a][it];
            }
        }
        ll ret=0;
        for(int a=0;a<n;a++){
            ret+=P[a][cnt[a]];
        }
        res=max(res,ret);
    }

    cout<<res<<endl;

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
int main ( void ){
  int a,b;
  char s[10],t[10],u[10];

  scanf ("%s",s);
  scanf ("%s",t);
  scanf("%d",&a);
  scanf("%d",&b);
  scanf ("%s",u);

  if ( strcmp ( s , u ) == 0 )
    a--;
  else
    b--;

  printf("%d ",a);
  printf("%d",b);

  return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <limits>

using namespace std;


int main() {
    
    int n;

    cin >> n;

    for (int i = 1; i <= n; ++i)
    {
        if (i % 3 == 0)
        {
            cout << " " << i;
            continue;
        }


        for (int x = i, div = 1; x != 0; x /= 10)
        {
            if (x % 10 == 3)
            {
                cout << " " << i;
                break;
            }
        }

    }

    cout << endl;

    return 0;
} 

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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define reps(i,s,n) for(int (i)=(s);(i)<(n);(i)++)
#define repr(i,n) for(int (i)=(n)-1;(i)>=0;(i)--)
#define all(v) (v).begin(),(v).end()
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define pb push_back
#define mod 1000000007
#define inf 1000000000
#define llinf 1000000000000000


typedef long long ll;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef pair<int,int> pint;
typedef pair<ll,ll> pll;
typedef vector<pint> vpint;



int main(){
    int k;
    cin>>k;
    if(k%2==0)cout<<(k/2)*(k/2)<<endl;
    else cout<<((k-1)/2)*((k+1)/2)<<endl;
}

Measured memory_bytes: 256
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;

public class Main {
    public static void main(String[] args) {
        FastScanner sc = new FastScanner();
        int k = sc.nextInt();
        String s = sc.next();
        if (s.length() <= k) {
            System.out.println(s);
        } else {
            s = s.substring(0, k);
            System.out.println(s + "...");
        }
    }
}

class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;

    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        } else {
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }

    private int readByte() {
        if (hasNextByte())
            return buffer[ptr++];
        else
            return -1;
    }

    private static boolean isPrintableChar(int c) {
        return 33 <= c && c <= 126;
    }

    public boolean hasNext() {
        while (hasNextByte() && !isPrintableChar(buffer[ptr]))
            ptr++;
        return hasNextByte();
    }

    public String next() {
        if (!hasNext())
            throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while (isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    public long nextLong() {
        if (!hasNext())
            throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while (true) {
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            } else if (b == -1 || !isPrintableChar(b)) {
                return minus ? -n : n;
            } else {
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }

    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
            throw new NumberFormatException();
        return (int) nl;
    }

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

Measured memory_bytes: 36100
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const int INF = (1<<30);
const ll INFLL = (1ll<<60);
const ll MOD = (ll)(1e9+7);

#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	b = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}

int p;

int main(void){
	int n,i,m=INF,ans=0;
	cin >> n;
	for(i=0; i<n; ++i){
		cin >> p;
		if(p<m){
			++ans;
			m = p;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#define rep(i,n) for (int i = 0; i < n; ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
  int A, B, C;
  cin >> A >> B >> C;
  cout << min(C, B/A) << endl;
  return 0;
}

Measured memory_bytes: 3140
H=int(input())
temp=H
answer=0

for i in range(100):
    if  abs(H-2**i)<temp:
        temp=abs(H-2**i)
        answer=i
        #print("before")
        #print(i)
        
    else:
        fuge=0
        #print("fuge")
        #print(i)
        
if H<(2**answer):
    #つまりHは2^answer以内にいる。
    print(2**answer-1)
else:
    #つまりHは2^answer+1以内にいる。
    print(2**(answer+1)-1)

Measured memory_bytes: 3060
#include<iostream>
#include<cstring>
using namespace std;
char s[100100];
int main()
{
    char a[5]={'d','r','e','a','m'};
    char b[5]={'e','r','a','s','e'};
    int i=0,flag=0;
    cin>>s;
    while(i<strlen(s))
    {
        //cout<<i<<endl;
        if(s[i]=='e')
        {
            i++;
            for(int j=1;j<=4;j++,i++)
            if(s[i]!=b[j])
            {
                flag=1;
                break;
            }
            if(s[i]=='r')
                i++;
        }
        else if(s[i]=='d')
        {
            i++;
            for(int j=1;j<=4;j++,i++)
                if(s[i]!=a[j])
            {
                flag=1;
                break;
            }
            if(s[i+4]=='a'&&s[i]=='e'&&s[i+1]=='r')
                i+=2;
                else if(s[i+5]=='a'&&s[i]=='e'&&s[i+1]=='r')
                    i+=2;
            else if(i+2==strlen(s)&&s[i]=='e'&&s[i+1]=='r')
                i+=2;
        }
        else
            flag=1;
            if(flag==1)
                break;
    }
    if(flag==0)
        cout<<"YES";
    else
        cout<<"NO";
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
using namespace std;
using ll=long long;
int n,x,m,a,b,c,k;
int main(){
  for(cin>>x,a=-118;a<120;a++){
    ll a5=pow(a,5);
    for(b=-119;b<119;b++){
      ll b5=pow(b,5);
      if(a5-b5==x){
        printf("%d %d",a,b);
        return 0;
      }
    }
  }
}

Measured memory_bytes: 4120
#include <bits/stdc++.h> 
#include <bits/types/stack_t.h>
using namespace std; 
#define FIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define PI1 3.14159265358979311599796346854418516159057617187500

typedef long long int ll;  

int main() 
{ 
    FIO
    ll t;
    //cin >> t;
    t=1;
    while(t--)
    {
        ll n,k;
        cin >> n >> k;

        bool vis[n+1]={0};
        while(k--)
        {
            ll d;
            cin >> d;

            for(int i=0;i<d;i++)
            {
                ll x;
                cin >> x;
                vis[x]=1;
            }
        }

        int ans = 0;
        for(int i=1;i<=n;i++)
        {
            if(!vis[i])
                ans++;
        }

        cout << ans << endl;
    }
    return 0; 
} 


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

int n,m,u,v;
vector<int>e[100005];
int d[100005];
int main(){
//	freopen("a.txt","r",stdin);
	cin.tie(0);
	cin>>n>>m;
	while(m--){
		cin>>u>>v;
		e[u].push_back(v);
		d[v]++;
	}
	queue<int>q;
	for(int i=0;i<n;i++)if(d[i]==0)q.push(i);
	while(!q.empty()){
		cout<<q.front()<<endl;
		for(int i=0;i<e[q.front()].size();i++){
			--d[e[q.front()][i]];
			if(d[e[q.front()][i]]==0)q.push(e[q.front()][i]);
		}
		q.pop();
	}
	return 0;
}


Measured memory_bytes: 5824
while 1:
    n, m = map(int, input().split())
    if n+m == 0:
        break
    C = {0: 0}
    for i in range(n):
        b = int(input(), 2)
        for k, v in dict(C).items():
            if C.get(k^b, 0) < v+1:
                C[k^b] = v+1
    print(C[0])

Measured memory_bytes: 171840
from itertools import combinations
N,K=map(int,input().split())

xs = set()
ys = set()
inl = []

for i in range(N):
    x,y=map(int,input().split())
    inl.append((x,y))
    xs.add(x)
    ys.add(y)

xs = list(xs)
ys = list(ys)
xs.sort()
ys.sort()

res = 9223372036854775807
for xlow, xhi in combinations(xs,2):
    for ylow, yhi in combinations(ys,2):
        cnt = 0
        for x, y in inl:
            cnt += (x >= xlow and x <= xhi and y >= ylow and y <= yhi)
        if cnt == K:
            res = min(res,(xhi - xlow) * (yhi - ylow))
print(res)


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

int main(){
  ios::sync_with_stdio(0);
  cin.tie(0);
  
  int n;
  cin >> n;
  int a[n];
  int s = 0;
  for (int i=0; i<n; i++){
    cin >> a[i];
    s += a[i];
  }
  
  int ans = 0;
    
  if (s % n == 0) {
      int x = s/n;
      for (int i: a){
        ans += (x - i)*(x - i);
      }
  }
  else {
      int x1 = ceil((double) s/n);
      int x2 = floor((double) s/n);
      int ans1 = 0;
      int ans2 = 0;
      for (int i: a){
          ans1 += (x1 - i)*(x1 - i);
          ans2 += (x2 - i)*(x2 - i);
      }
      if (ans1 > ans2){
          ans = ans2;
      }
      else{
          ans = ans1;
      }
  }
      
  
  
  cout << ans;
}

Measured memory_bytes: 256
#include<cstdio>
#include<vector>
#include<algorithm>
#include<cstring>
using namespace std;
int main(){
    char lis[10][10]={
        "",
        ".,!? ",
        "abc",
        "def",
        "ghi",
        "jkl",
        "mno",
        "pqrs",
        "tuv",
        "wxyz",
    };
    int n;
    scanf("%d",&n);
    while(n--){
        char str[2024];
        scanf("%s",str);
        int v,cnt=-1;
        for(int i=0;str[i];i++){
            if(str[i]=='0'){
                if(cnt!=-1){
                    printf("%c",lis[v][cnt]);
                    cnt=-1;
                }
            }
            else{
                v=str[i]-'0';
                cnt++;
                cnt%=strlen(lis[v]);
            }
        }
        puts("");
    }
    return 0;
}

Measured memory_bytes: 1024
fun min(a:Int, b:Int):Int = if (a > b) b else a
fun min(a:Long, b:Long):Long = if (a > b) b else a
data class Daunats(val parent:Daunats?, val cost:Int) {
    init {
        parent?.children?.add(this)
    }
    private val children = mutableListOf<Daunats>()
    val descendantsCount:Int by lazy {children.sumBy { it.descendantsCount } + 1}
    val wholeCost:Long by lazy{children.map { it.wholeCost }.sum() + cost }
}
data class Budget(val cost:Long, val value:Int, val count:Int):Comparable<Budget>{
    override fun compareTo(other: Budget): Int {
        return (value * other.cost).compareTo(cost * other.value)
    }
}
fun main(args:Array<String>):Unit{
    val (n, x, d) = readLine()!!.split(' ').map(String::toInt)
    Array<Daunats?>(n){ null }.apply {
        val m = readLine()!!.toInt()
        this[0] = Daunats(null, m)
        for (i in 1 until n){
            val (m, p) =readLine()!!.split(' ').map(String::toInt)
            this[i] = Daunats(this[p - 1], m)
        }
    }.filterNotNull().map{daunats ->  Budget(daunats.wholeCost, daunats.descendantsCount, if (daunats.parent == null) x else d)}.sortedDescending().let{
        val memo = Array(n * n * n + 1){Long.MAX_VALUE}//memo[idx] -> 価値がidxになる組み合わせで最小のコスト
        memo[0] = 0
        for ((cost, value, size) in it){
            var i = 1
            while (i * 2 <= min(n, size)){
                for (idx in (n * n * n - i * value) downTo 0){
                    if (memo[idx] != Long.MAX_VALUE){
                        memo[idx + i * value] = min(memo[idx + i * value], memo[idx] + i * cost)
                    }
                }
                i *= 2
            }
            i = min(n, size) - i + 1
            for (idx in (n * n * n - i * value) downTo 0){
                if (memo[idx] != Long.MAX_VALUE){
                    memo[idx + i * value] = min(memo[idx + i * value], memo[idx] + i * cost)
                }
            }
        }
        var max:Long = 0
        for ((value, minM) in memo.withIndex()){
            if (minM != Long.MAX_VALUE && minM <= x){
                var restCost = x - minM
                var tempValue = value.toLong()
                for ((c, v, s) in it){
                    tempValue += min(restCost / c, s.toLong() - min(s, n)) * v
                    restCost -= min(restCost / c, s.toLong() - min(s, n)) * c
                }
                if (tempValue > max) max = tempValue
            }
        }
        println(max)
    }
}

Measured memory_bytes: 115644
#include "bits/stdc++.h"
 
using namespace std;

using ll = long long;
using vll = vector<ll>;
using pl4 = pair<ll,ll>;
using str = string;
using vpl4 = vector<pair<ll,ll>>;

#define sz size()
#define be begin()
#define en end()
#define fi first
#define se second
#define pb push_back
#define mp make_pair

#define llin(x) ll (x);cin >>(x);
#define stin(x) str (x);cin >>(x);
#define FOR(i,a,b) for(ll i = a ; i <= b ; i++)
#define rFOR(i,b,a) for(ll i = a; i >= b ; i--)
#define SORT(x) sort(x.be, x.en)
#define rSORT(x) sort(x.rbegin(), x.rend())
#define say(x) cout<<(x);
#define sal(x) cout<<(x)<<endl;
#define yn(a) cout <<((a)?"yes":"no")<<endl;
#define Yn(a) cout <<((a)?"Yes":"No")<<endl;
#define YN(a) cout <<((a)?"YES":"NO")<<endl;
#define Imp(a) cout <<((a)?"Possible":"Impossible")<<endl;
#define IMP(a) cout <<((a)?"POSSIBLE":"IMPOSSIBLE")<<endl;

signed main(){
    stin(s);
    ll k=0;
    FOR(i,0,7){
        if(s.substr(0,i)+s.substr(s.sz-7+i,7-i)=="keyence") k=1;
    }
    YN(k==1);
}


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

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

  vector<int> A(N);
  vector<int> B(N-1);

  for(int i=0;i<N-1;i++) {
    cin >> B.at(i);
  }

  int ans=0;

  for(int i=0;i<N;i++) {
    if(i==0) A.at(i) = B.at(0);
    else if (i==N-1) A.at(i) = B.at(N-2);
    else {
      A.at(i) = min(B.at(i-1), B.at(i));
    }
    ans += A.at(i);
  }

  cout << ans << endl;

  return (0);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef long double ld;
const double pi=acos(-1.0);
const ll mod=pow(10,9)+7;
const ll INF=pow(2,31)-1;
typedef pair<int,int> P;
typedef vector<int> vi;

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

ll gcd(ll a , ll b){
	if(b == 0) return a;
	return gcd(b , a % b);	
}
ll lcm(ll a , ll b){
	ll g = gcd(a , b);
	ll lc = (a/g) * b;
	return lc;
}

int main(){
    ios::sync_with_stdio(false);
	int n;
	cin >> n;
	ll ans=0;
	for(int i=1;i<=n;i++){
		if(i%3!=0&&i%5!=0){
			ans+=i;
		}
	}
	cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3648
package main

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	
	N := ScanInt(scanner)
	M := ScanInt(scanner)
	
	var roads [50][50]int
	for i := 0; i < M; i++ {
	    a := ScanInt(scanner)
	    b := ScanInt(scanner)
	    
	    roads[a-1][b-1] += 1
	    roads[b-1][a-1] += 1
	}
	
	for i := 0; i < N; i++ {
	    ans := 0
	    for j := 0; j < N; j++ {
	        ans += roads[i][j]
	    }
	    fmt.Println(ans)
	}
}

func ScanInt(scanner *bufio.Scanner) int {
	scanner.Scan()
	i, e := strconv.Atoi(scanner.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func ScanFloat64(scanner *bufio.Scanner) float64 {
	scanner.Scan()
	f, e := strconv.ParseFloat(scanner.Text(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func ScanText(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func Max(a, b int) int {
	if a < b {
		return b
	}
	return a
}

func Min(a, b int) int {
	if a > b {
		return b
	}
	return a
}

func Abs(a int) int {
	if a < 0 {
		a *= -1
	}
	return a
}
 

Measured memory_bytes: 640
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<tuple>
#include<map>
#include<queue>
#include<math.h>
#include<iomanip>
#define rep(i, n) rep2(i,0,n)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define PI acos(-1);
typedef long long ll;
using namespace std;
const int MOD=1000000007;
//scanf("%d", &a) '\n'



int main() {
	int n, k;
	cin >> n >> k;
	cout << fixed << setprecision(12);
	double ans = 0;
	ans += max(double(n - k + 1) / n, 0.0000000000);
	rep2(i, 1, min(k, n + 1)) {
		double reset = double(1)/n;
		int j = i;
		while (j < k) {
			j *= 2;
			reset=reset/2;
		}
		ans += reset;
	}
	
	cout << ans;
}
	

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define FOR(i,a,b) for(int i=a; i<(int)(b); i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define CLR(a) memset((a), 0 ,sizeof(a))
#define PB push_back
#define MP make_pair
#define SP << " " <<
const int INF = 1001001001;
const ll LINF = 100100100100100100;
const double EPS = 1e-10;
const long double PI  = acos(-1.0L);
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
#define chmax(a,b) a = (((a)<(b))?(b):(a))
#define chmin(a,b) a = (((a)>(b))?(b):(a))

__attribute__((constructor))
void initial(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

signed main(){
	int h,w; cin>>h>>w;
	int a[h][w], b[h][w];
	const int max_k=(h+w)*80+5; //////
	rep(i,h) rep(j,w) cin>>a[i][j];
	rep(i,h) rep(j,w) cin>>b[i][j];
  	vector<vector<vector<bool>>> dp(h, vector<vector<bool>>(w, vector<bool>(max_k,false))); //////
	// bool dp[h][w][max_k]; memset(dp,false,sizeof(dp));
	const int dh[2]={1,0}, dw[2]={0,1};
	dp[0][0][abs(a[0][0]-b[0][0])]=true;
	rep(now_h,h)rep(now_w,w){
		rep(i,2){
			int next_h=now_h+dh[i], next_w=now_w+dw[i];
			if(next_h>=h||next_w>=w) continue;
			int d=abs(a[next_h][next_w]-b[next_h][next_w]);
			rep(k,max_k){
				if(!dp[now_h][now_w][k]) continue;
				if(k+d<max_k) dp[next_h][next_w][k+d]=true;
				if(abs(k-d)<max_k) dp[next_h][next_w][abs(k-d)]=true;
			}
		}
	}
	int ans=max_k;
	rep(k,max_k){
		if(dp[h-1][w-1][k]) return cout<<k<<endl,0;
	}
	cout<<ans<<endl;
	return 0;
}


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

using ll = long long;
using Vi = vector<int>;
using Vl = vector<ll>;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

constexpr int I_INF = numeric_limits<int>::max();
constexpr ll L_INF = numeric_limits<ll>::max();

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

struct Pos {
    ll x, y;
};

void solve() {
    ll H, W, K;
    cin >> H >> W >> K;
    int cell[801][801];
    Pos start;
    for (ll i = 0; i < H; i++) {
        string s;
        cin >> s;
        for (ll j = 0; j < W; j++) {
            if (s[j] == '#') {
                cell[i][j] = 1;
            }
            else {
                cell[i][j] = 0;
                if (s[j] == 'S') {
                    start = {i, j};
                }
            }
        }
    }

    ll dist[801][801];
    for (ll i = 0; i < H; i++) {
        for (ll j = 0; j < W; j++) {
            dist[i][j] = L_INF;
        }
    }

    constexpr Pos step[] = {{0, 1}, {0, -1}, {1, 0}, {-1, 0}};
    using Tup = tuple<ll, ll, ll>;

    queue<Tup> q;
    q.emplace(start.x, start.y, 0);
    dist[start.x][start.y] = 0;
    while (!q.empty()) {
        auto [x, y, d] = q.front();
        q.pop();
        if (d + 1 <= K) {
            for (ll i = 0; i < 4; i++) {
                ll xn = x + step[i].x;
                ll yn = y + step[i].y;
                if (!(xn >= 0 && xn < H && yn >= 0 && yn < W)) continue;
                if (cell[xn][yn] == 1) continue;
                if (dist[xn][yn] != L_INF) continue;
                q.emplace(xn, yn, d + 1);
                dist[xn][yn] = d + 1;
            }
        }
    }

    ll ans = L_INF;
    for (ll i = 0; i < H; i++) {
        for (ll j = 0; j < W; j++) {
            if (dist[i][j] == L_INF) continue;
            ans = min(ans, (i + K - 1) / K + 1);
            ans = min(ans, (H - 1 - i + K - 1) / K + 1);
            ans = min(ans, (j + K - 1) / K + 1);
            ans = min(ans, (W - 1 - j + K - 1) / K + 1);
        }
    }

    cout << ans << "\n";
}

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

int main() {
#ifdef FASTIO
    cin.tie(0), cout.tie(0);
    ios::sync_with_stdio(false);
#endif
#ifdef FILEINPUT
    ifstream ifs("./in_out/input.txt");
    cin.rdbuf(ifs.rdbuf());
#endif
#ifdef FILEOUTPUT
    ofstream ofs("./in_out/output.txt");
    cout.rdbuf(ofs.rdbuf());
#endif
    solve();
    cout << flush;
    return 0;
}

Measured memory_bytes: 11128
#include<bits/stdc++.h>
using namespace std;
#define ll long long                                    // long long省略
#define pb push_back                                    // push_back省略
#define mp make_pair                                    // make_pair省略
#define fi first                                        // first省略
#define se second                                       // second省略
#define itn int                                         // int誤字保険
#define count cout                                      // cout誤字保険
#define vecotr vector                                   // vector誤字保険
#define ednl endl                                       // endl誤字保険
#define opt() cin.tie(0); ios::sync_with_stdio(false)   // 入出力速度改善

#define rep(i,l,r) for(ll i=(l);i<(r);i++)               // 範囲[l, r)で刻み1のfor文(順方向)
#define repp(i,l,r,k) for(ll i=(l);i<(r);i+=(k))         // 範囲[l, r)で刻みkのfor文(順方向)
#define rrep(i,l,r) for(ll i=(r-1);i>=(l);i--)           // 範囲[l, r)で刻み1のfor文(逆方向)
#define rrepp(i,l,r,k) for(ll i=(r-1);i>=(l);i-=(k))     // 範囲[l, r)で刻みkのfor文(逆方向)
#define all(x) (x).begin(), (x).end()                   // vectorのポインタ位置指定用
#define max(p,q)((p)>(q)?(p):(q))                       // max拡張
#define min(p,q)((p)<(q)?(p):(q))                       // min拡張
#define bit(n,m)(((n)>>(m))&1)                          // 変数nのm番目のbitを取り出す

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 dy[]={0, 1, 0, -1};                                 // 4方向近傍
int dx[]={1, 0, -1, 0};                                 // 4方向近傍

int main(){
    ll a,b,c;cin>>a>>b>>c;
    cout << (a-b) % c << endl; 
}

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

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            var inputs = Console.ReadLine().Split(' ').Select(int.Parse);
            var N = inputs.ElementAt(0);
            var X = inputs.ElementAt(1);

            var m = new List<int>();

            for (int i = 0; i < N; i++)
            {
                m.Add(int.Parse(Console.ReadLine()));
            }

            X -= m.Aggregate((i, i1) => i + i1);

            var result = N + X / m.Min();
            Console.WriteLine(result);
        }
    }
}


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

int main(){
    vector<int> vec(3);
    for(int i=0;i<3;i++){
        cin >> vec.at(i);
    }
    stable_sort(vec.begin(),vec.end());
    cout << vec.at(2)-vec.at(0) << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define F first
#define S second

const int N = 2e5 + 5 , mod = 1e9 + 7;
using namespace std;



int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int a , b , t; cin >> a >> b >> t;
    cout << b * (t / a);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  string S;
  int count_AC = 0,count_WA = 0,count_TLE = 0,count_RE = 0,N;
  cin >> N;
  for(int i = 0;i < N;i++) {
    cin >> S;
    if(S == "AC") {
      count_AC++;
    }
    if(S == "WA") {
      count_WA++;
    }
    if(S == "TLE") {
      count_TLE++;
    }
    if(S == "RE") {
      count_RE++;
    }
  }
  cout << "AC x " << count_AC << endl;
  cout << "WA x " << count_WA << endl;
  cout << "TLE x " << count_TLE << endl;
  cout << "RE x " << count_RE << endl;
}


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

using namespace std;

#define MAX 500000
#define SENTINEL 2000000000 // 番兵

struct Card {
  char suit;
  int value;
};

struct Card L[MAX / 2 + 2], R[MAX / 2 + 2];

void merge(struct Card A[], int left, int mid, int right) {
  int n1 = mid - left;
  int n2 = right - mid;
  for (int i = 0; i < n1; i++) L[i] = A[left + i];
  for (int i = 0; i < n2; i++) R[i] = A[mid + i];
  L[n1].value = R[n2].value = SENTINEL;
  int i = 0, j = 0;
  for (int k = left; k < right; k++) {
    if (L[i].value <= R[j].value) {
      A[k] = L[i++];
    } else {
      A[k] = R[j++];
    }
  }
}

void mergeSort(struct Card A[], int left, int right) {
  if (left + 1 < right) {
    int mid = (left + right) / 2;
    mergeSort(A, left, mid);
    mergeSort(A, mid, right);
    merge(A, left, mid, right);
  }
}

int partition(struct Card A[], int p, int r) {
  struct Card x = A[r];
  int i = p - 1;
  struct Card tmp;
  for (int j = p; j < r; j++) {
    if (A[j].value <= x.value) {
      i++;
      tmp = A[i]; A[i] = A[j]; A[j] = tmp;
    }
  }
  tmp= A[i + 1]; A[i + 1] = A[r]; A[r] = tmp;
  return i + 1;
}

void quickSort(struct Card A[], int p, int r) {
  if (p < r) {
    int index = partition(A, p, r);
    quickSort(A, p, index - 1);
    quickSort(A, index + 1, r);
  }
}

int main() {
  int n; cin >> n;
  struct Card A[n + 1], B[n + 1];
  for (int i = 0; i < n; i++) {
    struct Card a; cin >> a.suit >> a.value;
    A[i] = a; B[i] = a;
  }
  quickSort(A, 0, n - 1);
  mergeSort(B, 0, n);
  bool flag = 1;
  for (int i = 0; i < n; i++) {
    if (A[i].suit != B[i].suit) flag = 0;
  }
  if (flag) cout << "Stable" << endl;
  else cout << "Not stable" << endl;
  for (int i = 0; i < n; i++) {
    cout << A[i].suit << " " << A[i].value << endl;
  }

  return 0;
}



Measured memory_bytes: 5336
N,H=map(int,input().split())
a=[]
b=[]
for i in range(N):
    c,d=map(int,input().split())
    a.append(c)
    b.append(d)

a.sort(reverse=True)
at=a[0]
b.sort(reverse=True)
ans=0
for i in range(N):
    if at<b[i]:
        H-=b[i]
        ans+=1
    if H<=0:
        break
if H<=0:
    print(ans)
    exit()
ans+=(H+at-1)//at
print(max(ans,1))

Measured memory_bytes: 61528
import java.util.*;

class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int[] arr = new int[n];

		for (int i=0; i<n; i++) {
			arr[i] = scanner.nextInt();
		}
		int len = arr.length;

		int count = 0;
		for (int i = 0; i < len ; i++) {
			int mini = i;
			for (int j = i; j < len; j++) {
				if (arr[j] < arr[mini]) {
					mini = j;
				}
			}
			if(mini != i){
      	    	int temp = arr[i];
      	    	arr[i] = arr[mini];
      	    	arr[mini] = temp;

					count++;
				}

		}

		for (int i=0; i < len-1; i++) {
			System.out.print(arr[i] + " ");
		}
		System.out.println(arr[arr.length-1]);
		System.out.println(count);
	}

}



Measured memory_bytes: 26336
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n,a,b,c,d;
    cin>>n>>a>>b>>c>>d;
    std::deque<char> line;
    string s;
    cin>>s;
    s="#"+s+"#";
    for (int i=0;i<s.size();i++) {
        line.emplace_back(s[i]);
    }
    if (c<d) {
        for (int i=b;i+2<=d;i++) {
            if (line[i+1]=='#'&&line[i+2]=='#') {
                cout<<"No"<<endl;
                return 0;
            }
        }
        for (int i=a;i+2<=c;i++) {
            if (line[i+1]=='#'&&line[i+2]=='#') {
                cout<<"No"<<endl;
                return 0;
            }
        }
        cout<<"Yes"<<endl;
    } else {
        for (int i=b;i<=d;i++) {
            if (line[i-1]=='.'&&line[i]=='.'&&line[i+1]=='.') {
                cout<<"Yes"<<endl;
                return 0;
            }
        }
        cout<<"No"<<endl;
    }
}

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

#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)

using namespace std;
typedef long long int ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> PI;
const ll mod = 1e9 + 7;

ll gcd(ll x, ll y) {
  while (y != 0) {
    ll r = x % y;
    x = y;
    y = r;
  }
  return x;
}

int main(void) {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  VL t(n);
  REP(i, 0, n) {
    cin >> t[i];
  }
  ll g = t[0];
  REP(i, 0, n) {
    g = g / gcd(g, t[i]) * t[i];
  }
  cout << g << endl;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){ 
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;
}
}


Measured memory_bytes: 3576