akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;
public class Main {
private static Scanner s;
public static void main(String[] args) {
	s = new Scanner(System.in);
	int a = s.nextInt();
	int minj;
	boolean flag = false;
	String[] bstr = new String[a];
	String[] sstr = new String[a];

	for(int i = 0;i < a;i++) {
		String str = s.next();
		bstr[i] = str;
		sstr[i] = str;
	}
	for(int i = 0;i < a;i++) {
		for(int j = a-1;j >= i+1;j--) {
			if(bstr[j].charAt(1) < bstr[j-1].charAt(1)) {
	String tmp = bstr[j];
	bstr[j] = bstr[j-1];
	bstr[j-1] = tmp;
			}
		}
	}
	for(int i = 0;i < a;i++) {
		System.out.print(bstr[i]);
		if(i == a-1) {
			System.out.println("");
		}else {
			System.out.print(" ");
		}
	}
		System.out.println("Stable");

	for(int i=0;i < a;i++) {
		minj = i;
		for(int j = i;j < a;j++) {
			if(sstr[j].charAt(1) < sstr[minj].charAt(1)) {
				minj = j;
			}
		}
		if(i != minj) {
			String tmp;
			tmp = sstr[i];
			sstr[i] = sstr[minj];
			sstr[minj] = tmp;
		}

	}
	for(int i = 0;i < a;i++) {
		System.out.print(sstr[i]);
		if(i == a-1) {
			System.out.println("");
		}else {
			System.out.print(" ");
		}
	}
	for(int i=0;i < a;i++) {
		if(bstr[i].equals(sstr[i]) != true) {
		flag = false;
		break;
		}else {
			flag = true;
		}
	}
	if(flag == true) {
		System.out.println("Stable");
		}else {
			System.out.println("Not stable");
		}
}
}



Measured memory_bytes: 26296
#include <bits/stdc++.h>
using i64 = long long;

int main() {
    int n, m;
    std::cin >> n >> m;
    std::vector<std::pair<int, char>> v;
    while (m--) {
        int s, c;
        std::cin >> s >> c;
        v.emplace_back(s - 1, c + '0');
    }

    for (int i = 0; i < 1000; i++) {
        auto s = std::to_string(i);
        if (s.size() != n) continue;
        for (auto &e : v) {
            if (s[e.first] != e.second) {
                goto next;
            }
        }
        std::cout << s << std::endl;
        return 0;
next:;
    }

    std::cout << -1 << std::endl;

    return 0;
}


Measured memory_bytes: 256
use proconio::*;

#[fastout]
fn run() {
    input! {
        n: usize,
        a: [u32; n],
    }
    let xor = a.iter().fold(0, |s, a| s ^ *a);
    for a in a {
        println!("{}", a ^ xor);
    }
}

fn main() {
    run();
}

Measured memory_bytes: 5596
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <set>
#include <queue>
#include <map>
#include <numeric>
#include <functional>
#include <math.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;

#define INF ((int)1e9)
#define INFLL ((ll)1e18)
#define MOD (1000000007LL)


vector<vector<int>> G;
vector<int> A;
vector<int> Len;
vector<int> Ans;

void DFS(int n, map<int, set<pair<int, int>>>& LenToVal)
{
    if (Len[n] != 0) {
        return;
    }
    
    Len[n] = 1;
    for (auto it = LenToVal.rbegin(); it != LenToVal.rend(); ++it) {
        if (it->second.begin()->first < A[n]) {
            Len[n] = it->first + 1;
            break;
        }
    }
    
    LenToVal[Len[n]].emplace(A[n], n);
    Ans[n] = LenToVal.rbegin()->first;
    for (int m : G[n]) {
        DFS(m, LenToVal);
    }
    LenToVal[Len[n]].erase(make_pair(A[n], n));
    if (LenToVal[Len[n]].empty()) {
        LenToVal.erase(Len[n]);
    }
}

int main(int argc, const char * argv[]) {
    ios_base::sync_with_stdio(false);
    int N;
    cin >> N;
    A.assign(N, 0);
    for (int n = 0; n < N; ++n) {
        cin >> A[n];
    }
    G.assign(N, vector<int>());
    for (int n = 0; n < N-1; ++n) {
        int u, v;
        cin >> u >> v;
        --u; --v;
        G[u].emplace_back(v);
        G[v].emplace_back(u);
    }
    
    Len.assign(N, 0);
    Ans.assign(N, 0);
    map<int, set<pair<int, int>>> LenToVal;
    DFS(0, LenToVal);
    
    for (int n = 0; n < N; ++n) {
        cout << Ans[n] << '\n';
    }

    return 0;
}


Measured memory_bytes: 48408
using System;
class Program
{
	static void Main(string[] args)
	{
		string[] input = Console.ReadLine().Split(' ');
		int r = int.Parse(input[0]);
		int d = int.Parse(input[1]);
		long x = long.Parse(input[2]);
      	for(int i = 0;i < 10;i++)
        {
          	x = r*x - d;
          	Console.WriteLine(x);
        }
	}
}


Measured memory_bytes: 13140
#include <iostream>
#include <string>
#include <cstdlib>

#include <algorithm>

using namespace std;

char tolower(char c) {
	return (c + 0x20);
}
int main()
{
	int n, k;
	cin >> n >> k;
	string s;
	cin >> s;
	char s1 = s[k - 1];
	s[k-1] = tolower(s[k-1]);
	
	cout << s << endl;

	return 0;
}



Measured memory_bytes: 256
#include<stdio.h>
int main(void){
    int A,B,C,ans;
    scanf("%d%d%d",&A,&B,&C);
    ans=A-(B+C);
    if(ans<0)
        ans=ans*(-1);
    else if(ans>=0)
        ans=0;
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 128
import java.util.Scanner;

public class Main {
    public static void main(String [] args){
        Scanner sc = new Scanner(System.in);
        
        while(true){
            String line = sc.nextLine();
            int sum = 0;
            
            if(line.charAt(0) == '0')break;
            
            for(int i = 0; i < line.length(); i++){
                sum += Character.digit(line.charAt(i), 10);
            }
            System.out.println(sum);
        }
    }
}


Measured memory_bytes: 26296
/*
このコード、と～おれ!
Be accepted!
∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
 　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
		  　　　　　　　　　　(¸.·´ (¸.·'* ☆
					*/

#pragma GCC optimize("Ofast")
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define rep1(i, n) for(int i = 1; i <= (n); ++i)
#define repr(i, n) for(int i = n; i >= 0; --i)
#define reprm(i, n) for(int i = n - 1; i >= 0; --i)
#define printynl(a) printf(a ? "yes\n" : "no\n")
#define printyn(a) printf(a ? "Yes\n" : "No\n")
#define printYN(a) printf(a ? "YES\n" : "NO\n")
#define printfin(a) printf(a ? "possible\n" : "inposible\n")
#define all(x) (x).begin(), (x).end()
using ll = long long;

const int INF = 2147483647;
//const ll LINF = ll();今度書く

//マクロとかここまで

#include <stdio.h>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstring>
#include <vector>

using namespace std;

int main() {

	ll a, b, c, k;
	scanf("%lld%lld%lld%lld", &a, &b, &c, &k);
	printf("%lld\n", ll(max(a, max(b, c))) * ll((pow(2, k) - 1)) + a + b + c);

	return 0;
}


Measured memory_bytes: 128
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<sstream>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<utility>
#include<numeric>
#include<algorithm>
#include<bitset>
#include<complex>

using namespace std;

typedef long long Int;
typedef vector<int> vint;
typedef pair<int,int> pint;
#define mp make_pair

template<class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cout << *i << " "; cout << endl; }
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }
int in() { int x; scanf("%d", &x); return x; }

int main() {
	int n,k;
	n=in();
	for(k=0;k<n;k++){
		cout<<"Case "<<k+1<<":\n";
		int x=in();
		int i=10;
		while(i--){
			x*=x;
			x/=100;
			x%=10000;
			cout<<x<<endl;
		}
	}
	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <tuple>
#include <bitset>
#include <memory>
#include <cmath>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <numeric>
#include <climits>
#include <cfloat>

struct Edge {
	int to, cost;
};
int main() {
	int n, m, k; std::cin >> n >> m >> k;
	std::vector<int> bread_taste(n), jam_taste(n);
	std::vector<std::vector<int>> jam_type(k);
	for (auto& p : bread_taste) std::cin >> p;
	for (auto i = 0; i < n; ++i) {
		int c; std::cin >> c;
		jam_type[c - 1].push_back(i);
	}
	for (auto& j : jam_taste) std::cin >> j;
	std::vector<std::vector<Edge>> towns(n);
	for (auto i = 0; i < m; ++i) {
		int u, v, t; std::cin >> u >> v >> t;
		towns[u - 1].push_back({ v - 1, t });
		towns[v - 1].push_back({ u - 1, t });
	}
	auto comparator = [](const std::pair<int, long long int>& a, const std::pair<int, long long int>& b) {return a.second > b.second; };
	std::priority_queue<std::pair<int, long long int>, std::vector<std::pair<int, long long int>>, decltype(comparator)> queue(comparator);
	std::vector<long long int> min_time_from_start(n, LLONG_MAX); min_time_from_start[0] = 0; queue.emplace(0, 0);
	while (!queue.empty()) {
		auto top = queue.top(); queue.pop();
		if (min_time_from_start[top.first] == top.second) {
			for (const auto& e : towns[top.first]) {
				if (min_time_from_start[e.to] > top.second + e.cost) {
					min_time_from_start[e.to] = top.second + e.cost;
					queue.emplace(e.to, top.second + e.cost);
				}
			}
		}
	}
	std::vector<long long int> min_cost_for_bread(n);
	for (auto i = 0; i < n; ++i) min_cost_for_bread[i] = min_time_from_start[i] - bread_taste[i];
	std::vector<long long int> min_cost_for_jam(min_cost_for_bread);
	for (auto i = 0; i < n; ++i) queue.emplace(i, min_cost_for_jam[i]);
	while (!queue.empty()) {
		auto top = queue.top(); queue.pop();
		if (min_cost_for_jam[top.first] == top.second) {
			for (const auto& e : towns[top.first]) {
				if (min_cost_for_jam[e.to] > top.second + e.cost) {
					min_cost_for_jam[e.to] = top.second + e.cost;
					queue.emplace(e.to, top.second + e.cost);
				}
			}
		}
	}
	for (auto i = 0; i < n; ++i) min_cost_for_jam[i] -= jam_taste[i];
	std::vector<long long int> min_cost_for_all(min_time_from_start);
	for (auto i = 0; i < n; ++i) min_cost_for_all[i] += min_cost_for_jam[i];
	for (auto type = 0; type < k; ++type) {
		std::cout << -min_cost_for_all[*std::min_element(jam_type[type].begin(), jam_type[type].end(), [&min_cost_for_all](const int i, const int j) {return min_cost_for_all[i] < min_cost_for_all[j]; })] << std::endl;
	}
}


Measured memory_bytes: 21552
n,k = list(map(int,input().rstrip().split()))
array = []
for _ in range(n):
    array.append(list(map(int,input().strip().split())))
array.sort()

def find(ar,k):
    count = 0
    for a in ar:
        if count < k and k <= count+a[1]:
            return a[0]
        else:
            count += a[1]
print(find(array,k))

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


int main() {
    int N, M;
    cin >> N >> M;
    vector<vector<bool>> path(N, vector<bool>(N, false));

    rep(i, M){
        int x, y;
        cin >> x >> y;
        x--; y--;
        path[x][y] = path[y][x] = true;
    }
    vector<int> v(N);
    rep(i, N) v[i] = i;

    int ans = 0;

    do{
        
        if (v[0]!=0) continue;
        bool flag = true;
        rep(i, N-1) {
            if (!path[v[i]][v[i+1]]) {
                flag = false;
                break;
            }
        }
        if(flag) ans++;
    }while(next_permutation(v.begin(), v.end()));

    cout << ans << endl;
}


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

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

typedef long long ll;
const ll MOD = 1e9 + 7;

int main() {
  int H, W;
  std::cin >> H >> W;

  static std::vector<std::vector<int>> A(H, std::vector<int>(W));
  static std::vector<std::vector<int>> B(H, std::vector<int>(W));
  rep(i, H) {
    rep(j, W) {
      std::cin >> A[i][j];
    }
  }
  rep(i, H) {
    rep(j, W) {
      std::cin >> B[i][j];
    }
  }

  int M = 80 * (H + W);
  std::vector<std::vector<std::vector<bool>>> dp(H, std::vector<std::vector<bool>>(W));
  rep(i, H) {
    rep(j, W) {
      dp[i][j] = std::vector<bool>(M + 1);
    }
  }
  dp[0][0][std::abs(A[0][0] - B[0][0])] = true;

  for(int i = 0; i < H; ++i) {
    for(int j = 0; j < W; ++j) {
      for(int k = 0; k <= M; ++k) {
        if(! dp[i][j][k]) continue;
        if(i + 1 < H) {
          int d = std::abs(A[i + 1][j] - B[i + 1][j]);
          dp[i + 1][j][k + d] = dp[i + 1][j][std::abs(k - d)] = true;
        }
        if(j + 1 < W) {
          int d = std::abs(A[i][j + 1] - B[i][j + 1]);
          dp[i][j + 1][k + d] = dp[i][j + 1][std::abs(k - d)] = true;
        }
      }
    }
  }

  int ans;
  for(int k = 0; k <= M; ++k) {
    if(dp[H - 1][W - 1][k]) {
      ans = k;
      break;
    }
  }
  std::cout << ans << '\n';
}


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

int main(){
  int h,w;cin>>h>>w;
  vector<string> vec(h);
  for(int i=0;i<h;++i){
    cin>> vec[i];
  }
  vector <bool> row(h,false);
  vector <bool> column(w,false);
  for(int i=0;i<h;++i){
    for(int j=0;j<w;++j){
      if(vec[i][j] == '#'){
        row[i] = true;
        column[j] = true;
      }
    }
  }
  for(int i=0;i<h;++i){
    if(row[i]){
      for(int j=0;j<w;++j){
        if(column[j]){
          cout<< vec[i][j];
        }
      }
      cout<<endl;
    }
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define rep2(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long Int;
typedef pair<Int, Int> P;
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a,b,c,x,y;
    cin>>a>>b>>c>>x>>y;
    Int ans=LINF;
    for(int i=0; i<=2*max(x,y); i++){
        Int tmp=i*c+max(0,(x-i/2))*a+max(0,(y-i/2)*b);
        ans=min(ans,tmp);
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3644
import java.util.*;
import java.math.BigDecimal;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String a = sc.next();
        String b = sc.next();
        BigDecimal bd = new BigDecimal(a);
        BigDecimal bdb = new BigDecimal(b);
         BigDecimal ans = bd.multiply(bdb);
         BigDecimal anss = ans.setScale(0,BigDecimal.ROUND_DOWN);
        System.out.println(anss);
    }
}


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

using namespace std;
typedef long long ll;

#define REP(i,n) for(int i=0;i<n;++i)
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
#if 1
#  define DBG(fmt, ...) printf(fmt, __VA_ARGS__)
#else
#  define DBG(fmt, ...)
#endif

#define MOD 1000000007
#define INF 1000000000
#define MAX_N 100010

int N, M;
vector<int> graph[MAX_N];
bool isUsed[MAX_N] = {};

int main()
{
    cin >> N >> M;
    REP(i, M) {
        int a, b;
        cin >> a >> b;
        graph[a].push_back(b);
        graph[b].push_back(a);
    }
    list<int> ans;
    // 適当な 2 点を入れる
    int head = 1;
    int tail = graph[1][0];
    ans.push_back(head);
    ans.push_back(tail);
    isUsed[head]= true;
    isUsed[tail]= true;
    // head でいけるとこまでいく
    while(1) {
        bool isLoop = false;
        for(auto& node : graph[head]) {
            if(!isUsed[node]) {
                // まだ入っていないなら入れる
                head = node;
                ans.push_front(head);
                isUsed[head] = true;
                isLoop = true;
                break;
            }
        }
        if(!isLoop) { break; }
    }
    // tail でいけるとこまでいく
    while(1) {
        bool isLoop = false;
        for(auto& node : graph[tail]) {
            if(!isUsed[node]) {
                // まだ入っていないなら入れる
                tail = node;
                ans.push_back(tail);
                isUsed[tail] = true;
                isLoop = true;
                break;
            }
        }
        if(!isLoop) { break; }
    }
    printf("%zu\n", ans.size());
    for(auto& node : ans) {
        printf("%d ", node);
    }
    printf("\n");
    return 0;
}


Measured memory_bytes: 9472
/* ****revpro**** */
// #pragma GCC target ("avx2")
// #pragma GCC optimization ("O3")
// #pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define endl	   '\n'
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll)x.size()
#define hell        1000000007
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define repr(i,a,b) for(ll i=b-1;i>=a;i--)    
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define mii	    map<ll,ll>
using namespace std;

#define TIME        cerr << "\nTime elapsed: " << setprecision(5) <<1000.0 * clock() / CLOCKS_PER_SEC << "ms\n";
#define FAST ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define N  100005
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;  
#define ordered_set tree<double, null_type,less<double>, rb_tree_tag,tree_order_statistics_node_update> 
void solve()
{
	long double  a,b;
	cin>>a>>b;
	cout<<(long long)(a*b)<<endl;
}
signed main()
{
	
		/***********************************/
    unsigned seed = std::chrono::system_clock::now().time_since_epoch().count();
    mt19937_64 generator (seed);
    /***********************************/
 
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int TESTS=1;
//	cin>>TESTS;
	while(TESTS--)
	{
		solve();
		
	}
	TIME
	return 0;
}

Measured memory_bytes: 3812
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;

const ll LINF = 1e18;
const int INF = 1e9;
const ll MOD = 1000000007;


int main(){

    int a, b;
    cin >> a >> b;
    if(a+b >= 10) cout << "error" << endl;
    else cout << a+b << endl;

    return 0;
}

Measured memory_bytes: 3616
#include <algorithm>
#include <climits>
#include <iostream>
#include <string>
#include <utility>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <iomanip>
#include <cmath>
#include <stack>
#define rep(i,n) for (int i=0; i<(n); ++i)
using namespace std;
using ll = long long int;

template <class T> ostream &operator<<(ostream &os, vector<T> &v) {
  for (auto i = v.begin(); i != v.end(); i++) {
    os << *i << " ";
  }
  return os;
}

const long long MOD = 1000000007;

int main(){
  int n;
  cin>>n;
  int sum = 0;
  rep(i,n) sum += i+1;
  std::cout << sum << std::endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const long long mod = 1e9+7;
long long power(long long a, long long b, long long m = mod) {
    if(b < 0) {
        return power(power(a, -b), mod-2);
    }
    long long x = 1;
    while(b) {
        if(b & 1) {
            x = 1ll * x * a % m;
        }
        a = 1ll * a * a % m;
        b /= 2;
    }
    return x;
}
const int N = 3e5+9;
signed main() {  
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    

    int n; cin >> n;
    vector<int> a(n);
    for(int i = 1; i < n; i++) {
    	int foo; cin >> foo; foo--;
    	a[foo]++;
    }
    for(int i = 0; i < n; i++) {
    	cout << a[i] << "\n";
    }


    





    return 0;
    
}


Measured memory_bytes: 3992
#include <stdio.h>
#include <string.h>
char s[101];
int main(void)
{
    scanf("%s",s);
    int res = 0;
    int i;
    int n = strlen(s);
    for (i=0;i<n;i++)
    {
        if (s[i] != s[n-i-1]) res++;
    }
    printf("%d\n",res/2);
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pp pair<pair<ll, ll>,pair<ll, ll>>
#define pll pair<ll,ll>
#define ppll pair<ll,pll>
#define pdd pair<double,double>
#define vii vector<int>
#define vll vector<ll>
#define mat vector<vector<ll>>
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define eb emplace_back
#define fi first
#define sc second
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define sz(x) (ll) (x).size()
#define pq priority_queue<ll>
#define pqg priority_queue<ll,vector<ll>,greater<ll>>
#define LB(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define UB(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
#define ERASE(v) sort(v.begin(),v.end());v.erase(unique(v.begin(),v.end()),v.end())
#define int ll
// #define ll int
using namespace std;
const ll INF = 1 << 29;
const ll LLINF = (1LL << 60LL);
const ll MOD = 1000000007;
const int MAX_V = 500;
// const ll mod = 998244353;
const ll MAX = 2100000;
const double pi = acos(-1);
const double eps = 1e-10;
ll dx[8] ={1,0,-1,0,1,-1,1,-1};
ll dy[8] ={0,1,0,-1,1,-1,-1,1};
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; }







void solve() {
    ll x,k,d;
    cin>>x>>k>>d;
    if(x==0){
        if(k%2==0){
            cout<<0<<endl;
        }
        else cout<<d<<endl;
    }
    else if(x>0){
        if(x / d > k){
            cout<<x-d*k<<endl;
        }
        else{
            ll ans=x%d;
            if(ans==0){
                ll cnt=k-x/d;
                if(cnt%2==0){
                    cout<<0<<endl;
                }
                else cout<<d<<endl;
            }
            else{
                ll cnt=k-x/d;
                if(cnt%2==0){
                    cout<<abs(ans)<<endl;
                }
                else cout<<abs(ans-d)<<endl;
            }
        }
    }
    else {
        if((-x) / d > k){
            cout<<abs(x+d*k)<<endl;
        }
        else {
            ll ans=x+(-x)/d*d;
            if(ans==0){
                ll cnt= k-(-x)/d;
                if(cnt%2==0) cout<<0<<endl;
                else cout<<abs(d)<<endl;
            }
            else{
                ll cnt=k-(-x)/d;
                if(cnt%2==0) cout<<abs(ans)<<endl;
                else cout<<abs(ans+d)<<endl;
            }
            
        }
    }
    

}






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


    ll t=1;
    rep(i,t){
        solve(); 
    }


    return 0;
}

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

using namespace std;

int n, res, ans[100005];

vector <pair<int, int> > edge[100005];
set <int> color[100005];

void solve(int id, int p) {
	int child = 0;
	
	for (int i = 0; i < edge[id].size(); i++) {
		int to = edge[id][i].first;
		int idx = edge[id][i].second;
		
		if (to == p) continue;
		
		child++;
	}
	
	vector <int> can;
	
	for (int i = 1; ; i++) {
		if ((int)can.size() == child) break;
		
		if (color[id].find(i) == color[id].end()) {
			can.push_back(i);
		}
	}
	
	child = 0;
	
	for (int i = 0; i < edge[id].size(); i++) {
		int to = edge[id][i].first;
		int idx = edge[id][i].second;
		
		if (to == p) continue;
		
		ans[idx] = can[child];
		color[to].insert(can[child]);
		res = max(res, can[child]);
		child++;
		
		solve(to, id);
	}
}

int main() {
	scanf("%d", &n);
	
	for (int i = 0; i < n - 1; i++) {
		int x, y;
		scanf("%d%d", &x, &y);
		edge[x].push_back(make_pair(y, i));
		edge[y].push_back(make_pair(x, i));
	}
	
	solve(1, -1);		
	
	printf("%d\n", res);
	
	for (int i = 0; i < n - 1; i++) printf("%d\n", ans[i]);
}


Measured memory_bytes: 23168
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include <unordered_map>
#include <iomanip>
#include <functional>
#include <bitset>
#include <complex>
#include <stack>
#include <cstdint>



#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rrep(i, n) for(ll i = (ll)(n-1); i >= 0; i--)
#define repi(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rrepi(i,a,b) for(ll i=(ll)(b-1);i>=(ll)(a);i--)

#define all(x) (x).begin(),(x).end()

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

typedef long long ll;

using namespace std;
int n;int x[60],y[60];
double d(double X,double Y){
  double ret=0;
  rep(i,n){
    chmax(ret,hypot(X-x[i],Y-y[i]));
  }
  return ret;
}
double cal(double X){
  double lo=0,hi=1000;
  rep(i,100){
    double m1=(lo+lo+hi)/3,m2=(lo+hi+hi)/3;
    if(d(X,m1)<d(X,m2))hi=m2;else lo=m1;
  }
  return d(X,lo);
}
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin>>n;rep(i,n)cin>>x[i]>>y[i];
  double lo=0,hi=1000;
  rep(i,100){
    double m1=(lo+lo+hi)/3,m2=(lo+hi+hi)/3;
    if(cal(m1)<cal(m2))hi=m2;else lo=m1;
  }
  cout<<setprecision(12)<<cal(lo)<<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;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n, m, c;
	cin >> n >> m >> c;
	vector<int> b(m);
	rep(i, m) cin >> b[i];
	int ans = 0;
	rep(i, n) {
		vector<int> a(m);
		rep(i, m) cin >> a[i];
		ll res = c;
		rep(i, m) {
			res += a[i] * b[i];
		}
		if (res > 0) ans++;
	}
	cout << ans << endl;
	return 0;
}

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

int main() {
  int n;
  ll S=0, s=0, ans=(ll)(1e18);
  cin >> n;
  vector<ll> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    S += a[i];
  }
  for (int i = 0; i < n - 1; i++) {
    s += a[i];
    ans = min(ans, abs(S - 2*s));
  }
  cout << ans << endl;
}

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

int main() {
  int x,y;
  cin >> x >> y;
  vector<int> g{0,1,3,1,2,1,2,1,1,2,1,2,1};
  if(g[x]==g[y]){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  
}


Measured memory_bytes: 256
fn main() {
    let s = read::<String>();
    let len = s.len();
    let n = s.parse::<u64>().unwrap();

    let mut ans = 0;
    for i in 0..1 << len - 1 {
        let mut start = 0;
        let mut sum = 0;

        for j in 0..len - 1 {
            if (1 << j) & i != 0 {
                sum += s[start..j + 1].parse::<u64>().unwrap();
                start = j + 1;
            }
        }
        sum += s[start..len].parse::<u64>().unwrap();
        ans += sum;
    }
    println!("{}", ans);
}

#[allow(dead_code)]
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}
#[allow(dead_code)]
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}
#[allow(dead_code)]
fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}
#[allow(dead_code)]
fn yn(result: bool) {
    if result {
        println!("Yes");
    } else {
        println!("No");
    }
}


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

int mod(const ll &x){
    return x > 0 ? x % MOD : (x+MOD) % MOD;
}

int modm(const ll &x,const ll &m){
    return x * m % MOD;
}

int modpow(ll x, ll p) {
    int ret = 1;
    while(p > 0) {
        if (p & 1) ret = modm(ret,x);
        x = modm(x,x);
        p >>= 1;
    }
    return ret;
}

// x * modinv(d)
int modd(ll x,ll d) {
    return modm(x,modpow(d,MOD-2));
}

int main(void)
{
    IOS
    constexpr int N = 62;
    int n; cin >> n;
    vector<bitset<N>> v;
    vector<int> c1(N) , c0(N);
    REP(i,n) {
        ll x;
        cin >> x;
        v.push_back(bitset<N>(x));
        REP(j,N) {
            if(v[i][j]) c1[j]++;
            else c0[j]++;
        }
    }

    int ans = 0;
    REP(i,n-1) {
        REP(j,N) {
            if(v[i][j]) c1[j]--;
            else c0[j]--;
        }
        bitset<N> bs(v[i]);
        ll tmp = 0;
        REP(j,N) {
            if (bs[j]) tmp = mod(tmp + modm(mod(1LL << j),c0[j]));
            else tmp = mod(tmp + modm(mod(1LL << j),c1[j]));
        }
        ans = mod(ans + tmp);
    }

    cout << ans << endl;

    return 0;
}


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

#define int long long
#define double long double
#define ff first
#define ss second
#define endl '\n'
#define ii pair<int, int>
#define mp make_pair
#define mt make_tuple
#define DESYNC ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define pb push_back
#define vi vector<int>
#define vii vector< ii >
#define EPS 1e-9
#define INF 1e18
#define ROOT 1
#define M 1000000007
const double PI = acos(-1);

using namespace std;

inline int mod(int n, int m){ int ret = n%m; if(ret < 0) ret += m; return ret; }

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

int32_t main(){
  DESYNC;
  int a,b;
  cin >> a >> b;
  if(0 < a && a < 10 && 0 < b && b < 10) cout << a*b << endl;
  else cout << -1 << endl;
}




Measured memory_bytes: 256
class Dice
	def initialize(array)
		@data = array
	end
	
	def move(dir)
		case dir.downcase
		when "e"
			tmp=@data[0]
			@data[0]=@data[3]
			@data[3]=@data[5]
			@data[5]=@data[2]
			@data[2]=tmp
		when "n"
			tmp=@data[0]
			@data[0]=@data[1]
			@data[1]=@data[5]
			@data[5]=@data[4]
			@data[4]=tmp
		when "s"
			tmp=@data[0]
			@data[0]=@data[4]
			@data[4]=@data[5]
			@data[5]=@data[1]
			@data[1]=tmp
		when "w"
			tmp=@data[0]
			@data[0]=@data[2]
			@data[2]=@data[5]
			@data[5]=@data[3]
			@data[3]=tmp
		end
	end
	
	def rotate
		tmp=@data[1]
		@data[1]=@data[2]
		@data[2]=@data[4]
		@data[4]=@data[3]
		@data[3]=tmp
	end
	
	def top
		return @data[0]
	end
	
	def front
		return @data[1]
	end
	
	def left
		return @data[3]
	end
	
	def right
		return @data[2]
	end
	
	def back
		return @data[4]
	end
	
	def bottom
		return @data[5]
	end
	
	def all
		return @data
	end
end

n = gets.chomp.to_i
dice = Array.new

n.times { |idx|
	dice[idx] = Dice.new(gets.chomp.split(" ").map(&:to_i))
}

(n-1).times { |idx1|
	d1 = dice[idx1].clone
	m = idx1+1
	while m<n
		flg = -1
		dice[m].all.each{
			d2 = dice[m].clone
			if d1.top==d2.top && flg<0
				flg=0
			elsif d1.top==d2.front && flg<1
				d2.move("N")
				flg=1
			elsif d1.top==d2.left && flg<2
				d2.move("E")
				flg=2
			elsif d1.top==d2.right && flg<3
				d2.move("W")
				flg=3
			elsif d1.top==d2.back && flg<4
				d2.move("S")
				flg=4
			elsif d1.top==d2.bottom && flg<5
				d2.move("S")
				d2.move("S")
				flg=5
			end
			
			4.times {
				if d1.front!=d2.front
					d2.rotate
				else
					break
				end
			}
			
			if d1.all == d2.all
				puts "No"
				exit(0)
			end
		}
		m+=1
	end
}
puts "Yes"

Measured memory_bytes: 8780
// %%
import java.util.*;
import java.io.PrintWriter;

// %%
public class Main {

    private static int N;
    private static int K;
    private static PrintWriter pw = new PrintWriter(System.out);

    public static void main(String[] args) {
        load();
        solve();
        pw.flush();
    }

    private static void load() {
        Scanner sc = new Scanner(System.in);
        N = sc.nextInt();
        K = sc.nextInt();
    }

    private static void solve() {
        if (K > (N - 1) * (N - 2) / 2) {
            pw.println(-1);
            return;
        }

        int cnt = N - 1 + (N - 1) * (N - 2) / 2 - K;
        pw.println(cnt);

        // for (int v = 1; v <= N; v += 1) {
        //     for (int w = v + 1; w <= N; w += 1) {
        //         pw.print(v);
        //         pw.print(' ');
        //         pw.println(w);
        //         cnt -= 1;
        //         if (cnt == 0) {
        //             return;
        //         }
        //     }
        // }

        int v = 1;
        while (true) {
            for (int w = v + 1; w <= N; w += 1) {
                pw.println(String.format("%d %d", v, w));
                cnt -= 1;
                if (cnt == 0) {
                    return;
                }
            }
            v += 1;
        }
    }

}

// %%
// Main.main(new String[0]);

Measured memory_bytes: 29696
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <numeric>
#include <iomanip>

// output
#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
// utility
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
template<class T> inline T chmax(T & a, const T b) { return a = (a < b) ? b : a; }
template<class T> inline T chmin(T& a, const T b) { return a = (a > b) ? b : a; }

// type/const
#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
/* const int MOD = 998244353; */
const int INF = 1e18;
const double PI = acos(-1);

using namespace std;
struct INIT { 
  INIT(){cin.tie(0); ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
}}INIT;


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

  int ans = INF;
  for(int i = 1; i*i <= N; i++){
    if(N%i == 0){
      int now = to_string(i).size();
      if(i*i != N) chmax(now, (int)to_string(N/i).size());
      chmin(ans, now);
    }
  }

  cout << ans << "\n";

  return 0;
}

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

public class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int k = sc.nextInt();
        int x = sc.nextInt();
        
        for (int i = x - k + 1; i <= x + k - 1; i++) {
            System.out.print(i + " ");
        }
        System.out.println();
    }
}

Measured memory_bytes: 21844
process.stdin.resume();
process.stdin.setEncoding('utf8');

// 標準入力取込
let gInput = '';
process.stdin.on('data', chunk => (gInput += chunk));
process.stdin.on('end', () => main(gInput.split(/\r?\n/)));

// 解答
function main(inputs: string[]): void {
  const lake = Number(inputs[0].split(' ')[0]);
  const distance = inputs[1].split(' ').map(Number);
  let max = 0;

  for (let i = 0; i < distance.length; i++) {
    let next = distance[i + 1];
    let span;
    if (!next) {
      span = lake - distance[i] + distance[0];
    } else {
      span = next - distance[i];
    }
    max = Math.max(max, span);
  }

  console.log(lake - max);
}


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

using namespace std;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
#define watch(a) { std::cout << #a << " = " << a << "\n"; }
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }
template<class T, class V> istream& operator>> (istream& ist, pair<T, V>& p) { return ist >> p.first >> p.second; }
template<class T> ostream& operator<< (ostream& ost, pair<T, T>& p) { return ost << p.first << ", " << p.second; }
template<class T> istream& operator>> (istream& ist, vector<T>& vs) { for(auto& e: vs) ist >> e; return ist; }

typedef long long ll;
int const inf = 1<<29;

int main() {
  int N, M; cin >> N >> M;
  int g[101][101];
  int raw[101][101];
  rep(i, N) rep(j, N) g[i][j] = g[j][i] = raw[i][j] = raw[j][i] = inf;
  rep(i, M) {
    int a, b, c; cin >> a >> b >> c;
    a--, b--;
    g[a][b] = g[b][a] = raw[a][b] = raw[b][a] = c;
  }
  rep(k, N) rep(i, N) rep(j, N) {
    if (g[i][k] == inf || g[k][j] == inf) {
      continue;
    }
    minimize(g[i][j], g[i][k] + g[k][j]);
  }
  int count = 0;
  rep(i, N) for (int j = 0; j < i; j++) {
    if (raw[i][j] < inf && g[i][j] < raw[i][j]) {
      count++;
    }
  }
  cout << count << "\n";
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; ++i)
#define REPP(i, n) for(int i = 1; i <= n; ++i)
#define REPR(i, n) for(int i = n-1; i >= 0; --i)
#define FOR(i, m, n) for(int i = m; i < n; ++i)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;

template<typename T1,typename T2> inline void chmin(T1 &a,T2 b) {if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b) {if(a<b) a=b;}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,k; cin >> n >> k; --k;
    vector<int> x(n);
    REP(i,n) cin >> x[i];
    int ans = INT_MAX,tmp;
    FOR(i,k,n) {
        tmp = abs(x[i]-x[i-k]) + min(abs(x[i]),abs(x[i-k]));
        chmin(ans,tmp);
    }
    cout << ans << endl;
    return 0;
}

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

int N,K;
map<int,int> ex;
vector<int> X;
int ans;

int main(void){
    cin >> N >> K;
    rep(i,N){
        int a;
        cin >> a;
        ex[a]++;
    }
    
    for(auto i:ex){
        X.push_back(i.second);
    }
    if(X.size()<=K){cout << 0 << endl;return 0;}
    sort(X.begin(),X.end());
    //rep(i,X.size())cout << X[i] << endl;

    int cnt = X.size();
    for(int i=0;i<X.size();i++){
        ans +=X[i];
        cnt--;
        if(cnt<=K)break;
    }
    
    cout << ans << endl;
}


Measured memory_bytes: 10748
package main

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

var (
	readString func() string
	readBytes  func() []byte
	stdout     *bufio.Writer
)

func init() {
	readString, readBytes = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func newReadString(ior io.Reader) (func() string, func() []byte) {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), math.MaxInt32)
	r.Split(bufio.ScanWords)

	f1 := func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
	f2 := func() []byte {
		return []byte(f1())
	}
	return f1, f2
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 10, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(readString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(stdout, f, args...)
}

func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(stdout, args...)
}

func eprintln(args ...interface{}) (int, error) {
	return fmt.Fprintln(os.Stderr, args...)
}

func eprintf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(os.Stderr, f, args...)
}

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

func min64(a, b int64) int64 {
	if a < b {
		return a
	}
	return b
}

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

func max64(a, b int64) int64 {
	if a < b {
		return b
	}
	return a
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func abs64(a int64) int64 {
	if a < 0 {
		return -a
	}
	return a
}

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

func gcd64(a, b int64) int64 {
	if b == 0 {
		return a
	}
	return gcd64(b, a%b)
}

// readString() string
// readInt() int
// readInt64() int64
// readFloat64() float64

// -----------------------------------------------------------------------------

func main() {
	defer stdout.Flush()
	N := readInt()
	x := make([]float64, N)
	y := make([]float64, N)
	for i := range x {
		x[i] = readFloat64()
		y[i] = readFloat64()
	}
	routes := make([]float64, 0)

	var dfs func(used []bool, prev int, accm float64)
	dfs = func(used []bool, prev int, accm float64) {
		end := true
		for i := 0; i < N; i++ {
			if used[i] {
				continue
			}
			end = false
			xd := x[prev] - x[i]
			yd := y[prev] - y[i]
			d := math.Sqrt(xd*xd + yd*yd)
			used[i] = true
			dfs(used, i, accm+d)
			used[i] = false
		}
		if end {
			routes = append(routes, accm)
		}
	}

	for i := 0; i < N; i++ {
		used := make([]bool, N)
		used[i] = true
		dfs(used, i, 0)
	}

	var sum float64
	for _, v := range routes {
		sum += v
	}
	println(sum / float64(len(routes)))

}

// -----------------------------------------------------------------------------


Measured memory_bytes: 2432
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const long long M = 10e9+7;
int main()
{
	int n;cin>>n;
	int chhoto = INT_MAX;
	vector<int>okay,notokay;
	int x;cin>>x;
	okay.push_back(x);
	chhoto = min(chhoto ,okay[0]);
	for(int i=0;i<n-1;i++)
	{
		int x;cin>>x;
		chhoto = min(x,chhoto);
		if(x<=chhoto)
			okay.push_back(x);
		else notokay.push_back(x);
	}
	cout<<okay.size()<<"\n";
	return 0;
}

Measured memory_bytes: 1468
(defun solver ()
  (let ((H (read)) (W (read))
        (array (make-array 101)))
    (loop for i from 1 to H do
          (setf (svref array i) (read)))
    (loop for i from 1 to (+ W 2) do
          (format t "#"))
    (format t "~%")
    (loop for i from 1 to H do
          (format t "#~(~A~)#~%" (svref array i)))
    (loop for i from 1 to (+ W 2) do
          (format t "#"))
    (format t "~%")))

(solver)

Measured memory_bytes: 16480
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
typedef long long int ll;
#define BIG_NUM 2000000000
using namespace std;

struct Info1{
	Info1(int arg_x,int arg_y,int arg_w){
		x = arg_x;
		y = arg_y;
		w = arg_w;
	}
	bool operator<(const struct Info1 &arg) const{
			return y < arg.y;
	};
	int x,y,w;
};

struct Info2{
	Info2(int arg_x,int arg_w){
		x = arg_x;
		w = arg_w;
	}
	bool operator<(const struct Info2 &arg) const{
			return x < arg.x;
	};
	int x,w;
};

int main(){

	int N,tmp_x,tmp_y,tmp_w,pre_y,pre_x,index = -1,self,ans = 0,right;
	scanf("%d",&N);

	int* Y_VALUE = new int[N];

	priority_queue<Info1> Q;

	for(int loop = 0; loop < N; loop++){
		scanf("%d %d %d",&tmp_x,&tmp_y,&tmp_w);
		Q.push(Info1(tmp_x,tmp_y,tmp_w));
	}

	vector<Info2> V[N];

	pre_y = BIG_NUM;

	while(!Q.empty()){
		if(Q.top().y != pre_y){
			index++;
			Y_VALUE[index] = Q.top().y;
			V[index].push_back(Info2(Q.top().x,Q.top().w));
		}else{
			V[index].push_back(Info2(Q.top().x,Q.top().w));
		}
		pre_y = Q.top().y;
		Q.pop();
	}
	index++;

	for(int i = 0; i < index; i++)sort(V[i].begin(),V[i].end());

	pre_y = pre_x = BIG_NUM;

	int l,r,m,loc;

	for(int i = 0; i < index; i++){
		for(int k = 0; k < V[i].size(); k++){

			if(pre_y == i && pre_x == V[i][k].x-1){
				self = right;
			}else{
				if(i == index - 1 || Y_VALUE[i] - Y_VALUE[i+1] > 1){
					ans = max(ans,V[i][k].w);
					self = V[i][k].w;
				}else{
					l = 0;
					r = V[i+1].size()-1;
					m = (l+r)/2;
					loc = BIG_NUM;

					while(l <= r){
						if(V[i+1][m].x == V[i][k].x || V[i+1][m].x == V[i][k].x-1){
							loc = m;
							break;
						}else{
							if(V[i+1][m].x > V[i][k].x){
								r = m-1;
							}else{
								l = m+1;
							}
							m = (l+r)/2;
						}
					}

					if(loc == BIG_NUM){
						ans = max(ans,V[i][k].w);
						self = V[i][k].w;
					}else{
						if(V[i+1][loc].x == V[i][k].x){
							self = V[i][k].w + V[i+1][loc].w;
							if(loc > 0 && V[i+1][loc-1].x == V[i][k].w - 1){
								ans = max(ans,self+V[i+1][loc-1].w);
							}else{
								ans = max(ans,self);
							}
						}else{
							if(loc < V[i+1].size()-1 && V[i+1][loc+1].x == V[i][k].x){
								self = V[i][k].w + V[i+1][loc+1].w;
							}else{
								self = V[i][k].w;
							}
							ans = max(ans,self+V[i+1][loc].w);
						}
					}
				}
			}

			if(k < V[i].size()-1 && V[i][k+1].x == V[i][k].x+1){
				right = V[i][k+1].w;
			}else{
				right = 0;
			}

			if(i < index-1 && Y_VALUE[i+1] == Y_VALUE[i]-1){
				l = 0;
				r = V[i+1].size()-1;
				m = (l+r)/2;
				loc = BIG_NUM;

				while(l <= r){
					if(V[i+1][m].x == V[i][k].x+1){
						loc = m;
						break;
					}else{
						if(V[i+1][m].x > V[i][k].x){
							r = m-1;
						}else{
							l = m+1;
						}
						m = (l+r)/2;
					}
				}

				if(loc != BIG_NUM)right += V[i+1][loc].w;
			}

			ans = max(ans,self+right);

			pre_y = i;
			pre_x = V[i][k].x;
		}
	}

	printf("%d / 1\n",ans);

   return 0;
}

Measured memory_bytes: 9404
#include <iostream>
#include <stdio.h>
#include <string>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <cmath>
//vector<vector<ll>> data(3, vector<ll>(4));
//vector<ll> data(N);
//str s = to_string(i);
//int i = c - '0'
//sort(data.begin(), data.end());
//reverse(data.begin(), data.end());
//data.erase(unique(data.begin(), data.end()), data.end());
//str.substr(n)//n番以降スライス
//str.substr(n,m)//n番以降m文字スライス
//str.erase(n)//n番以降削除
//str.erase(n,m)//n番以降m文字削除
typedef long long ll;
#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=ll(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=ll(b);i--)
#define PB push_back
#define MOD 1000000007
using namespace std;

ll powmod(ll x, ll y) {
	ll s=1;
	REP(i, y) {
		s = s * x % MOD;
	}
	return s;
}

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

	ll s;
	s = powmod(10, N) - 2 * powmod(9, N) + powmod(8, N);
	if (s % MOD >= 0) s %= MOD;
	else s = s % MOD + MOD;
	cout << s << endl;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
#define R register int 
#define ll long long
#define inf 2147483647
using namespace std;
const int N=500000;
int n,x[N],y[N],h[N];
int gi(){
    R x=0,k=1;char c=getchar();
    while((c<'0'||c>'9')&&c!='-')c=getchar();
	if(c=='-')k=-1,c=getchar();
    while(c>='0'&&c<='9')x=(x<<3)+(x<<1)+c-'0',c=getchar();
	return x*k;
}
int CHECK(R cx,R cy,R H){
	for(R j=1;j<=n;++j){
		if(max(H-abs(cx-h[j])-abs(cy-h[j]),0)!=h[j])return -1;
		
	}
	return 1;
	
}
int check(R cx,R cy){
	R le=1,ri=inf;
	for(R j=1;j<=n;++j){
		if(h[j]>0){
			R H=h[j]+abs(x[j]-cx)+abs(y[j]-cy);
			if(CHECK(cx,cy,H)!=-1)return H;
			else return -1;
		}
		else ri=min(ri,abs(x[j]-cx)+abs(y[j]-cy));
	}
	return ri;
}
int main() {
    cin >> n;
    for (int i = 1; i <= n; ++i) cin >> x[i] >> y[i] >> h[i];
    for (int cx = 0; cx <= 100; ++cx)
        for (int cy = 0; cy <= 100; ++cy) {
            ll lh = 1, rh = 2e9;
            for (int i = 1; i <= n; ++i) {
                ll d = abs(x[i] - cx) + abs(y[i] - cy);
                if (h[i] == 0) rh = min(rh, d);
                else lh = max(lh, h[i] + d), rh = min(rh, h[i] + d);
            }
            if (lh <= rh) {
                cout << cx << " " << cy << " " << rh << endl;
                return 0;
            }
        }
    return 0;
}


Measured memory_bytes: 2304
#include<iostream>
#include<vector>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
using ll = long long;
using P = pair<int, int>;
#include<algorithm>
#include<math.h>
#include<map>
#include<queue>

int main() {
	int n;
	string s;
	cin >> n >> s;
	if (n % 2 == 1) {
		cout << "No";
		return 0;
	}
	int c = n / 2;
	vector<int>a(c);
	vector<int>b(c);
	rep(i, c) {
		a[i] = s[i];
	}
	rep(i, c) {
		b[i] = s[i + c];
	}
	bool ok = true;
	rep(i, c) {
		if (a[i] != b[i]) {
			ok = false;
		}
	}
	if (ok) {
		cout << "Yes";

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define len(x) x.size()
#define rep(i,a) for(int i=0;i<a;i++)
#define f(i,a,b) for(int i=a;i<=b;i++)
using namespace std;

signed main(){
    
	string s;
	cin>>s;
	rep(i,len(s)) cout<<'x';

	return 0;
}


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

int main() {

    long long n; cin >> n;
    if( n < 7 ){
        cout << 1 << '\n';
        return 0;
    }
    n*=2;
    if( n%11LL <= 1LL ){
        cout << n/11LL << '\n';
    }
    else{
        cout << n/11LL +1 << '\n';

    }


}


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

int main() {
	int n, a[100];
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> a[i];
	for (int i = n - 1; i >= 0; i--)
		cout << a[i] << (i == 0 ? '\n' : ' ');
}



Measured memory_bytes: 3100