akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#define FOR(s, i, n) for(int i = s; i n; i++)
typedef long long ll;
const int INF = 1e9;
int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	
	int s, w;
	cin>>s>>w;
	puts(w>=s?"unsafe":"safe");
	return 0;
}

Measured memory_bytes: 3616
#include "bits/stdc++.h"
#define ll long long
#define ALL(x) x.begin(),x.end()
#define MOD (1000000000+7)
using namespace std;

int main(){

  string s,t;
  cin>>s>>t;
  ll N = s.size();

  bool b=1;

  vector<char> st(26,'0');
  vector<char> ts(26,'0');
  for(ll i=0;i<N;i++){
    if(st[s[i]-'a']=='0'){
      st[s[i]-'a'] = t[i];
    }
    else if(st[s[i]-'a'] == t[i]){

    }
    else{
      b=0;
      break;
    }
  }

  for(ll i=0;i<N;i++){
    if(ts[t[i]-'a']=='0'){
      ts[t[i]-'a'] = s[i];
    }
    else if(ts[t[i]-'a']==s[i]){

    }
    else{
      b=0;
      break;
    }
  }



  

if(b==0)
cout<<"No"<<endl;
else
{
  cout<<"Yes"<<endl;
}


}
  


Measured memory_bytes: 776
#include<bits/stdc++.h>
#define VI vector<int>
#define VVI vector<vector<int>>
#define REP(i,n) for(int i=0;i<(n);i++)
#define MOD 1000000007
#define INF 1e9
#define All(x) (x).begin(),(x).end()
typedef long long ll;
using namespace std;

int main(){
    ll k,n;cin>>k>>n;
    VI a(n);
    REP(i,n)cin>>a[i];

    int ans=k-a[n-1]+a[0];
    for(int i=0;i<n;i++){
        ans=max(ans,a[i+1]-a[i]);
    }
    cout<<k-ans<<endl;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define REP(x,y,z) for(int x=y;x<=z;x++)
#define FORD(x,y,z) for(int x=y;x>=z;x--)
#define MSET(x,y) memset(x,y,sizeof(x))
#define FOR(x,y) for(__typeof(y.begin()) x=y.begin();x!=y.end();x++)
#define F first
#define S second
#define MP make_pair
#define PB push_back
#define SZ size()
#define M 
void RI(){}
template<typename... T>
void RI( int& head, T&... tail ) {
  scanf("%d",&head);
  RI(tail...);
}
using namespace std;
typedef long long LL;
int main()
{
	string in;
	cin >> in;
	int a = 0, b = 0;
	for(int i = 0; i < (int)in.length(); i++) {
		if(i & 1 && in[i] == '0') a++;
		else if(!(i&1) && in[i] == '1') a++;
	}
	for(int i = 0; i < (int)in.length(); i++) {
		if(i & 1 && in[i] == '1') b++;
		else if(!(i&1) && in[i] == '0') b++;
	}
	cout << min(a, b) << endl;
	
  return 0;
}


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

int main(){
    ll n,a,b; cin >> n >> a >> b;
    if((b-a)%2) cout << min(a+(b-a-1)/2,n-b+1+(b-a-1)/2) << endl;
    else cout << (b-a)/2 << endl;
}

Measured memory_bytes: 256
function main (s) {
	s=s.split(" ");
	for(var i=0;i<s.length;i++)s[i]=parseInt(s[i]);
	if(s[0]+s[1]>s[2]+s[3])console.log("Left\n");
	else if(s[0]+s[1]<s[2]+s[3])console.log("Right\n");
	else console.log("Balanced\n");
}
 
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 7372
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int main(){
  int H,W,D;
  cin>>H>>W>>D;
  int a[H+1][W+1];
  int x[H*W+1],y[H*W+1];
  for(int i=1; i<=H; i++){
    for(int j=1; j<=W; j++){
      cin>>a[i][j];
      x[a[i][j]]=i,y[a[i][j]]=j;
    }
  }
  ll S[H*W+1];
  for(int i=1; i<=H*W; i++){
      S[i+D]=S[i]+(abs(x[i+D]-x[i])+abs(y[i+D]-y[i]));
  }
  int Q;
  cin>>Q;
  for(int i=0; i<Q; i++){
    int a,b;
    cin>>a>>b;
    cout<<S[b]-S[a]<<endl;
  }
} 

Measured memory_bytes: 2816
from collections import Counter
n = int(input())
a = list(map(int,input().split()))
b = [0]*n
for i in range(n):
  b[i] = a[i]-i
c = Counter(b)
ans = 0
for i in range(n):
  ans += c[-a[i]-i]
  c[b[i]] -= 1
print(ans)

Measured memory_bytes: 118000
#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;
int main()
{
	long long a,temp;
	scanf("%I64d",&a);
	int num=1;
	while(1){
		temp=(num+1)*num/2;
		if(temp>=a) break;
		num++;
	}
	if(temp==a){
		for(int i=1;i<=num;i++)
			printf(")");
		for(int i=1;i<=num;i++)
			printf("(");
		printf("\n");
	}
	else {
		long long temp2=temp-a-1;
		for(int i=1;i<=num;i++){
			if(i==num-temp2) printf("(");
			printf(")");
		}
		for(int i=1;i<num;i++){
			printf("(");
		}
		printf("\n");
	}
}

Measured memory_bytes: 3144
#include <iostream>
#include <vector>

bool find_earth(const std::vector<int>& c, int w, int h, int *x, int *y) {
  *x = -1;
  *y = -1;
  for (int i=0; i<h; i++) {
    for (int j=0; j<w; j++) {
      if (c[i*w+j]) {
        *x = i;
        *y = j;
        return true;
      }
    }
  }
  return false;
}

void spread(std::vector<int>& c, int x, int y, int w, int h) {
  c[x*w+y] = false;
  if (0 < x && c[(x-1)*w+y]) spread(c, x-1, y, w, h);
  if (x < h-1 && c[(x+1)*w+y]) spread(c, x+1, y, w, h);
  if (0 < y && c[x*w+(y-1)]) spread(c, x, y-1, w, h);
  if (y < w-1 && c[x*w+(y+1)]) spread(c, x, y+1, w, h);
  
  if (0 < x && 0 < y && c[(x-1)*w+(y-1)]) spread(c, x-1, y-1, w, h);
  if (x < h-1 && y < w-1 && c[(x+1)*w+(y+1)]) spread(c, x+1, y+1, w, h);
  if (0 < x && y < w-1 && c[(x-1)*w+(y+1)]) spread(c, x-1, y+1, w, h);
  if (0 < y && x < h-1 && c[(x+1)*w+(y-1)]) spread(c, x+1, y-1, w, h);
}

bool solve() {
  int w, h;
  std::cin >> w >> h;
  if (w == 0 && h == 0) return false;
  std::vector<int> c(w*h);
  for (int i=0; i<h; i++) {
    for (int j=0; j<w; j++) {
      std::cin >> c[i*w+j];
    }
  }
  
  int cnt = 0, x, y;
  bool found = find_earth(c, w, h, &x, &y);
  while(found) {
    spread(c, x, y, w, h);
    cnt++;
    found = find_earth(c, w, h, &x, &y);
  }
  
  std::cout << cnt << std::endl;
  
  return true;
}

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


Measured memory_bytes: 3308
package main

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

type entry struct {
	num, count int64
}
type byNum []entry

func (l byNum) Len() int {
	return len(l)
}
func (l byNum) Swap(i, j int) {
	l[i], l[j] = l[j], l[i]
}
func (l byNum) Less(i, j int) bool {
	return l[i].num < l[j].num
}

func get_int(sc *bufio.Scanner) int64 {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return int64(i)
}

func main() {
	var n, k int64
	fmt.Scan(&n, &k)

	as := make([]int64, n)
	bs := make([]int64, n)
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	for i := range as {
		as[i] = get_int(sc)
		bs[i] = get_int(sc)
	}

	counter := make(map[int64]int64)
	for i, a := range as {
		counter[a] += bs[i]
	}

	cs := make(byNum, 0)
	for k, v := range counter {
		cs = append(cs, entry{num: k, count: v})
	}
	sort.Sort(cs)

	sum := int64(0)
	for _, c := range cs {
		sum += c.count
		if sum >= k {
			fmt.Println(c.num)
			break
		}
	}
}


Measured memory_bytes: 12672
using System;
using System.Collections.Generic;
using System.Text;

namespace AtTest.ABC_113
{
    class B
    {
        static void Main(string[] args)
        {
            Method(args);
            Console.ReadLine();
        }

        static void Method(string[] args)
        {
            int n = ReadInt();
            int[] ta = ReadInts();
            int tP = ta[0] * 1000;
            int aP = ta[1] * 1000;
            int[] hs = ReadInts();
            int resIndex = 0;
            int deltaMin = int.MaxValue;
            for(int i =0; i < n; i++)
            {
                int tTemp = tP - 6*hs[i];
                int deltaTemp = Math.Abs(aP - tTemp);
                if (deltaMin > deltaTemp)
                {
                    deltaMin = deltaTemp;
                    resIndex = i;
                }
            }
            Console.WriteLine(resIndex + 1);
        }

        private static string Read() { return Console.ReadLine(); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


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

#define REP(i, x, n) for (int i = x; i < (int)(n); i++)
#define rep(i, n) REP (i, 0, n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x.size())
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define uniq(x) x.erase(unique(x.begin(), x.end()), x.end())
#define F first
#define S second
#define mp make_pair
#define eb emplace_back

using namespace std;

typedef long long ll;

// const int INF = 1 << 30;
// const ll INF = 1LL << 60;
// const int MOD = 1000000007;

int main() {
  string s;
  cin >> s;
  int ans = 0;
  for (int i = 0; i <= s.size(); i++) {
    for (int j = i; j <= s.size(); j++) {
      int tmp = 0;
      bool flg = true;
      for (int k = i; k < j; k++) {
        if (s[k] == 'A') tmp++;
        else if (s[k] == 'C') tmp++;
        else if (s[k] == 'G') tmp++;
        else if (s[k] == 'T') tmp++;
        else flg = false;
      }
      if (flg) ans = max(ans, tmp);
    }
  }

  cout << ans << endl;
}


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

using namespace std;

typedef long long ll;

const int MAX_N = 1000 + 7;

ll A[MAX_N];

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

  int N, K;
  cin >> N >> K;
  for (int i = 0; i < N; i++)
    cin >> A[i];

  vector<ll> vs;
  for (int i = 0; i < N; i++) {
    ll s = 0;
    for (int j = i; j < N; j++) {
      s += A[j];
      vs.push_back(s);
    }
  }

  ll ans = 0;
  for (int i = 60; i >= 0; i--) {
    ans ^= (1ll << i);

    int cnt = 0;
    for (ll x : vs) {
      if ((ans & x) == ans)
        cnt++;
    }

    if (cnt < K)
      ans ^= (1ll << i);
  }

  cout << ans << '\n';

  return 0;
}


Measured memory_bytes: 6000
#![allow(unused_imports)]
#![allow(non_snake_case, unused)]

use std::cmp::*;
use std::collections::*;
use std::ops::*;

macro_rules! eprint {
	($($t:tt)*) => {{
		use ::std::io::Write;
		let _ = write!(::std::io::stderr(), $($t)*);
	}};
}
macro_rules! eprintln {
	() => { eprintln!(""); };
	($($t:tt)*) => {{
		use ::std::io::Write;
		let _ = writeln!(::std::io::stderr(), $($t)*);
	}};
}
macro_rules! dbg {
	($v:expr) => {{
		let val = $v;
		eprintln!("[{}:{}] {} = {:?}", file!(), line!(), stringify!($v), val);
		val
	}}
}

macro_rules! mat {
	($($e:expr),*) => { Vec::from(vec![$($e),*]) };
	($($e:expr,)*) => { Vec::from(vec![$($e),*]) };
	($e:expr; $d:expr) => { Vec::from(vec![$e; $d]) };
	($e:expr; $d:expr $(; $ds:expr)+) => { Vec::from(vec![mat![$e $(; $ds)*]; $d]) };
}

macro_rules! ok {
	($a:ident$([$i:expr])*.$f:ident()$(@$t:ident)*) => {
		$a$([$i])*.$f($($t),*)
	};
	($a:ident$([$i:expr])*.$f:ident($e:expr$(,$es:expr)*)$(@$t:ident)*) => { {
		let t = $e;
		ok!($a$([$i])*.$f($($es),*)$(@$t)*@t)
	} };
}

pub fn readln() -> String {
	let mut line = String::new();
	::std::io::stdin().read_line(&mut line).unwrap_or_else(|e| panic!("{}", e));
	line
}

macro_rules! read {
	($($t:tt),*; $n:expr) => {{
		let stdin = ::std::io::stdin();
		let ret = ::std::io::BufRead::lines(stdin.lock()).take($n).map(|line| {
			let line = line.unwrap();
			let mut it = line.split_whitespace();
			_read!(it; $($t),*)
		}).collect::<Vec<_>>();
		ret
	}};
	($($t:tt),*) => {{
		let line = readln();
		let mut it = line.split_whitespace();
		_read!(it; $($t),*)
	}};
}

macro_rules! _read {
	($it:ident; [char]) => {
		_read!($it; String).chars().collect::<Vec<_>>()
	};
	($it:ident; [u8]) => {
		Vec::from(_read!($it; String).into_bytes())
	};
	($it:ident; usize1) => {
		$it.next().unwrap_or_else(|| panic!("input mismatch")).parse::<usize>().unwrap_or_else(|e| panic!("{}", e)) - 1
	};
	($it:ident; [usize1]) => {
		$it.map(|s| s.parse::<usize>().unwrap_or_else(|e| panic!("{}", e)) - 1).collect::<Vec<_>>()
	};
	($it:ident; [$t:ty]) => {
		$it.map(|s| s.parse::<$t>().unwrap_or_else(|e| panic!("{}", e))).collect::<Vec<_>>()
	};
	($it:ident; $t:ty) => {
		$it.next().unwrap_or_else(|| panic!("input mismatch")).parse::<$t>().unwrap_or_else(|e| panic!("{}", e))
	};
	($it:ident; $($t:tt),+) => {
		($(_read!($it; $t)),*)
	};
}

pub fn main() {
	let _ = ::std::thread::Builder::new().name("run".to_string()).stack_size(32 * 1024 * 1024).spawn(run).unwrap().join();
}

const MOD: usize = 1_000_000_007;
const INF: i64 = std::i64::MAX/2;

pub trait SetMinMax {
	fn setmin(&mut self, v: Self) -> bool;
	fn setmax(&mut self, v: Self) -> bool;
}
impl<T> SetMinMax for T where T: PartialOrd {
	fn setmin(&mut self, v: T) -> bool {
		*self > v && { *self = v; true }
	}
	fn setmax(&mut self, v: T) -> bool {
		*self < v && { *self = v; true }
	}
}

fn solve() {
	let s = read!(String);
	let c = s.chars().collect::<Vec<char>>();
	if c[2]==c[3] && c[4]==c[5]{
		println!("Yes");
	}
	else {
		println!("No");
	}
}

fn run() {
    solve();
}


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

int main() {
  int H, W;
  scanf("%d%d", &H, &W);
  vector<vector<char>> grid(H + 2, vector<char>(W + 2, '0'));
  for (int i = 0; i < H + 2; i++) {
    for (int j = 0; j < W + 2; j++) {
      if (i == 0 || i == H + 1 || j == 0 || j == W + 1) grid.at(i).at(j) = 'w';
    }
  }

  for (int i = 1; i <= H; i++) {
    for (int j = 1; j <= W; j++) {
      char input;
      cin >> input;

      if (input == '#') {
        for (int y = i - 1; y <= i + 1; y++) {
          for (int x = j - 1; x <= j + 1; x++) {
            if (grid.at(y).at(x) == '#') {
              continue;
            }

            if (y == i && x == j) {
              grid.at(y).at(x) = '#';
            } else if (grid.at(y).at(x) == 'w') {
              continue;
            } else {
              grid.at(y).at(x)++;
            }
          }
        }
      }
    }
  }

  for (int i = 1; i <= H; i++) {
    for (int j = 1; j <= W; j++) {
      cout << grid.at(i).at(j);
    }
    cout << endl;
  }

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a, b;
  cin >> a >> b;
  double x = (a + b) / 2.0;
  double o = x - int(x);  
  if (o > 0) {
    ++x;
    x = x - o;
  }
  cout << x << endl;
}

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

#define rep(i,n) for(int i=0;i<n;i++)
#define repa(i,a,n) for(int i=a;i<=n;i++)
#define repb(i,a,n) for(int i=a;i>=n;i--)
#define trav(a,x) for(auto a=x.begin();a!=x.end();a++)
#define all(x) x.begin(),x.end()
#define fst first
#define snd second
#define pb push_back
#define mp make_pair
typedef long double ld;
typedef pair <int,int> pii;
typedef vector <int> vi;
typedef long long ll;


void pre(){

}

void solve(){
  int n; cin>>n;
  int temp=n/1000;

  if(temp*1000==n){
    cout<<0<<"\n";
    return;
  }

  temp++;

  cout<<(temp*1000)-n<<"\n";
}

int main(){
  ios_base::sync_with_stdio(0); cin.tie(0);
  pre();
  int t; t=1;
  rep(i,t) solve();
  return 0;
}


Measured memory_bytes: 3616
def partition(A,p,r):
    x = A[r][1]
    i = p-1
    for j in range(p,r):
        if A[j][1] <= x:
            i += 1
            A[i], A[j] = A[j], A[i]
    A[i+1], A[r] = A[r], A[i+1]
    return i+1

def quicksort(A,p,r):
    if p<r:
        q = partition(A,p,r)
        quicksort(A,p,q-1)
        quicksort(A,q+1,r)
    

def stable(A,Q):
    for i in range(1,len(Q)):
        if int(Q[i-1][1]) == int(Q[i][1]):
            x = A.index(Q[i-1])
            y = A.index(Q[i])
            if y<x:
                return 'Not stable'
    return 'Stable'

n = int(input())
A = []
for i in range(n):
    a = input().split()
    a[1]=int(a[1])
    A.append(a)
Q = A.copy()
quicksort(Q, 0, n-1)
print(stable(A,Q))
for i in range(len(Q)):
    print(Q[i][0], Q[i][1])


Measured memory_bytes: 26756
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdint>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <utility>
#include <vector>

using namespace std;
using ll = long long;

#define EPS (1e-7)

template <ll Modulus = 1000000007>
class modint {
 public:
  ll a;

  constexpr modint(const ll x = 0) noexcept : a(x % Modulus) {}
  constexpr ll& value() noexcept { return a; }
  constexpr const ll& value() const noexcept { return a; }
  constexpr modint operator+(const modint& rhs) const noexcept { return modint(*this) += rhs; }
  constexpr modint operator-(const modint& rhs) const noexcept { return modint(*this) -= rhs; }
  constexpr modint operator*(const modint& rhs) const noexcept { return modint(*this) *= rhs; }
  constexpr modint operator/(const modint& rhs) const noexcept { return modint(*this) /= rhs; }
  constexpr modint& operator+=(const modint& rhs) noexcept {
    a += rhs.a;
    if (a >= Modulus) {
      a -= Modulus;
    }
    return *this;
  }
  constexpr modint& operator-=(const modint& rhs) noexcept {
    if (a < rhs.a) {
      a += Modulus;
    }
    a -= rhs.a;
    return *this;
  }
  constexpr modint& operator*=(const modint& rhs) noexcept {
    a = a * rhs.a % Modulus;
    return *this;
  }
  constexpr modint& operator/=(modint rhs) noexcept {
    ll exp = Modulus - 2;
    while (exp) {
      if (exp % 2) {
        *this *= rhs;
      }
      rhs *= rhs;
      exp /= 2;
    }
    return *this;
  }
};
using mint = modint<>;

int main() {
  ll N, K;
  cin >> N >> K;
  vector<ll> A(N);
  for (ll i = 0; i < N; i++) {
    cin >> A[i];
  }

  // 1ループで見つかる範囲の純粋な転倒数
  mint pure = 0;
  // vector<ll> Pure(N);
  for (ll i = 0; i < N; i++) {
    for (ll j = i + 1; j < N; j++) {
      if (A[i] > A[j]) {
        // Pure[i]++;
        pure += 1;
      }
    }
  }

  // B回繰り返しによって発生する転倒数
  // vector<ll> NoPure(N);
  mint nopure = 0;
  for (ll i = 0; i < N; i++) {
    for (ll j = 0; j < i; j++) {
      if (A[i] > A[j]) {
        // NoPure[i]++;
        nopure += 1;
      }
    }
  }

  mint ans = (pure * K * (K + 1) / 2) + (nopure * K * (K - 1) / 2);

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


Measured memory_bytes: 256
import java.util.*;


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

        char[] S = scan.nextLine().toCharArray();
        int length = S.length - 1;
        length = (length/ 2) * 2;
        for (; length >= 0; length -= 2) {
            boolean flag = true;
            for (int i = 0; i < length / 2; i++)  {
                if(S[i] != S[length / 2 + i]) {
                    flag = false;
                    break;
                }
            }
            if (flag) {
                System.out.println(length);
                return;
            }
        }

    }
}

Measured memory_bytes: 22996
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  int n,m;
  cin>>n>>m;
  int a[n*2],sum=0,ma=0;
  for(int i=0;i<n;i++){
    cin>>a[i];
    a[n+i]=a[i];
    sum+=a[i];
    ma=max(ma,a[i]);
  }
  srand((unsigned)time(NULL));
  time_t start=clock();
  set<int> s;
  int ans=sum;
  while((double)(clock()-start)/CLOCKS_PER_SEC<7.0){
    int p=rand()%n;
    if(s.count(p)) continue;
    s.insert(p);
    int l=ma-1,r=sum;
    while(l+1<r){
      int mid=(l+r)/2;
      int v=p,t=a[p],c=0;
      while(1){
    while(v+1<p+n&&t+a[v+1]<=mid){
      v++;
      t+=a[v];
    } 
    c++;t=0;
    if(v+1>=p+n) break;
      }
      if(c<=m) r=mid;
      else l=mid;
    }
    //cout<<r<<endl;
    ans=min(ans,r);
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 4152
import java.util.Scanner;

public class Main{
public static void main(String[] args){
 Scanner sc = new Scanner(System.in);
 int w =sc.nextInt();
 int n =sc.nextInt();
 int[] values =new int[w];
 for(int i=0;i<values.length;i++){
  values[i]=i+1;
 }
 for(int i=0;i<n;i++){
String str= sc.next();
String[]ab= str.split(",");
int a=Integer.parseInt(ab[0])-1;
int b=Integer.parseInt(ab[1])-1;
int t=values[a];
values[a]=values[b];
values[b]=t;
}
for(int i=0;i<values.length;i++){
 System.out.printf("%d\n",values[i]);
 }
}
}

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

int main() {
  int n;cin>>n;
  vector<int> a(n);
  rep(i,n)cin>>a[i];
  sort(all(a));
  rep(i,n-1){
    if(a[i]==a[i+1]){
      cout<<"NO"<<endl;
      return 0;
    }
  }
  cout<<"YES"<<endl;
}

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

#include <bits/stdc++.h>

using namespace std;

class arc095_c {
public:
    void solve(istream& in, ostream& out) {
        int N;
        in >> N;
        vector<pair<int, int>> X(N);
        for (int i = 0; i < N; ++i) {
            in >> X[i].first;
            X[i].second = i;
        }
        sort(begin(X), end(X));
        vector<int> B(N);
        for (int i = 0; i < N; ++i) {
            if (i < N / 2) {
                B[X[i].second] = X[N / 2].first;
            } else {
                B[X[i].second] = X[N / 2 - 1].first;
            }
        }
        for (int y : B) {
            out << y << "\n";
        }
    }
};

int main() {
	std::ios::sync_with_stdio(false); cin.tie(nullptr);
	arc095_c solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 4608
import sys

n,m,q = map(int,input().split())
score = {}
for i in range(1,10):
  for j in range(2,11):
    score[(i,j)] = [0 for k in range(10)]
    
for i in range(q):
  a,b,c,d = map(int,input().split())
  score[(a,b)][c] = d


total = []
dic = {}
for i in range(m):
  dic[(i,)] = score[(1,2)][i]
total.append(dic)

if n == 2:
  print(max(score[(1,2)]))
  sys.exit()

M = []
for i in range(2,n):
  Max = 0
  d = {}
  for k in range(m):
    for tup in total[-1].keys():
      s = total[-1][tup]
      if tup[-1] <= k:
        for j in range(1,i):
          s += score[(j+1,i+1)][k-tup[j-1]] 
        s += score[(1,i+1)][k]  
        ky = tup + (k,)
        d[ky] = s
        if s > Max:
          Max = s
  total.append(d)
  M.append(Max)

print(M[-1])
  

Measured memory_bytes: 93628
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define forE(i,x) for(int i=head[x];i!=-1;i=ne[i])
using namespace std;
typedef long long i64;
typedef unsigned long long u64;
typedef unsigned u32;
typedef pair<int,int> pin;
#define mk(a,b) make_pair(a,b)
#define lowbit(x) ((x)&(-(x)))
#define sqr(a) ((a)*(a))
#define clr(a) (memset((a),0,sizeof(a)))
#define ls ((x)<<1)
#define rs (((x)<<1)|1)
#define mid (((l)+(r))>>1)
#define pb push_back
#define w1 first
#define w2 second
inline void read(int &x){
	x=0;int f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	x*=f;
}
inline void judge(){
	freopen("in.txt","r",stdin);
	freopen("out.txt","w",stdout);
}
/*******************************head*******************************/
int main(){
//    judge();
	int A,B,C;read(A);read(B);read(C);
	if(!(A&1)){
		return puts("0"),0;
	}
	if(!(B&1)){
		return puts("0"),0;
	}
	if(!(C&1)){
		return puts("0"),0;
	}
	int a[4];
	a[1]=A;a[2]=B;a[3]=C;
	sort(a+1,a+1+3);
	printf("%lld\n",1ll*a[1]*a[2]);
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<climits>
#include<math.h>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<stdio.h>
#include <string>
#include <complex>
#include <functional>
#include <map>
#include <queue>
#include <cctype>
using namespace std;
using ll = long long;
//typedef pair<string,string> P;
//double dat[100][100];
//int dp[6][1010];//動的計画法
//int prime[100001];
//char str[1010][1010];
//typedef pair<ll,ll> A;
//vector<A> pc;
//int ABS(int a){return max(a,-a);}
int main() {
  struct res{
    int b;
    string s;
    int p;
  };
  int n;
  cin>>n;
  vector<res> Q(n);
  for(int i=0;i<n;i++){
    string q;
    int l;
    cin>>q>>l;
    Q[i].b=i+1;
    Q[i].s=q;
    Q[i].p=l;
  }
  sort(Q.begin(),Q.end(),
    [](const res& x,const res& y){if(x.s==y.s){
      return x.p>y.p;
    }else{
      return x.s<y.s;
    }});
  for(int i=0;i<n;i++){
    cout<<Q[i].b<<endl;
  }
  return 0;
}

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

inline long long read(){
    long long s = 0, w = 1;
    char ch = getchar();
    while (ch < '0' || ch > '9'){
        if (ch == '-') w = -1;
        ch = getchar();
    }
    while (ch >= '0' && ch <= '9'){
        s = s * 10 + ch - '0';
        ch = getchar();
    }
    return s * w;
}
unsigned long long x, sum;
int cnt;
int main(){
    cin >> x;
    sum = 100;
    while(1){
        cnt++;
        sum += sum * 0.01;
        if (sum >= x){
            cout << cnt << endl;
            return 0;
        }
    }
    return 0;
}
//g++ B.cpp -o B.exe -lm -Wall

Measured memory_bytes: 3620
#include<iostream>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<queue>
#include<cstring>
#include<cmath>
#include<cstdio>
#include<cstdlib>
using namespace std;
#define REP(i,a,n) for(int i = a ; i < n ; i++)
#define rep(i,n) REP(i,0,n)

typedef long long ll;

int main(){
  int n,p,tp;
  int cnt[52];

  while(cin>>n>>p,n||p){
    tp = p;
    memset(cnt,0,sizeof(cnt));

    int now = 0;

    while(1){
      if(p > 0){
        cnt[now]++;
        p--;

        if(cnt[now] == tp){
          cout<<now<<endl;
          break;
        }
      }
      else{
        p += cnt[now];
        cnt[now] = 0;
      }

      now = (now + 1) % n;
    }
  }
}

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

int h,w,c;
int data[8][8];


int done[8][8];
int change(int x,int y,int color,int to){
    if(y >= h || x < 0 || y < 0 || x >= w) return 0;

    if(data[y][x] != color) return 0;
    else data[y][x] = to;

    if(done[y][x] == true) return 0;
    else done[y][x] = true;

    int dx[] = {-1,0,1,0};
    int dy[] = {0,1,0,-1};
    for(int i = 0 ; i < 4 ; i++) change(x+dx[i] , y+dy[i] , color , to);
    return 0;
}
int count(int x,int y,int color){
    if(y >= h || x < 0 || y < 0 || x >= w) return 0;
    if(data[y][x] != color) return 0;
    if(done[y][x] == true) return 0;
    else done[y][x] = true;
    int ans = 0;
    int dx[] = {-1,0,1,0};
    int dy[] = {0,1,0,-1};
    for(int i = 0 ; i < 4 ; i++)
        ans += count(x+dx[i] , y+dy[i] , color);
    return ans+1;
}
int ans = 0;
int dfs(int n){
    if(n == 5){
        for(int x = 0 ; x < 8 ; x++)
            for(int y = 0 ; y < 8 ; y++)
                done[x][y] = 0;
        ans = max(ans,count(0,0,c));
        return 0;
    }
    int tmp[8][8];

    for(int i = 0 ; i < 6 ; i++){
        for(int x = 0 ; x < 8 ; x++)
            for(int y = 0 ; y < 8 ; y++)
                tmp[x][y] = data[x][y] ,done[x][y] = 0;
        change(0,0,data[0][0],i);
        dfs(n+1);

        for(int x = 0 ; x < 8 ; x++)
            for(int y = 0 ; y < 8 ; y++)
                data[x][y] = tmp[x][y], done[x][y] = 0;

    }
    return 0;

}
int main(){
    while(cin >> h >> w >> c , h){
        c--;
        for(int i = 0 ; i < h ; i++)
            for(int j = 0; j < w ; j++)
                cin >> data[i][j] , data[i][j]--;
        ans = 0;
        dfs(0);
        cout << ans << endl;
    }
}



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

#define pb push_back
#define fst first
#define snd second
#define ALL(s) s.begin(),s.end()
#define fill(a,c) memset(&a, c, sizeof(a))
#define fore(i,x,y) for(ll i=x;i<y;i++)
#define SZ(x) ((int)(x).size())
#define PI acos(-1)
#define FIN ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)

typedef long long ll;
using namespace std;

const int mod = 1e9+7;

int main() {FIN;
    int a,b; cin>>a>>b;
    string mat[a];
    fore(i,0,a) cin>>mat[i];
    int dp[a][b]; memset(dp,0,sizeof(dp));
    fore(i,0,a){
        fore(j,0,b){
            if(i==0&&j==0){dp[i][j] = 1; continue;}
            if(mat[i][j] == '#') continue;
            if(i-1>=0) dp[i][j] = (dp[i][j]+dp[i-1][j])%mod;
            if(j-1>=0) dp[i][j] = (dp[i][j]+dp[i][j-1])%mod;
        }
    }
    cout<<dp[a-1][b-1]<<"\n";
    return 0;
}




Measured memory_bytes: 8620
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<ctype.h>
#include<math.h>
#include<bits/stdc++.h>
#include<vector>
#include<queue>

#define             ll                      long long
#define             si(a)                   scanf("%d",&a)
#define             sii(a,b)                scanf("%d%d",&a,&b)
#define             siii(a,b,c)             scanf("%d%d%d",&a,&b,&c)
#define             pii                     pair<int,int>
#define             pb(a)                   push_back(a)
#define             fr(i,n)                 for(int i=0;i<n;i++)
#define             bl                      printf("\n")
#define             pi                      acos(0.0)
#define             inf                     1000000
#define             sz                      100
#define             MOD                     1000000007
#define             base                    2147483647


using namespace std;


int main(){

    int n,a,b;
    si(n);
    if(n==1){
            printf("Hello World\n");
    }else{
        sii(a,b);
        printf("%d\n",a+b);
    }




    return 0;
}


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

long long n, tmp;
bool test;

int main() {

	cin >> n;
	map<long long, bool> mp;
	test = false;
	for(int i=0; i<n; i++) {
		cin >> tmp;
		auto itr = mp.find(tmp);
		if(itr == mp.end()) {
			mp[tmp] = true;
		} else {
			test = true;
			break;
		}
	}

	if(test) {
		cout << "NO\n";
	} else {
		cout << "YES\n";
	}

	return 0;
}

Measured memory_bytes: 12800
#include <stdio.h>
int main (int argc, char * argv[])
{
    int n[7];//サイコロ
    char a[1000];// 邦楽
    int b;
    for(int i=0;i<6;i++){
        scanf("%d",&n[i]);
    }
    scanf("%s",a);
    for(int i=0;a[i]!='\0';i++){
        if(a[i]=='E'){
            b = n[0];
            n[0] = n[3];
            n[3] = n[5];
            n[5] = n[2];
            n[2] = b;
//            printf("%d",n[i]);
        }
        if(a[i]=='S'){
            b = n[0];
            n[0] = n[4];
            n[4] = n[5];
            n[5] = n[1];
            n[1] = b;
//            printf("%d",n[i]);

        }
        if(a[i]=='W'){
            b = n[0];
            n[0] = n[2];
            n[2] = n[5];
            n[5] = n[3];
            n[3] = b;
//            printf("%d",n[i]);

        }
        if(a[i]=='N'){
            b = n[0];
            n[0] = n[1];
            n[1] = n[5];
            n[5] = n[4];
            n[4] = b;
//            printf("%d",n[i]);

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



Measured memory_bytes: 2096
#include <bits/stdc++.h>
#define lli long long int
using namespace std;
#define mod 1000000007
#define MOD 1000000037
#define mod1 998244353
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); 
#define INF 2e9

int main()
{
    int h1,m1,h2,m2,k;
    cin >> h1 >> m1 >> h2 >> m2 >> k;
    int t=(h2-h1)*60+m2-m1;
    cout << t-k << endl;
}

Measured memory_bytes: 3556
#include<math.h>
#include<iostream>
#define REP(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
#define INF (1<<30)

using namespace std;


int main(){
	int a,b,i,j,k,n;
	
	while(cin>>a>>b){
		k=0,n=a+b;
		while(n>0,++k,n/=10);
		cout<<k<<endl;
	}
	return 0;
}

Measured memory_bytes: 1156
#include<bits/stdc++.h>
using namespace std;
#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-1; i>=0; i--)
#define repr1(i, n) for(int i=n; i>=1; i--)
#define all(v) v.begin(),v.end()
using ll = long long;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = 1e9+7;
const double EPS = 1e-10;
const double PI = acos(-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; }

int main() {
    int n; ll l; cin >> n >> l;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];

    vector<ll> tonari(n-1);
    rep(i, n-1) tonari[i] = a[i] + a[i+1];

    ll maxL = -1;
    int pos = -1;
    rep(i, n-1) {
        if (chmax(maxL, tonari[i])) pos = i;
    }

    if (maxL < l) {
        cout << "Impossible" << endl;
    } else {
        cout << "Possible" << endl;
        rep(i, n-1) {
            if (i > pos) break;
            if (i != pos) cout << i + 1 << endl;
        }
        repr(i, n-1) {
            if (i < pos) break;
            if (i != pos) cout << i + 1 << endl;
        }
        cout << pos + 1 << endl;
    }

}


Measured memory_bytes: 2432
/*ヽ｀、ヽ｀｀、ヽ｀ヽ｀、、ヽ ｀ヽ 、ヽ｀｀ヽヽ｀ヽ、ヽ｀
ヽ｀、ヽ｀｀、ヽ 、｀｀、 ｀、ヽ｀ 、｀ ヽ｀ヽ、ヽ ｀、ヽ｀｀、
ヽ、｀｀、｀、ヽ｀｀、 、ヽヽ｀、｀、、ヽヽ、｀｀、 、 ヽ｀、
ヽ｀｀、 ヽ｀ヽ｀、、ヽ ｀ヽ 、 ヽ｀｀｀｀ヽヽヽ｀、、ヽ｀、、ヽ*/
#include <bits/stdc++.h> 
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
 
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
 
 
using namespace std;
using namespace __gnu_pbds;
 
typedef long long   ll;
typedef long double ld;
typedef complex< ld > cd;
 
typedef pair<int, int> pi;
typedef pair<ll, ll>   pl;
typedef pair<ld, ld>   pd;
 
typedef vector< int > vi;
typedef vector< ld >  vd;
typedef vector< ll >  vl;
typedef vector< pi >  vpi;
typedef vector< pl >  vpl;
typedef vector< cd >  vcd;
 
#define l00p(i, a, b) for (int i=a; i<(b); i++)
#define loop(i, a)    for (int i=0; i<(a); i++)
#define rep1(i, a, b) for (int i = (b)-1; i >= a; i--)
#define rep(i, a)     for (int i = (a)-1; i >= 0; i--)
#define trav(a, x)    for (auto& a : x)
#define uid(a, b)     uniform_int_distribution<int>(a, b)(rng)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f  first
#define s  second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert
//#define MOD 998244353
 
template<class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const ld pii=3.14159265359; 
const int MOD = 1000000007;
const char nl = '\n';
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy
unordered_map<int,int> ma,mb;
unordered_map<int,int> fac(ll n)
{
	unordered_map<int,int> f;
	while(n%2==0)
	{
		n/=2;
		f[2]++;
	}
	for(int i=3;i<=sqrt(n);i+=2)
	{
		while(n%i==0)
		{
			n/=i;
			f[i]++;
		}
	}
	if(n>1)
	f[n]++;
	return f;
}
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0); 
	ll a,b;
	cin>>a>>b;
	ma=fac(a);
	mb=fac(b);
	ll ans=0;
	trav(i,ma)
	{
		if(i.s!=0 && mb[i.f]!=0)
		{
			ans++;
			//cout<<i.s<<nl;
		}
	}
	cout<<ans+1;
	return 0;
}
// read the question correctly (ll vs int)
// template by bqi343

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

typedef long long ll;
const ll INF = (ll)1 << 60;

int main() {
  int n;
  ll a, b;
  cin >> n >> a >> b;
  ll x[n];
  for (int i = 0; i < n; i++) {
    cin >> x[i];
  }
  vector<ll> dp(n, INF);
  dp[0] = 0;
  for (int i = 1; i < n; i++) {
    dp[i] = min(dp[i - 1] + (x[i] - x[i - 1]) * a, dp[i - 1] + b);
  }
  cout << dp[n - 1] << endl;
}


Measured memory_bytes: 1792
n = int(input())
arr = []
base_left = set()
for i in range(n):
    a = int(input())
    arr.append(a)
    if i%2 == 0:
        base_left.add(a)

arr.sort()

left = set()
for i in range(n):
    if i %2 == 0:
        left.add(arr[i])

print(len(base_left-(base_left&left)))

Measured memory_bytes: 60888
#include<bits/stdc++.h>
#define vi vector<int>
#define vvi vector<vector<int> >
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
using ll = long long;
using ld =long double;
//#define int ll
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define all(in) in.begin(), in.end()
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
#define MAX 9999999
using namespace std;
typedef pair<int, int> pii;
typedef pair<int,pii> piii;
#define mp make_pair
signed main(){
    double a,b;cin>>a>>b;
    printf("%.10f",(a*b)/(a+b));
    cout<<endl;
}


Measured memory_bytes: 256
n = gets.chomp.to_i
a = gets.chomp.split(' ').map{|i| i.to_i }
bsum = 0
gets.chomp.split(' ').map{|i| bsum += i.to_i }
c = gets.chomp.split(' ').map{|i| i.to_i }
csum = 0
(n - 1).times{|i|
  if a[i] + 1 == a[i + 1]
    csum += c[a[i] - 1]
  end
}

puts bsum + csum


Measured memory_bytes: 3836
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(300000)


def solve(N: int, M: int, a: "List[int]", b: "List[int]"):
    ret = [0] * N
    for i in range(M):
        ret[a[i] - 1] += 1
        ret[b[i] - 1] += 1
    for r in ret:
        print(r)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    a = [int()] * (M)  # type: "List[int]" 
    b = [int()] * (M)  # type: "List[int]" 
    for i in range(M):
        a[i] = int(next(tokens))
        b[i] = int(next(tokens))
    solve(N, M, a, b)

if __name__ == '__main__':
    main()


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

int main() {
	int panjang;
	char teks[5];
	scanf("%s", teks);
	panjang = strlen(teks);
	if (panjang < 3)
		printf("%s\n", teks);
	else {
		for (int i = 2; i >= 0; i--)
			printf("%c", teks[i]);
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 128
#pragma region Include/Defines
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <limits.h>
#include <vector>
#include <stdlib.h>
#include <algorithm>
#include <memory.h>
#include <string.h>
#include <math.h>
#include <string>
#include <algorithm>
#include <functional>
#include <cassert>
#include <map>
#include <set>
#include <iostream>
#include <queue>
#include <time.h>

using namespace std;
typedef long long lli;
typedef vector<int> vi;
typedef vector<lli> vli;
typedef pair<int, int> pii;
typedef pair<lli, lli> pll;
typedef vector<pii> vpii;
typedef vector <pll> vpll;
typedef long double ld;
#define all(a) std::begin(a), std::end(a)

const int INF = 0x3f3f3f3f;
const lli LINF = 0x3f3f3f3f3f3f3f3f;

template<typename T, typename T2> inline void _max(T &a, T2 b) { a = max((T)a, (T)b); }
template<typename T, typename T2> inline void _min(T &a, T2 b) { a = min((T)a, (T)b); }

#ifdef _DEBUG
#define epr(...) fprintf(stderr,__VA_ARGS__)
#else
#define epr(...) 
#endif
#pragma endregion

const int MAX = 110;
int n, a[MAX];

void clear() {
}

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

void solve() {
	int res = 0;
	int pr = -1;
	int tc = 0;
	for (int i = 0; i < n; i++) {
		if (pr == a[i]) tc++;
		else {
			res += tc / 2;
			tc = 1;
		}
		pr = a[i];
	}
	res += tc / 2;
	printf("%d\n", res);
}

int main() {
#ifdef _LOCAL_VAN
	freopen("in.txt", "r", stdin);
#endif
	while (scanf("%d", &n) == 1) {
		clear();
		read();
		solve();
#ifndef _LOCAL_VAN
		return 0;
#endif
	}
	return 0;
}

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

int main() {
  int n, k;
  cin >> n >> k;
  vector<int> a(n + 1);
  for (int i = 1; i <= n; i++) {
    cin >> a.at(i);
  }

  bool ans;
  for (int i = k; i < n; i++) {
    if (a.at(i - k + 1) < a.at(i + 1)) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 3984
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;

public class Main {
	

    static String[] map =new String[1005];
    static int [] dx={1,0,-1,0};
    static int [] dy={0,1,0,-1};

	public static void main(String args[])throws IOException  {

		Scanner in = new Scanner(System.in);
		
		int n=in.nextInt();
		int m=in.nextInt();
		long [] a=new long[n];
		
		long ans=0;
		long maxx=1000000000;
		for(int i=0;i<n;i++)
		{
			a[i]=in.nextLong();
			
		}
		Arrays.sort(a);
		for(int i=0;i<=n-m;i++)
		{
			long t=a[i+m-1]-a[i];
			maxx=Math.min(t,maxx);
		}
		
		System.out.println(maxx);
//		while(in.hasNext())
//		{
//			
//			
//		}
//
//			
//		}
//		
	}
	
}


Measured memory_bytes: 51728
# coding: utf-8
# Your code here!
a= input()
a = list(map(int, input().split()))

c=0


for i in range(0,len(a)):
    flag=True
    for j in range(0,i):
        #rint(a[j],a[i])
        if a[j]>a[i]:
            flag=False
    if flag:
        c+=1
print(c)
    

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

ans=0
Dic={}
for i in range(1,n+1):
    s=str(i)
    d=(s[0],s[-1])
    if d in Dic.keys():
        Dic[d]+=1
    else:
        Dic[d]=1

for a in Dic.keys():
    b=(a[1],a[0])
    if b in Dic.keys():
        ans+=Dic[a]*Dic[b]
print(ans)
    

Measured memory_bytes: 3060
import java.io.*;
import java.math.BigInteger;
import java.util.*;

public class Main {
	
	public static void main(String[] args) throws IOException {
		
		BufferedReader br = 
			new BufferedReader(new InputStreamReader(System.in));
		
		ArrayList<Integer> ans = new ArrayList<Integer>();
		
		while (true) {
			
			String s = br.readLine();
			if (s == null) break;
			
			double speed = Double.parseDouble(s);
			ans.add((int)(Math.pow(speed / 9.8,2) * 4.9 + 5) / 5 + 1);
			
		}
		
		for (int a : ans) {
			System.out.println(a);
		}
	}
	
}

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

typedef long long ll;

void up(int a){
    for(int i=0;i<a;i++){
        printf("U");
    }
}
void down(int a){
    for(int i=0;i<a;i++){
        printf("D");
    }
}
void right(int a){
    for(int i=0;i<a;i++){
        printf("R");
    }
}
void left(int a){
    for(int i=0;i<a;i++){
        printf("L");
    }
}

int main(){
    int sx,sy,tx,ty;
    cin >> sx >> sy >> tx >> ty;
    int absx,absy;
    absx = abs(tx-sx);
    absy = abs(ty-sy);

    //1st root
    up(absy);
    right(absx);
    //2nd root
    down(absy);
    left(absx);
    //3rd root
    left(1);
    up(absy+1);
    right(absx+1);
    down(1);
    //4th root
    right(1);
    down(absy+1);
    left(absx+1);
    up(1);

    return 0;
}


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

string str;

int solve() {
    vector<int> v(str.size());
    vector<int> d(str.size());
    for (int i = 0; i < str.size(); i++) {
        int c = str[i] - '0';
        if (i % 2 == 0) {
            v[i] = c + (i ? v[i-1] : 0);
            d[i] = (i ? d[i-1] : 0);
        } else {
            d[i] = c + (i ? d[i-1] : 0);
            v[i] = (i ? v[i-1] : 0);
        }
    }

    vector<int> sum(str.size());
    for (int i = 0; i < str.size(); i++) {
        sum[i] = (11 + (((v[i] - d[i]) % 11))) % 11;
    }

    map<int,int> m;
    m[0] = 1;
    int ans = 0;
    vector<int> dp(str.size());
    for (int i = 0; i < str.size(); i++) {
        ans += m[sum[i]];
        if (i + 1 < str.size() && (str[i+1] - '0') != 0) {
            m[sum[i]]++;
        }
    }

    return ans;
}

int main() {
    while (cin >> str, str != "0") cout << solve() << endl;

    return 0;
}

Measured memory_bytes: 4372
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
typedef vector<double> VD;
typedef vector<VD> VVD;

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

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

map<ll, ll> zip;
VL unzip;
void compress_coordinate(VL x){
    ll n = x.size();
    REP(i,n) unzip.push_back(x[i]);
    sort(ALL(unzip));
    unzip.erase(unique(ALL(unzip)), unzip.end());
    REP(i,unzip.size()) zip[unzip[i]] = i;
}

const ll INF = 1e18;

struct BIT{
    int n;
    VL bit;

    BIT(){}
    BIT(int x){
        n = x;
        bit.assign(n+1, 0);
    }

    void init(int x){
        n = x;
        bit.assign(n+1, 0);
    }

    void add(int i, ll x){
        i++;
        while (i <= n){
            bit[i] += x;
            i += i & -i;
        }
    }

    // [0, i]
    ll sum(int i){
        i++;
        ll ret = 0;
        while (i > 0){
            ret += bit[i];
            i -= i & -i;
        }
        return ret;
    }

    // [l, r)
    ll sum(int l, int r){
        if (l >= r) return 0;
        return sum(r-1) - sum(l-1);
    }
};

int main() {
    int n;
    cin >> n;
    VL a(n, INF), b(n, INF);
    VL x;
    REP(i,n){
        int k = in();
        if (k == 1){
            a[i] = in();
            b[i] = in();
            x.push_back(a[i]);
        }
    }

    compress_coordinate(x);
    int m = zip.size();

    BIT bit(m), bits(m);
    ll cnt = 0, base = 0;
    REP(i,n){
        if (a[i] == INF){
            ll c = (cnt + 1) / 2;
            ll le = -1, ri = m - 1;
            while (ri - le > 1){
                ll x = (ri + le) / 2;
                if (bit.sum(x) >= c) ri = x;
                else le = x;
            }
            ll x = unzip[ri];
            ll s = bits.sum(ri, m) - bit.sum(ri, m) * x + bit.sum(ri - 1) * x - bits.sum(ri - 1) + base;
            printf("%lld %lld\n", x, s);
        }else{
            int x = zip[a[i]];
            bit.add(x, 1);
            bits.add(x, a[i]);
            cnt++;
            base += b[i];
        }
    }


    return 0;
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
#define REP(i, n) for(int i=0; i<n; i++)
#define REPi(i, a, b) for(int i=int(a); i<int(b); i++)
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; }
const ll MOD = 1e9+7;

ll A[500];
ll memo[500][500];
ll sum[500];

//[left, right)
ll func(ll left, ll right){
    if(memo[left][right] >= 0){
        return memo[left][right];
    }

    if(left == right-1){
        //return memo[left][right] = A[left];
        return memo[left][right] = 0;
    }

    ll ret = LLONG_MAX;
    for(int s = left+1; s < right; s++){
        ll tmp;
        tmp = func(left, s) + func(s, right);
        chmin(ret, tmp);
    }
    ret += sum[right-1];
    if(left > 0) ret -= sum[left-1];
    return memo[left][right] = ret;
}

int main(){
    int N;
    cin >> N;
    REP(i,N){
        ll a;
        cin >> a;
        A[i] = a;
        sum[i] = a;
        if(i > 0)
            sum[i] += sum[i-1];
    }

    REP(i,500){
        REP(j,500){
            memo[i][j] = -1;
        }
    }
    ll ans = func(0, N);

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


Measured memory_bytes: 2176