akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <string.h>

int main(void) {

  char s[101];
  scanf("%s", s);
  long k;
  scanf("%ld", &k);
  int length = strlen(s);
  int change_a = 0;
  int last_a = 0;
  for (int i = 1; i < length; i++) {
    if (s[i] == s[i-1]) {
      if (i == length-1) {
        last_a = 1;
      }
      change_a++;
      i++;
    }
  }
  int change_b = 1;
  int last_b = 0;
  if (length == 1) {
    last_b = 1;
  }
  for (int i = 2; i < length; i++) {
    if (s[i] == s[i-1]) {
      if (i == length-1) {
        last_b = 1;
      }
      change_b++;
      i++;
    }
  }
  long answer;
  if (s[0] != s[length-1] || last_a == 1) {
    answer = change_a*k;
  } else {
    if (last_b == 0) {
      answer = change_a+change_b*(k-1);
    } else {
      if (k%2 == 0) {
        answer = (change_a+change_b)*(k/2);
      } else {
        answer = (change_a+change_b)*(k/2)+change_a;
      }
    }
  }
  printf("%ld\n", answer);

  return 0;
}

Measured memory_bytes: 128
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_set>
#include <vector>

using namespace std;

#define ll long long
#define P pair<int, int>
#define FOR(i, N) for (int i = 0; i < (int)N; i++)
#define FORIN(i, a, b) for (int i = a; i < (int)b; i++)
#define ALL(x) (x).begin(), (x).end()
#define GI(name) \
  int(name);     \
  scanf("%d", &(name))
#define GI2(name1, name2) \
  int(name1), (name2);    \
  scanf("%d %d", &(name1), &(name2))
#define GI3(name1, name2, name3) \
  int(name1), (name2), (name3);  \
  scanf("%d %d %d", &(name1), &(name2), &(name3))
#define GVI(name, size)    \
  vector<int>(name)(size); \
  FOR(i, (size)) scanf("%d", &(name)[i])
#define GS(name) \
  string(name);  \
  cin >> (name);
#define MOD 1000000007
#define DEBUG(...) debug(__LINE__, ":" __VA_ARGS__)

string to_string(string s) {
  return s;
}

template <class T>
string to_string(vector<T> v) {
  string ret = "{";
  FOR(i, v.size() - 1) { ret += to_string(v[i]) + ","; }
  if (v.size() > 0) {
    ret += to_string(v.back());
  }
  ret += "}";
  return ret;
}

void debug() {
  cerr << endl;
}

template <class Head, class... Tail>
void debug(Head head, Tail... tail) {
  cerr << to_string(head) << " ";
  debug(tail...);
}

void print() {
  cout << endl;
}

template <class Head, class... Tail>
void print(Head head, Tail... tail) {
  cout << to_string(head);
  print(tail...);
}

int main() {
  GI3(p, q, r);
  print(p + q + r - max({p, q, r}));
  return 0;
}

Measured memory_bytes: 256
s = gets.chomp
ans = 'Good'
if s.include?('00') || s.include?('11') || s.include?('22') || s.include?('33') || s.include?('44') || s.include?('55') || s.include?('66') || s.include?('77') || s.include?('88') || s.include?('99')
  ans = 'Bad'
end
puts ans


Measured memory_bytes: 1788
#B
N, D = map(int, input().split())
P= [list(map(int, input().split())) for i in range(N)]

x=[]
y=[]
for i in P:
    x.append(i[0])
    y.append(i[1])

d=[]
for i, j in zip(x, y):
    dist =(i**2 + j**2)**(1/2)
    if dist <= D:
        d.append(dist)
        
print(len(d))  

Measured memory_bytes: 55224
from bisect import bisect_left as bl
INF = 10 ** 20

def main():
  
  w, h = map(int, input().split())
  n = int(input())
  
  xlst = []
  ylst = []
  appx = xlst.append
  appy = ylst.append

  for i in range(n):
    x, y = map(int,input().split())
    appx(x)
    appy(y)
  
  sorted_xlst = sorted(xlst)
  sorted_ylst = sorted(ylst)

  clx = sorted_xlst[n // 2 if n % 2 else n // 2 - 1]
  crx = sorted_xlst[n // 2]
  cly = sorted_ylst[n // 2 if n % 2 else n // 2 - 1]
  cry = sorted_ylst[n // 2]
 
  plx = bl(sorted_xlst, clx)
  prx = bl(sorted_xlst, crx)
  ply = bl(sorted_ylst, cly)
  pry = bl(sorted_ylst, cry)

  sumx = sum(xlst)
  sumy = sum(ylst)

  xllen = (sumx - sum(sorted_xlst[:plx]) * 2 - clx * (n - plx * 2)) * 2
  xrlen = (sumx - sum(sorted_xlst[:prx]) * 2 - crx * (n - prx * 2)) * 2
  yllen = (sumy - sum(sorted_ylst[:ply]) * 2 - cly * (n - ply * 2)) * 2
  yrlen = (sumy - sum(sorted_ylst[:pry]) * 2 - cry * (n - pry * 2)) * 2

  ans = ansx = ansy = INF
  max_sumd = 0
  
  for i in range(n):
    xi = xlst[i]
    yi = ylst[i]

    if xi <= clx:
      cx = crx
      xlen = xrlen
    else:
      cx = clx
      xlen = xllen
    if yi <= cly:
      cy = cry
      ylen = yrlen
    else:
      cy = cly
      ylen = yllen
  
    dx = xi - cx
    if dx < 0:
      dx = -dx
    dy = yi - cy
    if dy < 0:
      dy = -dy

    if max_sumd > dx + dy:
      continue
    else:
      max_sumd = dx + dy
    
    tlen = xlen + ylen - max_sumd

    if ans > tlen:
      ans = tlen
      ansx = cx
      ansy = cy
    elif ans == tlen:
      if ansx > cx:
        ansx = cx
        ansy = cy
      elif ansx == cx:
        if ansy > cy:
          ansy = cy 
  
  print(ans)
  print(ansx, ansy)

main()


Measured memory_bytes: 15516
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var arr = input.trim().split("\n");
var n=arr.shift()-0;
var a=arr.shift().split(" ").map(Number);
var q=arr.shift()-0;
var s="";
for(var i=0;i<q;i++){
   var [b,e]=arr[i].split(" ").map(Number);
   var x=a.slice(0,b);
   var y=a.slice(b,e).reverse();
   var z=a.slice(e);
   a = x.concat(y,z);
}
console.log(a.join(" "));


Measured memory_bytes: 19492
// clang-format off
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979;
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
bool odd(const int &n) { return n & 1; }
bool even(const int &n) { return ~n & 1; }
template<typename T> int len(const T &v) { return v.size(); }
template<typename T = int> T in() { T x; cin >> x; return x; }
template<typename T = int> T in(T &&x) { T z(forward<T>(x)); cin >> z; return z; }
template<typename T> istream &operator>>(istream &is, vector<T> &v) { for (T &x : v) is >> x; return is; }
template<typename A, typename B> istream &operator>>(istream &is, pair<A, B> &p) { return is >> p.first >> p.second; }
template<typename T> ostream &operator<<(ostream &os, const vector<vector<T>> &v) { int n = v.size(); rep(i, n) os << v[i] << (i == n - 1 ? "" : "\n"); return os; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &v) { int n = v.size(); rep(i, n) os << v[i] << (i == n - 1 ? "" : " "); return os; }
template<typename A, typename B> ostream &operator<<(ostream &os, const pair<A, B> &p) { return os << p.first << ' ' << p.second; }
template<typename Head, typename Value> auto vectors(const Head &head, const Value &v) { return vector<Value>(head, v); }
template<typename Head, typename... Tail> auto vectors(Head x, Tail... tail) { auto inner = vectors(tail...); return vector<decltype(inner)>(x, inner); }
// clang-format on

main() {
  int n, q;
  cin >> n >> q;
  vector<queue<int>> s(n);
  while (q--) {
    int c = in();
    if (c == 0) {
      int t, x;
      cin >> t >> x;
      s[t].emplace(x);
    }
    if (c == 1) {
      int t = in();
      if (s[t].empty()) continue;
      cout << s[t].front() << endl;
    }
    if (c == 2) {
      int t = in();
      if (s[t].empty()) continue;
      s[t].pop();
    }
  }
}



Measured memory_bytes: 5188
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vc = vector<char>;
using vs = vector<string>;
using vll = vector<long long>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using vvll = vector<vector<long long>>;
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 (b<a) {a=b; return 1;} return 0;}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int R, G, B, n;
    cin >> R >> G >> B >> n;

    ll ans = 0;
    for (int i = 0; R*i <= n; i++) {
        for (int j = 0; R*i + G*j <= n; j++) {
            int k = n - (R*i + G*j);
            if (k % B == 0) ans++;
        }
    } 
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main(void){
    int n;
    cin >> n;
    vector<int> a(n), b(n);
    for(int i=0;i<n;i++){
        cin >> a[i] >> b[i];
    }
    sort(a.begin(), a.end());
    sort(b.begin(), b.end());
    if(n%2 == 1){
        cout << b[n/2] - a[n/2] + 1 << endl;
    }else{
        cout << (b[n/2-1] + b[n/2]) - (a[n/2-1] + a[n/2]) + 1 << endl;
    }
}


Measured memory_bytes: 4468
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;


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

	int m, k, i, j, n;
	vector<int> a;

	cin >> m >> k;
	if ((k >= (1 << m)) || ((m == 1) && (k == 1))) cout << "-1\n";
	else {
		n = 1 << m;
		if (k == 0) {
			for (i = 0; i < n; i++) {
				a.push_back(i);
				a.push_back(i);
			}
		}
		else {
			for (i = 0; i < n; i++) {
				if (i != k) a.push_back(i);
			}
			a.push_back(k);
			for (i = n - 1; i >= 0; i--) {
				if (i != k) a.push_back(i);
			}
			a.push_back(k);
		}

		for (auto p : a) cout << p << " ";
		cout << "\n";
	}

	
	return 0;
}


Measured memory_bytes: 2932
listA=[]

for i in range(2):
    try:
        listA.append(list(map(int, input().split())))
        #listA<-[1,2,2,3,1]
        #print(listA)
        #ここに逐次処理を書けばいいと思う。
    except:
        break;
        #または、quit(),os.exit()をして止める。

list=listA[1]

mini=float('inf')
count=0

for i in list:
    if i <= mini:
        count+=1
        mini=i

print(count)


Measured memory_bytes: 24744
using System;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split(' ');
            int[] Number=new int[3];
            int A = int.Parse(s[0]);
            int B = int.Parse(s[1]);
            int C = int.Parse(s[2]);
            int five=0;
            int seven = 0;

            for (int i = 0; i < 3; i++)
            {
                Number[i] = int.Parse(s[i]);
                if (Number[i] == 5)
                {
                    five = five + 1;
                }
                else if (Number[i] == 7)
                {
                    seven = seven + 1;
                }

            }

            if (five==2&&seven==1)
            {
                Console.WriteLine("YES");
            }
            else
            {
                Console.WriteLine("NO");
            }
        }
    }
}

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

//1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12
int main() {
    int n, m;
    cin >> n >> m;
    int c = (n+1) / 2;
    vector<P> ans;
    int i = c / 2;
    int j = i + 1;
    while (i > 0) {
        ans.push_back(P(i, j));
        --i; ++j;
    }
    i = c + c / 2;
    rep(j, m/2) {
        ans.push_back(P(i-j-1, j+i+1));
    }
    rep(i, m) {
        cout << ans[i].first << " " << ans[i].second << endl;
    }
    return 0;
}

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

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

    int ans = 0;
    for (int i = 0; i < n; i++)
    {
        for (int j = i + 1; j < n; j++)
        {
            for (int k = j + 1; k < n; k++)
            {
                if (L[i] == L[j] || L[i] == L[k] || L[j] == L[k])
                    continue;
                ll len = L[i] + L[j] + L[k];
                ll mx = max(L[i], max(L[j], L[k]));
                ll rest = len - mx;
                if (mx < rest)
                {
                    ans++;
                }
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3616
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<queue>
#include<cmath>
using namespace std;
int main(){
    int N,c,a,n;
    scanf("%d",&N);
    for(int i=0;i<N;i++){
        int nowans=0;
        scanf("%d %d %d",&c,&a,&n);
        while(1){
            if(0<c&&0<a&&0<n)
                c--,a--,n--,nowans++;
            else
                break;
        }
        while(1){
            if(1<c&&0<a)
                c-=2,a--,nowans++;
            else
                break;
        }
        while(1){
            if(2<c)
                c-=3,nowans++;
            else
                break;
        }
        printf("%d\n",nowans);
    }
    return 0;
}

Measured memory_bytes: 1188
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <climits>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <string>
#include <list>
#include <ctime>
#include <complex>
#include <bitset>
#include <tuple>
using namespace std;

typedef long long int lli;

long double A, B;
lli ans;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> A >> B;
    ans = A * B;
    cout << ans;
    return 0;
}

Measured memory_bytes: 3740
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int s1s2s3, s1, s2, s3;
  cin >> s1s2s3;
  s1 = s1s2s3 / 100;
  s2 = (s1s2s3 % 100) / 10;
  s3 = (s1s2s3 % 100) % 10;
  cout << s1 + s2 + s3 << endl;
}

Measured memory_bytes: 256
#include <iomanip>
#include <iostream>
#include <vector>
#include <algorithm>
#define REP(i,n) for(int i = 0; i < (n); i++)

using namespace std;

int imos[40][220000];

int main()
{
  int N, C;
  cin >> N >> C;
  REP(i, N) {
    int s, t, c;
    cin >> s >> t >> c;
    c--;
    imos[c][2*s]++;
    imos[c][2*t]--;
  }
  REP(i, C) {
    REP(j, 220000) {
      if (imos[i][j] == 1) {
        imos[i][j] = 0;
        imos[i][j - 1] = 1;
      }
    }
  }
  REP(i, C) {
    REP(j, 220000) imos[i][j + 1] += imos[i][j];
  }

  int ans = -1;
  REP(i, 220000) {
    int sum = 0;
    REP(j, C) sum += imos[j][i];
    ans = max(ans, sum);
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 26880
#include <iostream>
using namespace std;
	typedef long long int lli;
	const int MaxN=100005;
	
int main(){
	lli N,i,j,p,q;
	string aux,w1="ABC",w2="ARC";
	cin>>aux;
	if(aux==w1)cout<<w2;
	else cout<<w1;
}

Measured memory_bytes: 3004
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
#define F first
#define S second
#define pb emplace_back
#define pi pair<int,int>
using namespace std;
const int maxn = 1e5 + 4;

int n, m;
int indeg[maxn];
bool vis[maxn];
vector<int> g[maxn];
vector<int> topo;
int dp[maxn];

int main(){
	cin>>n>>m;
	int u, v;
	for (int i = 0; i < m; ++i){
		cin>>u>>v;
		indeg[v]++;
		g[u].pb(v);
	}
	queue<int> q;
	for (int i = 1; i <= n; ++i){
		if (indeg[i] == 0)
			q.push(i);
	}
	while (!q.empty()){
		int val = q.front();
		q.pop();
		if (vis[val])
			continue;
		vis[val] = 1;
		topo.pb(val);
		for (auto i: g[val]){
			indeg[i]--;
			if (indeg[i] == 0){
				q.push(i);
			}
		}
	}
	int le = topo.size();
	for (int i = le-1; i >= 0; --i){
		for (auto c: g[topo[i]]){
			dp[topo[i]] = max(dp[topo[i]], dp[c]+1);
		}
	}
	int mx = 0;
	for (int i = 1; i <= n; ++i){
		mx = max(mx, dp[i]);
	}
	cout<<mx<<'\n';
}

Measured memory_bytes: 7160
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};
    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        n: usize,
        dd: [u64;n]
    }
    let mut dd = dd;
    dd.sort();
    let a = dd[n / 2 - 1];
    let b = dd[n / 2];
    println!("{}", b-a);
}


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

using namespace std;

int a, b, c;

int main()
{
	cin >> a >> b >> c;
	int ans = 0;
	while (a % 2 == 0 && b % 2 == 0 && c % 2 == 0)
	{
		int d = b + c >> 1;
		int e = a + c >> 1;
		int f = a + b >> 1;
		
		a = d;
		b = e;
		c = f;
		ans++;
		
		if (ans >= 10000000)
		{
			puts("-1");
			return 0;
		}
	}
	printf("%d\n", ans);
	return 0;
}

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

int main(){
  int N, M;
  cin >> N >> M;
  
  map<int, int> d;
  for(int i = 0;i < N;i++){
    int A, B;
    cin >> A >> B;
    d[A] += B;
  }
  
  long long int ans = 0;
  for(auto [A, B] : d){
    long long int b = min(M, B);
    ans += A * b;
    M -= b;
    if(!M){
      cout << ans << endl;
      return 0;
    }
  }
  
  return 0;
}

Measured memory_bytes: 8204
#include<iostream>
#include<cmath>
#define loi long int
using namespace std;

// Problem https://atcoder.jp/contests/abc046/tasks/abc046_b

int main(void){
    loi answer;
    answer = 1;
    int N,K;
    cin >> N >> K;
    answer = K * pow(K-1,N-1);
    cout << answer << endl;
    return 0;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define l long
#define pb push_back
int main() {
	// your code goes here
	ios_base::sync_with_stdio(false); 
    cin.tie(NULL); 
	int x,a;
	cin>>x>>a;
	if(x<a) cout<<0;
	else cout<<10;
	return 0;
}


Measured memory_bytes: 256
// Last Change: 07/07/2019 21:10:29.
#include <algorithm>
#include <array>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;
using ll = long long;

int main() {
  int N, D;
  cin >> N >> D;
  vector<vector<int>> X(N, vector<int>(D));
  for (auto &&e : X) {
    for (auto &&d : e) {
      cin >> d;
    }
  }

  int cnt = 0;
  for (int i = 0; i < N; ++i) {
    for (int j = i + 1; j < N; ++j) {
      int tmp = 0;
      for (int k = 0; k < D; ++k) {
        int val = X[i][k] - X[j][k];
        tmp += val * val;
      }
      for (int k = 0; k < 404; ++k) {
        if (k * k == tmp) {
          ++cnt;
        }
      }
    }
  }
  cout << cnt << endl;
}


Measured memory_bytes: 888
package main

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

var sc = bufio.NewScanner(os.Stdin)

func init() {
        // TODO: メモリの使用量がやばいので Token ごとに読む
        // Reference: https://atcoder.jp/contests/abc148/submissions/9067537
        bufsize := 100 * 1024 * 1024
        sc.Buffer(make([]byte, bufio.MaxScanTokenSize), bufsize)
}
func readInt() int              { return readIntArray()[0] }
func readInt2() (int, int)      { a := readIntArray(); return a[0], a[1] }
func readInt3() (int, int, int) { a := readIntArray(); return a[0], a[1], a[2] }
func readIntArray() []int {
        a := make([]int, 0, 1000)
        sc.Scan()
        for _, v := range strings.Split(sc.Text(), " ") {
                vv, _ := strconv.Atoi(v)
                a = append(a, vv)
        }
        return a
}
func readString() string            { return readStringArray()[0] }
func readString2() (string, string) { a := readStringArray(); return a[0], a[1] }
func readStringArray() []string     { sc.Scan(); return strings.Split(sc.Text(), " ") }

func main() {
        s, t := readString2()
        fmt.Printf("%s%s\n", t, s)
}

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

int a,b;

inline void read(int &x)
{
	x=0;char ch=getchar();bool f=false;
	while (ch<'0'||ch>'9'){if (ch=='-') f=true;ch=getchar();}
	while (ch>='0'&&ch<='9') x=(x<<3)+(x<<1)+ch-'0',ch=getchar();
	if (f) x=-x;return ;
}

int main()
{
	read(a);read(b);
	if (a*b%2) puts("Yes");
	else puts("No");
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define sz(v) (int)(v).size()
#define all(v) (v).begin(),(v).end()
#define fastio() ios::sync_with_stdio(0),cin.tie(0);
using namespace std;
typedef long long ll;
const int mod = 1e9 + 7;
const int inf = 0x3c3c3c3c;
const ll infl = 0x3c3c3c3c3c3c3c3c;

int K;
ll A[100003];
void NO(){
    cout << -1 << endl;
    exit(0);
}
int main(){
    fastio();
    cin >> K;
    for(int i = 0; i < K; i++) cin >> A[i];
    if(A[K - 1] != 2) NO();
    ll lo = 2, hi = 3;
    for(int i = K - 2; i >= 0; i--){
        lo = lo / A[i] * A[i] + (lo % A[i] ? A[i] : 0);
        if(hi < lo) NO();
        hi = hi / A[i] * A[i];
        if(hi < lo) NO();
        hi += A[i] - 1;
    }
    if(!lo) lo++;
    if(hi < lo) NO();
    cout << lo << ' ' << hi << endl;
}


Measured memory_bytes: 1024
#include<stdio.h>
int main()
{
    int i,j,H,W;
    while(1){
        scanf("%d %d",&H,&W);
        if(H==0&&W==0){break;}
        for(i=1;i<=H;i++){
            for(j=1;j<=W;j++){
                if(i==1||i==H||j==1||j==W){
                    printf("#");}
                    else{printf(".");}
                    }
                    printf("\n");
            }
            printf("\n");
        }
        return 0;
    }


Measured memory_bytes: 2052
#include <stdio.h>
int main(void){
    int r , c ;
    int arr[100][100] ;
    int i , j ;
    int SUM = 0;
    
    scanf("%d %d" , &r , &c);
    
    for(i = 0 ; i < r ; i++){
        for(j = 0 ; j < c ; j++){
            scanf("%d" , &arr[i][j]);
        }
    }
    
    for(i = 0 ; i < r ; i++){
        int sum_c = 0;
        for(j = 0 ; j < c ; j++){
            sum_c += arr[i][j];
            printf("%d " , arr[i][j]);
        }
        printf("%d\n" , sum_c);
    }
    
    for(i = 0 ; i < c ; i++){
        int sum_r = 0;
        for(j = 0 ; j < r ; j++){
            sum_r += arr[j][i];
            if(j == r - 1){
                printf("%d " , sum_r);
                SUM += sum_r;
            }
        }
    }
    
    printf("%d" , SUM);
    printf("\n");
    return 0;
}


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

// 総数を1000000007（素数）で割った余り
const long long mod = 1e9 + 7;

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

int main(){
    int n;
    cin >> n;
    vi a(n);
    rep1(i, n) {
        int ai;
        cin >> ai;
        --ai;
        a[ai] = i;
    }
    rep(i, n) cout << a[i] << (i!=n-1?' ':'\n');
    return 0;
}


Measured memory_bytes: 1152
from fractions import gcd

N,K = map(int, input().split())
A = list(map(int, input().split()))
A.sort()

def gcd_all():
    x = A[0]
    for i in range(1, N):
        x = gcd(x, A[i])
    return x

def solve():
    if K > A[-1]:
        return False
    return K % gcd_all() == 0

print('POSSIBLE' if solve() else 'IMPOSSIBLE')

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

int main(){
  vector<int> x(5);
  rep(i,5){cin >> x[i];}
  rep(i,5){if(x[i]==0) cout << (i+1) << endl;}
  
 
}

Measured memory_bytes: 3604
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
#include<stdio.h>
#include <cstdint>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const ll mod = 1e9 + 7;


int h, w;
string s[102];

int main() {

	cin >> h >> w;
	rep(i, h) {
		cin >> s[i];
	}
	rep(i, h) {
		rep(j, w) {
			int cnt = 0;
			int k = j;
			while (k >= 0) {
				if (s[i][k] == 'c') {
					cout << cnt;
					if (j != w - 1)cout << ' ';
					break;
				}
				if (k == 0) {
					cout << -1;
					if (j != w - 1)cout << ' ';
				}
				k--;
				cnt++;
			}
		}
		cout << endl;
	}

	return 0;
}


Measured memory_bytes: 3200
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		//		new Main().solveA();
		new Main().solveB();
		// new Main().solveC();
		// new Main().solveD();
	}

	private void solveA() {
		Scanner scanner = null;

		try {
			scanner = new Scanner(System.in);
			int[] line = new int[3];
			for (int i = 0; i < 3; i++) {
				line[i] = scanner.nextInt();
			}

			Arrays.sort(line);

			int result = line[2] * 10 + line[1] + line[0];

			System.out.println(result);

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private void solveB() {
		Scanner scanner = null;
		int numN = 0;
		int numM = 0;
		int numX = 0;
		int numY = 0;

		try {
			scanner = new Scanner(System.in);
			numN = scanner.nextInt();
			numM = scanner.nextInt();
			numX = scanner.nextInt();
			numY = scanner.nextInt();

			int[] targetX = new int[numN];
			for (int i = 0; i < numN; i++) {
				targetX[i] = scanner.nextInt();
			}

			Arrays.sort(targetX);

			int[] targetY = new int[numM];
			for (int i = 0; i < numM; i++) {
				targetY[i] = scanner.nextInt();
			}

			Arrays.sort(targetY);

			int numZ = targetX[numN - 1] + 1;

			if (numX < numZ && numZ <= numY && targetY[0] >= numZ) {
				System.out.println("No War");
			} else {
				System.out.println("War");
			}

			System.out.println("");

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private void solveC() {
		Scanner scanner = null;
		int lineAB = 0;
		int lineBC = 0;
		int lineCA = 0;

		try {
			scanner = new Scanner(System.in);
			lineAB = scanner.nextInt();

			System.out.println("");

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private void solveD() {
		Scanner scanner = null;
		int lineAB = 0;
		int lineBC = 0;
		int lineCA = 0;

		try {
			scanner = new Scanner(System.in);
			lineAB = scanner.nextInt();

			System.out.println("");

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}
}

Measured memory_bytes: 23636
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
//#include <math.h>
//#include <queue>
//#include <stack>
//#include <iomanip>

// sometimes used
#include <set>
//#include <map>
//#include <numeric>
//#include <list>
//#include <deque>
//#include <unordered_map>

typedef long long LL;
//typedef long double LD;
using namespace std;
 
//#define MOD 1000000007
//#define MAX 100100
//#define NIL -1
//#define INFTY 1000000000000000000

int main(){
    LL n;
    string s;
    LL q;
    cin >> n;
    cin >> s;
    cin >> q;
    set<LL> al[26];
    for(LL i=0; i<n; i++){
        al[s[i]-'a'].insert(i);
    }
    LL idx;
    for(LL i=0; i<q; i++){
        cin >> idx;
        if(idx==2){
            LL lq;
            LL rq;
            cin >> lq >> rq;
            LL ans=0;
            for(LL j=0; j<26; j++){
                auto itr=al[j].lower_bound(lq-1);
                if(itr!=al[j].end() && *itr<rq){
                    ans++;
                }
            }
            cout << ans << endl;
        }else{
            LL iq;
            char cq;
            cin >> iq >> cq;
            iq--;
            if(s[iq]!=cq){
                al[s[iq]-'a'].erase(iq);
                s[iq]=cq;
                al[s[iq]-'a'].insert(iq);
            }
        }
    }

    return 0;
}


Measured memory_bytes: 27220
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    int n, max;
    cin >> n;
    max = 1;
    string S[n];
    for(int i = 0; i < n; i++){
        cin >> S[i];
    }
 
    sort(S, S+n);
    int A[n];
    A[0] = 1;
 
    for(int i = 1 ; i < n; i++){
        if(S[i-1] == S[i]){
            A[i] = A[i - 1] + 1;
            if(max < A[i]){
                max = A[i];
            }
        }else if(S[i-1] != S[i]){
            A[i] = 1;
        }
    }
    for(int i = 0; i < n; i++){
        if(A[i] == max){
            cout << S[i] << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 15616
import java.util.*;
 
public class Main {
	
    public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
    	int N = sc.nextInt();
    	long Ls = 2;
    	long Lb = 1;
    	for (int i = 2; i <= N; i++) {
    		long tmp = Ls + Lb;
    		Ls = Lb;
    		Lb = tmp;
    	}
    	System.out.println(Lb);
    }
}

Measured memory_bytes: 23636
#include <bits/stdc++.h>
 using namespace std;
 #define rep(i,N) for(int i=0;i<int(N);++i)
 using ll = long long;
 //int nax = max_element(p.begin(),p.end())-p.begin();
 //int nin = max_element(p.begin(),p.end())-p.begin();

 int main(){
     int n,k;
     cin >> n >> k;
     vector<int> l(n);
     rep(i,n){
         cin >> l[i];
     }
     sort(l.begin(),l.end(),greater<int>());
     int sum = 0;
     rep(i,k){
         sum+=l[i];
     }
     cout << sum << endl;
     return 0;
 }

Measured memory_bytes: 256
#include <bits/stdc++.h>
// P - Independent Set

#define MOD 1000000007

using namespace std;

vector<int> adj[100005];
int dp[100005][2];

void dfs(int cur,int par) {
    int ans0,ans1;

    ans0 = 1;
    ans1 = 1;
    for (int nxt : adj[cur]) {
        if (nxt != par) {
            dfs(nxt,cur);
            ans0 = (1LL * ans0 * ((dp[nxt][0] + dp[nxt][1]) % MOD)) % MOD;
            ans1 = (1LL * ans1 * dp[nxt][0]) % MOD;
        }
    }

    dp[cur][0] = ans0;
    dp[cur][1] = ans1;
}

int main() {
    int N,i,x,y;

    scanf("%d",&N);

    for (i = 1;i < N;i++) {
        scanf("%d%d",&x,&y);
        adj[x].push_back(y);
        adj[y].push_back(x);
    }

    dfs(1,0);

    printf("%d\n",(dp[1][0] + dp[1][1]) % MOD);

    return 0;
}


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

int main(){
    int N, M; cin >> N >> M;
    vector<int> a(M), b(M);
    for (int i = 0; i < M; i++)
    {
        cin >> a.at(i) >> b.at(i);
    }
    vector<int> ans(N);
    for (int i = 1; i <= N; i++)
    {
        int count = 0;
        for (int j = 0; j < M; j++)
        {
            if(a.at(j) == i) count++;
            if(b.at(j) == i) count++;
        }
        ans.at(i - 1) = count;
    }
    for (int i = 0; i < N; i++)
    {
        cout << ans.at(i) << endl;
    }
    

    return 0;
}

Measured memory_bytes: 256
#coding:utf-8
N = int(input())
trees = [list(input().split()) for i in range(N)]

class BinaryTree:
    def __init__(self,key,p=None,l=None,r=None):
        self.key = key
        self.p = p
        self.l = l
        self.r = r

def Insert(root,z):
    y = None
    x = root
    while x != None:
        y = x
        if z.key < x.key:
            x = x.l
        else:
            x = x.r
    z.p = y

    if y == None:
        root = z
    elif z.key < y.key:
        y.l = z
    else:
        y.r = z
    return root

def preOrder(x):
    if x == None:
        return
    global preList
    preList.append(x.key)
    
    preOrder(x.l)
    preOrder(x.r)

def inOrder(x):
    if x == None:
        return
    inOrder(x.l)

    global inList
    inList.append(x.key)
    
    inOrder(x.r)

def Find(x,z):
    while x != None and z.key != x.key:
        y = x
        if z.key < x.key:
            x = x.l
        else:
            x = x.r
    return x


def Delete(x, z):
    if z.l == None or z.r == None:
        y = z
    else:
        y = getSuccessor(z)

    if y.l != None:
        x = y.l
    else:
        x = y.r

    if x != None:
        x.p = y.p

    if y.p == None:
        global root
        root = x
    elif y == y.p.l:
        y.p.l = x
    else:
        y.p.r = x
    if y != z:
        z.key = y.key
        
def getSuccessor(x):
    if x.r != None:
        return getMinimum(x.r)
    y = x.p
    while y != None and x == y.r:
        x = y
        y = y.p
    return y

def getMinimum(x):
    while x.l != None:
        x = x.l
    return x

root = None
for data in trees:
    if data[0] == "print":
        inList = []
        preList = []
        inOrder(root)
        a = " " + " ".join([str(num) for num in inList])
        print(a)

        preOrder(root)
        a = " " + " ".join([str(num) for num in preList])
        print(a)

    else:
        z = BinaryTree(int(data[1]))
        if data[0] == "insert":
            root = Insert(root,z)
        elif data[0] == "find":
            a = Find(root, z)
            if a == None:
                print("no")
            else:
                print("yes")
        elif data[0] == "delete":
            Delete(root, Find(root,z))


Measured memory_bytes: 237728
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<cstring>
#define LL long long
using namespace std;
const LL inf=1LL<<60;
LL n,a[200010],sum[200010],ans=inf;
LL k1,k2,p;
void solve()
{
	LL t1=max(max(sum[k1],sum[p]-sum[k1]),max(sum[k2]-sum[p],sum[n]-sum[k2]));
	LL t2=min(min(sum[k1],sum[p]-sum[k1]),min(sum[k2]-sum[p],sum[n]-sum[k2]));
	ans=min(ans,t1-t2);
}
int main()
{
	scanf("%lld",&n);
	for(LL i=1;i<=n;i++) scanf("%lld",&a[i]);
	for(LL i=1;i<=n;i++) sum[i]=sum[i-1]+a[i];
	k1=1;p=2;k2=3;solve();
	while(p<=n-2)
	{
		if(k2==p) k2++;
		while(k1<p-1&&abs(sum[p]-sum[k1]-sum[k1])>=abs(sum[p]-sum[k1+1]-sum[k1+1])) k1++;
		while(k2<n-1&&abs(sum[k2]-sum[p]-(sum[n]-sum[k2]))>=abs(sum[k2+1]-sum[p]-(sum[n]-sum[k2+1]))) k2++;
		solve();p++;
	}
	printf("%lld",ans);
}

Measured memory_bytes: 3328
n,m = map(int,raw_input().split())

data = []

for q in range(n):
  x,y,z = map(int,raw_input().split())
  data.append( [x,y,z] )

ans = -1

for xp in [-1,1]:
  for yp in [-1,1]:
    for zp in [-1,1]:
      buf = []
      for d in data:
        buf.append( d[0]*xp + d[1]*yp + d[2]*zp )
      buf.sort()
      buf = buf[::-1]
      bufans = 0
      for d in range(m):
        bufans += buf[d]
      if ans < bufans:
        ans = bufans
print ans


Measured memory_bytes: 2820
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <cmath>
#include <vector>

typedef long long ll;

using namespace std;

int main()
{
    ll n, d;

    cin >> n >> d;

    ll x[11][11];

    for (ll j=0; j<n; j++)
    {
        for (ll i=0; i<d; i++)
        {
            cin >> x[j][i]; 
       }
    }

    ll count (0);
    for (ll j=0; j<n; j++)
    {
        for (ll i=j+1; i<n; i++)
        {
            float dist (0); 
            for (ll l=0; l<d; l++)
            {
                dist += pow(x[j][l] - x[i][l], 2);
            }

        dist = sqrt(dist);
        if (dist == floor(dist))
            count++;

        }
    }

    cout << count << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
using namespace std;
const long long int INF = 1e18;
const long long int mod = 1e9+7;

typedef pair<ll, ll> pairs;
typedef vector<pairs> p;

struct Edge{
    ll to, weight;
    Edge(ll t, ll w) : to(t), weight(w){}
};
using graph = vector<vector<ll>>;
using Graph = vector<vector<Edge>>;


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

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

ll keta(ll N){
    ll M = 1;
    while( N > 0 ){
        if(N / 10 == 0){
            break;
        }
        N /= 10;
        M++;
    }
    return M;
}

// 回文
bool kai(string S){
    bool flag = true;
    for(ll i=0;i<S.size()/2;++i){
        if(S[i] != S[S.size()-i-1]){
            flag = false;
            break;
        }
    }
    return flag;
}


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

int main(){
    ll n;
    cin>>n;
    string s[n];
    for(ll i=0;i<n;++i){
        cin>>s[i];
    }
    sort(s, s+n);

    vector<ll> index;
    string t = s[0];
    ll flag = 1;
    for(ll i=1;i<n;++i){
        if(t == s[i]){
            flag++;
        }else{
            t = s[i];
            index.push_back(flag);
            flag = 1;
        }
    }
    index.push_back(flag);
    ll l = index.size();

    ll m  = 0;
    for(ll i=0;i<l;++i){
        m = max(m, index[i]);
    }

    ll k = 0;
    vector<string> ans;
    for(ll i=0;i<l;++i){
        if(index[i] == m){
            ans.push_back(s[k]);
        }
        k += index[i];
    }
    
    sort(ans.begin(), ans.end());
    for(ll i=0;i<ans.size();++i){
        cout<<ans[i]<<endl;
    }


    return 0;
}

Measured memory_bytes: 17524
#include <cstdio>
#include <algorithm>
#include <vector>
#include <set>

using namespace std;

int main() {
    int n, m, k, s, ans = 0;
    scanf("%d%d", &n, &m);
    vector< set<int> > d(m);
    vector<int> p(m);
    for (int i = 0; i < m; ++i) {
        scanf("%d", &k);
        for (int j = 0; j < k; ++j) scanf("%d", &s), d.at(i).insert(--s);
    }
    for (int i = 0; i < m; ++i) scanf("%d", &p.at(i));
    for (int i = 0; i < (1 << n); ++i) {
        bool f = true;
        for (int j = 0; j < m; ++j) {
            int cnt = 0;
            for (auto k = d.at(j).begin(); k != d.at(j).end(); ++k) if (i & (1 << *k)) ++cnt;
            if (cnt % 2 != p.at(j)) {
                f = false;
                break;
            }
        }
        if (f) ++ans;
    }
    printf("%d\n", ans);
    return 0;
}


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

using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

#define REP(i, l, n) for(int i=(l), i##_len=(n); i<i##_len; ++i)
#define ALL(x) (x).begin(),(x).end()
#define pb push_back

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

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

char alpha[26] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};

int dx[4] = {-1, 1, 0, 0};
int dy[4] = {0, 0, 1, -1};

int main(){
    int n, m; cin >> n >> m;
    string s; cin >> s;
    reverse(ALL(s));
    vector<int> ans;
    int now = 0;
    while(1){
        int next = 0;
        int f = 0;
        REP(i, 1, m+1){
            if(s[now + i] == '0'){
                if(now+i == n){
                    ans.pb(i);
                    f = 1;
                    break;
                }
                chmax(next, i);
            }
        }
        if(f){
            break;
        }
        if(next == 0){
            cout << -1 << endl;
            return 0;
        }else{
            ans.pb(next);
            now = now + next;
        }
    }
    REP(i, 0, ans.size()){
        cout << ans[ans.size()-i-1] << " ";
    }
    cout << endl;
}

Measured memory_bytes: 4032
n=int(input())
lis=[]
count=0
high=0
for _ in range(n):
  lis.append(input().split())
lis.append([5,6])  
for i in range(n+1):
  if lis[i][0]==lis[i][1]:
    count+=1
  else:
    if count>=high:
      high=count
    count=0
    
if high>=3:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 9048
#include <iostream>
using namespace std;
int main (void) {
    string s;

    cin >> s;

    string ans = "";
    for (int i = 0; i < s.length(); i++) {
        if (s[i] == '0') ans.push_back('0');
        else if (s[i] == '1') ans.push_back('1');
        else if (s[i] == 'B') {
            if (ans != "") ans.pop_back();
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

void quicksort(int number[],int first,int last);


int main()
{
    int n,l[10],sum = 0;

    scanf("%d",&n);

    for (int i = 0; i < n; i++)
    {
        scanf("%d",&l[i]);
    }
    
    quicksort(l,0,n - 1);

    for (int i = 0; i < n - 1; i++)
    {
        sum += l[i];
    }
    if (sum > l[n - 1])
    {
        printf("Yes");
    }
    else
    {
        printf("No");
    }
    
}

void quicksort(int number[],int first,int last)
{
   int i, j, pivot, temp;

   if(first < last){
      pivot = first;
      i = first;
      j = last;

      while(i < j){
         while((number[pivot] >= number[i]) && (i < last))
         {
            i++;
         }
         while(number[pivot] < number[j])
         {
            j--;
         }
         if(i < j){
            temp = number[i];
            number[i] = number[j];
            number[j] = temp;
         }
      }

      temp = number[pivot];
      number[pivot] = number[j];
      number[j] = temp;
      quicksort(number,first,j - 1);
      quicksort(number,j+1,last);

   }
}

Measured memory_bytes: 128
// 2-C ３つの整数を読み込み、それらを値が小さい順に並べて出力するプログラムを作成して下さい。 

import java.util.*;


class Main{
	////プログラムのエントリポイント
	public static void main(String[] args){
		//入力ストリームの生成
		Scanner sc = new Scanner(System.in);
		//数字３つ受け取り
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		//数字を入れ替えるための変数ｘ
		int x;
		
		//数字の入れ替え
		if(a > b){
			x = b;
			b = a;
			a = x;
		}
		if(b > c){
			x = c;
			c = b;
			b = x;
		}
		if(a > b){
			x = b;
			b = a;
			a = x;
		}
		//入れ替え後の結果表示
		System.out.println( a + " " + b + " " + c );
	}
}

Measured memory_bytes: 17160
#include <stdio.h>

int main(void) {

  long n,m,q;
  scanf("%ld %ld %ld", &n, &m, &q);
  long l[m],r[m];
  for (long i = 0; i < m; i++) {
    scanf("%ld %ld", &l[i], &r[i]);
  }
  long sp[q],sq[q];
  for (long i = 0; i < q; i++) {
    scanf("%ld %ld", &sp[i], &sq[i]);
  }
  long train[n+1][n+1];
  for (long i = 0; i <= n; i++) {
    for (long j = 0; j <= n; j++) {
      train[i][j] = 0;
    }
  }
  for (long i = 0; i < m; i++) {
    train[l[i]][r[i]]++;
  }
  long sum[n+1][n+1];
  for (long i = 1; i <= n; i++) {
    sum[i][i-1] = 0;
    for (long j = i; j <= n; j++) {
      sum[i][j] = sum[i][j-1]+train[i][j];
    }
  }
  long ans;
  for (long i = 0; i < q; i++) {
    ans = 0;
    for (int j = sp[i]; j <= sq[i]; j++) {
      ans += sum[j][sq[i]]-sum[j][j-1];
    }
    printf("%ld\n", ans);
  }

  return 0;
}

Measured memory_bytes: 9472
import sys
sys.setrecursionlimit(10**8)
N, M = map(int, input().split())
num_edges = M
edges = [list(map(int, input().split())) for i in range(num_edges)]
adj = [[] for i in range(N+1)]
for ed in edges:
    adj[ed[0]] += [[ed[1], ed[2]]]
    adj[ed[1]] += [[ed[0], ed[2]]]
col_list = [-1 for i in range(N+1)]

def recfun(v, col):
    col_list[v] = col #色を更新
    for ed in adj[v]: #隣接する頂点をみる
        if col_list[ed[0]] == -1: #更新していない場合
            recfun(ed[0], col) #同じ色でその先をみる
count = 0
for i in range(1, N+1):
    if col_list[i] == -1:
        count +=1
        recfun(i, count)
print(count)

Measured memory_bytes: 143464
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
template <typename X> ostream& operator << (ostream& x,const vector<X>& v){for(ll i=0;i<v.size();++i) x<<v[i]<<" ";return x;}
template <typename X> ostream& operator << (ostream& x,const set<X>& v){for(auto it:v) x<<it<<" ";return x;}
template <typename X, typename Y> ostream& operator << (ostream& x, const pair<X,Y>& v) {x<<v.ff<<" "<<v.ss;return x;}
template <typename T, typename S> ostream& operator << (ostream& os, const map<T, S>& v) { for (auto it : v) os << it.first << "=>" << it.second << endl; return os; }
struct pair_hash {inline std::size_t operator()(const std::pair<ll, ll> & v) const {return v.first*31+v.second;}};
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL)
#define pb push_back
#define fr first
#define sc second
#define prnt(m) for(auto it = m.begin() ; it != m.end() ; ++it){cout<<*it<<endl;}
#define tra(it,m) for(auto it=m.begin();it!=m.end();++it)
#define DBG(x) cout<<"# # #     "<<x<<'\n';
#define fri(i,s,n) for(long long i=s;i<n;i++)
#define mod 1000000007
#define mod2 998244353
#define vct2 vector<vector<ll>>
#define vct vector<ll>
#define pll pair<ll,ll>
#define rz(n) resize(n)
#define all(v) v.begin(),v.end()
#define mkp make_pair
#define arrin(a,n) for(ll i = 0; i < n ; i++){cin>>a[i];}
#define arrout(a,n) for(ll i = 0;i < n; i++){cout<<a[i]<<" ";}
#define ex(s) cout<<s<<endl,exit(0);
#define inf 2e18
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
bool f(ll n)
{
          for(ll i = 2 ; i*i <= n ; i++)
          {
                    if((n%i)==0)
                    {
                              return false;
                    }
          }
          return true;
}
int main()
{
          ll n;
          cin>>n;
          while(1)
          {
                    if(f(n)){
                              cout<<n<<endl;
                              return 0;
                    }
                    n++;
          }
}


Measured memory_bytes: 256
import std.stdio;
import std.ascii;
import std.c.stdio;
import std.range;
import std.array;
import std.functional;
import std.algorithm;
import std.conv;
import std.container;
import std.math;
import std.numeric;
import std.string;
import std.c.string;
import std.regex;
import std.typecons;

void main() {
    int x, y, s;
    bool input() {
        scanf("%d %d %d\n", &x, &y, &s);
        if (x == 0 && y == 0 && s == 0) return false;
        return true;
    }
    int X(int a) {
        return a * (100 + x) / 100;
    }
    int Y(int a) {
        return a * (100 + y) / 100;
    }
    void solve() {
        int Ans = 0;
        foreach (int a; 1 .. s) {
            foreach (int b; 1 .. s) {
                if (X(a) + X(b) == s) {
                    Ans = max(Ans, Y(a) + Y(b));
                }
            }
        }
        writeln(Ans);
    }
    while (input) solve;
}

Measured memory_bytes: 1048