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

int main(){
	
	int width, height, x, y, r;

	scanf("%d %d %d %d %d", &width, &height, &x, &y, &r);

	if((0 <= x - r) && (x + r <= width) && (0 <= y - r) && (y + r <= height)){
		printf("Yes\n");
	} else {
		printf("No\n");
	}
}

Measured memory_bytes: 1012
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <string>
#include <numeric>
#include <algorithm>
#include <tuple>

typedef long long ll;
using namespace std;
int main() {
    int k, n;
    string s;
    cin >> n >> k;
    cin >> s;
    for (auto i=0; i<n; ++i){
        if (i != k-1){
            cout << s[i];
        }else{
            cout << "abc"[s[i] - 'A'];
        }
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 888
#include<bits/stdc++.h>
using namespace std;
#define fastio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long
#define ull unsigned long long
#define vi vector<int>
/* #define pi pair<int, int> */
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define deb(x) cout << #x << ":" << x << endl;
/* freopen("input.txt", "r", stdin); */
/* freopen("output.txt", "w", stdout); */
const ll inf = 1e17 + 7, MOD = 1e7 + 9;


int main() {
	fastio();
	string s;
  	cin >> s;
  int i;
  	for(i =0;i<s.length();i++)
      if(s[i] == '7')
        break;
  if(i == s.length())
    cout << "No\n";
  else
    cout << "Yes\n";
      
	return 0;
}



Measured memory_bytes: 3640
S=gets.chomp
l=S.length

a = [0]*l

i = 0
while i != l
  j = S.index(?L,i)
  c = j-i
  a[j] += c/2
  a[j-1] += c/2+(c%2)
  i = S.index(?R,j) || l
  c = i-j
  a[j-1] += c/2
  a[j] += c/2+(c%2)
end

puts a*' '


Measured memory_bytes: 3196
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin >> n;
    vector<int> ans(n,0);
    for(int i=0; i<n-1; i++){
        int a;
        cin >> a;
        ans.at(a-1)++;  
    }
    for(int i=0; i<n; i++){
        cout << ans.at(i) << endl;
    }
}

Measured memory_bytes: 4048
using System;
using System.Linq;//リストの使用
using System.Collections.Generic;
using System.Text;//テキストの高速出力に必要
class Program
{
	static void Main()
	{
		string[] input = Console.ReadLine().Split(' ');
		int n = int.Parse(input[0]);
		long k = long.Parse(input[1]);
    int q = int.Parse(input[2]);
		int[] players = new int[q];
    long[] scores = new long[n];
    for(int i = 0; i < q; i++)
    {
      players[i] = int.Parse(Console.ReadLine());
      scores[players[i]-1]++;
    }
    for(int i = 0; i < n; i++)
    {
      if(k-(long)q+scores[i] > 0) Console.WriteLine("Yes");
      else Console.WriteLine("No");
    }
	}
}

Measured memory_bytes: 17552
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int h = sc.nextInt();
        int w = sc.nextInt();
        int n = sc.nextInt();
        List<Integer> a = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            a.add(sc.nextInt());
        }
        int[][] c = new int[h][w];
        int color = 1;
        int k = 0;
        int cnt = 0;
        for (int i = 0; i < h; i++) {
            for (int j = 0; j < w; j++) {
                if (a.get(k) <= cnt) {
                    cnt = 0;
                    color++;
                    k++;
                }
                c[i][j] = color;
                cnt++;
            }
        }

        for (int i = 0; i < h; i++) {
            for (int j = 0; j < w; j++) {
                if (i % 2 == 1) {
                    System.out.print(c[i][w - j - 1] + " ");
                } else {
                    System.out.print(c[i][j] + " ");
                }
            }
            System.out.println();
        }
    }
}


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

int main(){
  int n;
  cin >> n;
  char s;
  string ans="Three";
  for(int i=0;i<n;++i){
    cin >> s;
    if(s=='Y')ans="Four";
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main ()
{
    int a , b ,c ;
    cin >> a >> b >> c ;

    if (b==c)
    {
        cout << a << endl;
    }
    else if (a ==c)
    {
        cout<<b<< endl;
    }
    else
    {
        cout << c << endl;
    }
    return 0 ;
}


Measured memory_bytes: 256
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define pll pair<ll,ll>
#define pii pair<int,int>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define endl '\n'
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))

using namespace std;

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


const ll INF=1e9+7;

int main(){
    ll R,C,K;
    cin >> R >> C >> K;
    vector<vector<ll>> s(R,vector<ll>(C));
    rep(i,K){
        ll r,c,v;
        cin >> r >> c >> v;
        r--; c--;
        s[r][c]+=v;
    }
    vector<vector<vector<ll>>> dp(R+1,vector<vector<ll>>(C+1,vector<ll>(3)));
    rep(i,R){
        rep(j,C){
            rep(k,3){
                chmax(dp[i+1][j+1][k],dp[i][j+1][k]);
                chmax(dp[i+1][j+1][k],dp[i+1][j][k]);
            }
            rep(k,3){
                chmax(dp[i+1][j+1][0],dp[i][j+1][k]+s[i][j]);
            }
            chmax(dp[i+1][j+1][1],dp[i+1][j][0]+s[i][j]);
            chmax(dp[i+1][j+1][2],dp[i+1][j][1]+s[i][j]);
        }
    }
    ll ans=0;
    rep(i,3){
        chmax(ans,dp[R][C][i]);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 566168
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
#define rep(i,n) for (ll i=0;i<(n);++i)
#define rep2(i,a,b) for (ll i=(a);i<(b);++i)
#define debug(x) cout << #x << '=' << x << endl
#define all(v) (v).begin(),(v).end()
const ll MOD=1e9+7;
//const ll MOD=998244353;
const ll INF=1e9;
const ll IINF=1e18;
const double EPS=1e-8;
const double pi=acos(-1);

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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N,D,A; cin >> N >> D >> A;
    vector<Pll> v;
    rep(i,N){
        ll X,H; cin >> X >> H;
        v.emplace_back(X,H);
    }
    sort(all(v));
    vector<ll> cnt(N,0);
    ll now=0,sum=0,ans=0;
    rep(i,N){
        while(v[now].first<v[i].first-2*D){
            sum-=cnt[now++]*A;
        }
        v[i].second-=sum;
        if (v[i].second<=0) continue;
        cnt[i]=(v[i].second+A-1)/A;
        sum+=cnt[i]*A;
        ans+=cnt[i];
    }
    cout << ans << endl;
}

Measured memory_bytes: 6512
#![allow(non_snake_case)]
#![allow(unused_variables)]
#![allow(dead_code)]

fn main() {
    let (A, B): (i64, i64) = {
        let mut line: String = String::new();
        std::io::stdin().read_line(&mut line).unwrap();
        let mut iter = line.split_whitespace();
        (
            iter.next().unwrap().parse().unwrap(),
            iter.next().unwrap().parse().unwrap()
        )
    };

    let ans = *vec![A + B, A - B, A * B].iter().max().unwrap();

    println!("{}", ans);
}


Measured memory_bytes: 4352
#include <stdio.h>
int main() {
  int v[6];
  for (int i = 1; i <= 5; i++) {
    scanf("%d", &v[i]);
  }
  if (v[1] == 0) {
    printf("1");
  } else if (v[2] == 0) {
    printf("2");
  } else if (v[3] == 0) {
    printf("3");
  } else if (v[4] == 0) {
    printf("4");
  } else if (v[5] == 0) {
    printf("5");
  }

  return 0;
}

Measured memory_bytes: 1620
#include <bits/stdc++.h>
using ll = long long;
#define FOR(i, k, n) for(ll i = (k); i < (n); i++)
#define FORe(i, k, n) for(ll i = (k); i <= (n); i++)
#define FORr(i, k, n) for(ll i = (k)-1; i > (n); i--)
#define FORre(i, k, n) for(ll i = (k)-1; i >= (n); i--)
#define REP(i, n) FOR(i, 0, n)
#define REPr(i, n) FORre(i, n, 0)
#define ALL(x) (x).begin(), (x).end()
#define ALLr(x) (x).rbegin(), (x).rend()
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;

const int INF = 1001001001;

int main(void){
  string s[3];
  REP(i, 3) cin >> s[i];
  string ans;
  REP(i, 3) ans += (char)toupper(s[i][0]);
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
use std::cmp;
use std::collections::HashMap;
use std::collections::VecDeque;
use std::io::Read;
use std::usize::MAX;

macro_rules! input {(source = $s:expr, $($r:tt)*) => {let mut iter = $s.split_whitespace();let mut next = || { iter.next().unwrap() };input_inner!{next, $($r)*}};($($r:tt)*) => {let stdin = std::io::stdin();let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));let mut next = move || -> String{bytes.by_ref().map(|r|r.unwrap() as char).skip_while(|c|c.is_whitespace()).take_while(|c|!c.is_whitespace()).collect()};input_inner!{next, $($r)*}};}
macro_rules! input_inner {($next:expr) => {};($next:expr, ) => {};($next:expr, $var:ident : $t:tt $($r:tt)*) => {let $var = read_value!($next, $t);input_inner!{$next $($r)*}};}
macro_rules! read_value {($next:expr, ( $($t:tt),* )) => {( $(read_value!($next, $t)),* )};($next:expr, [ $t:tt ; $len:expr ]) => {(0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()};($next:expr, chars) => {read_value!($next, String).chars().collect::<Vec<char>>()};($next:expr, usize1) => {read_value!($next, usize) - 1};($next:expr, [ $t:tt ]) => {{let len = read_value!($next, usize);(0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()}};($next:expr, $t:ty) => {$next().parse::<$t>().expect("Parse error")};}

fn solve() {
    input! {
        n: i64,
        m: i64,
        cake: [(i64,i64,i64);n]
    }

    let pattern: Vec<(i64, i64, i64)> = vec![
        (1, 1, 1),
        (-1, 1, 1),
        (1, -1, 1),
        (-1, -1, 1),
        (1, 1, -1),
        (-1, 1, -1),
        (1, -1, -1),
        (-1, -1, -1),
    ];

    let mut ans = 0;

    for p in &pattern {
        let mut cake: Vec<(i64, i64, i64)> = cake.clone();
        cake.sort_by(|a, b| {
            (a.0 * p.0 + a.1 * p.1 + a.2 * p.2).cmp(&(b.0 * p.0 + b.1 * p.1 + b.2 * p.2))
        });
        cake.reverse();

        let mut x = 0;
        let mut y = 0;
        let mut z = 0;
        for i in 0..m {
            let i = i as usize;
            x += cake[i].0;
            y += cake[i].1;
            z += cake[i].2;
        }
        let tmp_ans = x.abs() + y.abs() + z.abs();

        if tmp_ans > ans {
            ans = tmp_ans;
        }
    }
    println!("{}", ans);
}

fn main() {
    let thd = std::thread::Builder::new().stack_size(104_857_600);
    thd.spawn(|| solve()).unwrap().join().unwrap();

    /*
    // 入力を一括で読み込む場合
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();
    let mut input = buf.split_whitespace();

    // inputに対しnext()で読み込んでいく
    let q: usize = input.next().unwrap().parse().unwrap();
    */
}

const LARGE_PRIME: u64 = 1_000_000_007;

// @〜でsnippet


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

int main() {
	int n;
	cin >> n;
	vector<int>p(n);
	rep(i, n) {
		cin >> p[i];
	}
	int cnt(0);
	rep(i, n) {
		if (i + 2 > n - 1)continue;
		if (p[i] < p[i + 1] && p[i + 1] < p[i + 2])cnt++;
		if (p[i] > p[i + 1] && p[i + 1] > p[i + 2])cnt++;
	}
	cout << cnt;
	return 0;
}

Measured memory_bytes: 3616
n = int(input())
l = list(map(int, input().split()))

if n == 2:
    if l[0] == l[1]:
        print(1)
    else:
        print(0)
else:
    a = []
    b = []
    for i in range(n):
        if i % 2 == 0:
            a.append(l[i])
        else:
            b.append(l[i])

    da = {}
    for e in a:
        if e not in da:
            da[e] = (1,e)
        else:
            da[e] = (da[e][0]+1,da[e][1])

    db = {}
    for e in b:
        if e not in db:
            db[e] = (1,e)
        else:
            db[e] = (db[e][0]+1,db[e][1])

    da[-1] = (0,-1)
    db[-1] = (0,-1)

    la = list(reversed(sorted(list(da.values()))))
    lb = list(reversed(sorted(list(db.values()))))
    #print(la)
    #print(lb)



    if la[0][1] == lb[0][1]:
        ans = n- (la[0][0] + max(la[1][0],lb[1][0]))
    else:
        ans = n - (la[0][0] + lb[0][0])
    print(ans)


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

using namespace std;

using ll = long long;
using ull = unsigned long long;

const int INF = 1e9 + 5;
const int MOD = 1e9 + 7;

int main() {
  int n, m;
  cin >> n >> m;

  vector<int> w(n + 1), v(n + 1);

  for (auto i = 1; i <= n; ++i) {
    cin >> w[i] >> v[i];
  }

  ll dp[n + 1][m + 1];
  memset(dp, 0, sizeof(dp));

  for (auto i = 1; i <= n; ++i) {
    for (auto j = 1; j <= m; ++j) {
      dp[i][j] =
          max(dp[i - 1][j], j >= w[i] ? v[i] + dp[i - 1][j - w[i]] : 0ll);
    }
  }

  cout << (dp[n][m]) << "\n";
}

Measured memory_bytes: 79104
#include<bits/stdc++.h>
using namespace std ;
#define P pair<int,int>

main(){
	int n,num ;
	while( cin >> n , n ){
		int ans[100][2] = {} ;
		for( int i=0 ; i<n ; i++ ){
			cin >> num ;
			
			int c[11][2] = {} , sum[10] = {} ;
			for( int j=0 ; j<10 ; j++ ){
				
				cin >> c[j][0] ;
				if( j==9 || c[j][0]!=10 ) cin >> c[j][1] ;
				if( j==9 && c[j][0]+c[j][1]>=10 ) cin >> c[j+1][0] ;
				
				sum[j] += c[j][0] + c[j][1] ;
			}
			sum[9] += c[10][0] ;
			
			for( int j=0 ; j<9 ; j++ ){
				if( c[j][0] == 10 ){
					sum[j] += c[j+1][0] + c[j+1][1] ;
					if( i!=8 && c[j+1][0] == 10 && c[j+1][1] == 0 ) sum[j] += c[j+2][0] ;
				}
				else if( c[j][0]+c[j][1] == 10 ){
					sum[j] += c[j+1][0] ;
				}
			}
			for( int j=1 ; j<10 ; j++ ) sum[j] += sum[j-1] ;
			
			ans[i][0] = num ; ans[i][1] = sum[9] ;
		}
		
		for( int i=0 ; i<n ; i++ ){
			for( int j=i+1 ; j<n ; j++ ){
				if( ans[i][1] < ans[j][1] ||
					ans[i][1] == ans[j][1] && ans[i][0] > ans[j][0] ){
						swap( ans[i] , ans[j] ) ;
				}
			}
		}
		
		for( int i=0 ; i<n ; i++ ){
			cout << ans[i][0] << ' ' << ans[i][1] << endl ;
		}
	}
}

Measured memory_bytes: 1160
#!/usr/bin/env python

import sys
import math
import itertools as it
from collections import deque

sys.setrecursionlimit(10000000)

S_ = raw_input()
T_ = raw_input() + " "

S1 = S2 = ''
for i in range(len(S_)):
    if i % 2 == 0:
        S1 += S_[i]
    else:
        S2 += S_[i]

for S in [S1, S2]:
    T = T_
    for c in S:
        index = T.find(c)
        if index == -1:
            T = ""
            break
        T = T[index + 1:]
    
    if T != "":
        print "Yes"
        exit()
print "No"


Measured memory_bytes: 5036
object Main {
  trait Monoid[A]{
    def op(a1: A, a2: A): A
    def zero: A
  }

  class SegmentTree[A](val numOfNode: Int, val M: Monoid[A]){

    sealed trait Tree{ val value: A }
    case object Leaf extends Tree{ val value: A = M.zero }
    case class Node(value: A, left: Tree, right: Tree) extends Tree
    object Node {
        def apply(value: A) = new Node(value, Leaf, Leaf)
        def apply(l: Tree, r: Tree) = new Node(M.op(l.value,r.value),l,r)
    }

    private val empty: Node = Node(M.zero,Leaf,Leaf)
    private[this] var root: Tree = empty

    private def updateRec(id: Int, x:A, l: Int = 0, r: Int = numOfNode, t: Tree = root): Tree = {
        def branch(now: Node): Node = {
            val m = (l + r)/2
            if(r-l<=1)Node(x)
            else if(id < m)Node(updateRec(id,x,l,m, now.left), now.right)
            else Node(now.left,updateRec(id,x,m,r,now.right))
        }
        t match {
            case now: Node => branch(now)
            //case now: Tree => branch(empty)
            case _ => branch(empty)
        }
    }

    def update(id: Int, x: A): Unit = {
        root = updateRec(id, x)
    }

    def query(a: Int, b: Int, l: Int = 0, r: Int = numOfNode, t: Tree = root): A = {
      val m = (l + r)/2
      t match {
        case now: Node =>
          if(b<=l || r<=a)M.zero
          else if(a<=l && r<=b)now.value
          else M.op(query(a,b,l,m,now.left),query(a,b,m,r,now.right))
        case _ => M.zero
      }
    }
  }

  def main(args: Array[String]): Unit = {
    val line = scala.io.StdIn.readLine.split(" ").map(_.toInt)
    val n = line(0)
    val q = line(1)
    val m = new Monoid[Int]{
        def op(a1: Int, a2: Int): Int = a1 min a2
        def zero: Int = Int.MaxValue
    }

    val segtree = new SegmentTree[Int](n,m)

    for(i <- 1 to q){
        val input = scala.io.StdIn.readLine.split(" ").map(_.toInt)
        val x = input(1)
        val y = input(2)
        if(input(0)==0)segtree.update(x,y)
        else println(segtree.query(x,y+1))
    }
  }
}

Measured memory_bytes: 191304
#include<bits/stdc++.h>
#include<iomanip>
using namespace std;
typedef long long ll;
typedef long  l;
typedef pair<int,int> P;
#define rep(i,n) for(int i=0;i<n;i++)
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
const double PI=3.141592653589;
const int INF=1000000007;
const ll LMAX=1000000000000001;
const ll mod=1000000007;
ll gcd(ll a,ll b){if(a<b)swap(a,b);while((a%b)!=0){a=b;b=a%b;}return b;}
int dx[]={-1,0,1,0};
int dy[]={0,1,0,-1};

int main(){
  int n; cin>>n;
  ll t,a; cin>>t>>a;
  rep(i,n-1){
    ll T,A; cin>>T>>A;
    ll b=t/T;
    if(t%T!=0) b++;
    ll c=a/A;
    if(a%A!=0) c++;
    ll k=max(b,c);
    t=T*k;a=A*k;
  }
  cout<<t+a<<endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define BIT(n) (1LL << (n))
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPB(i, n) for (int i = 0; i < BIT(n); i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORA(i, n) for (auto &&i : n)
#define FORS(i, m, n) for (int i = m; i <= n; i++)
#define DEBUG(x) cerr << #x << ": " << x << "\n"
#define PRINTALL(V)                                                            \
  for (auto v : (V)) {                                                         \
    cerr << v << " ";                                                          \
  }                                                                            \
  cerr << "\n";
#define ALL(v) v.begin(), v.end()
#define fst first
#define snd second
#define mp make_pair
#define pb push_back
#define epb emplace_back
#define int long long
using namespace std;
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 (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template < class T > using vec = std::vector< T >;
template < class T > void print(const T &x) { cout << x << "\n"; }
const int MOD = 1000000007, INF = 1061109567, INF2 = INF * INF;
const double EPS = 1e-10, PI = acos(-1.0);
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
// int cost[][];
// vec< edge > E;
#define MAXN 120
set< int > group[MAXN][MAXN];
int cost[MAXN][MAXN];
signed main() {
  cin.tie(0), ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  int N, M;
  cin >> N >> M;

  //  vec<int>a(M),b
  //  set< set< int > > group(N, set< int >(N));
  REP(i, N) {
    REP(j, N) { cost[i][j] = i == j ? 0 : INF; }
  }
  REP(i, M) {
    int p, q, r;
    cin >> p >> q >> r;
    p--, q--;
    cost[p][q] = r;
    cost[q][p] = r;
    group[p][q].insert(i);
    group[q][p].insert(i);
  }

  REP(k, N) {
    REP(i, N) {
      REP(j, N) {
        bool flg = chmin(cost[i][j], cost[i][k] + cost[k][j]);
        if (flg) {
          set< int > tmp(group[i][k]);
          tmp.insert(ALL(group[k][j]));
          group[i][j] = tmp;
        }
      }
    }
  }

  set< int > ans;
  REP(i, N) {
    REP(j, N) {
      if (i != j) {
        // DEBUG(i);
        // DEBUG(j);
        // DEBUG(cost[i][j]);
        // PRINTALL(group[i][j]);
        ans.insert(ALL(group[i][j]));
      }
    }
  }
  print(M - ans.size());
}

Measured memory_bytes: 16640
using System;
using System.Collections.Generic;
using System.Linq;

namespace test
{
    class Program
    {
        const long mod = 1000000007;
        static void Main(string[] args)
        {
            var input = ReadArrayInt();
            var N = input[0];
            var M = input[1];
            var ans = 0L;
            if (N == M)
            {
                ans = Factorial(N) * Factorial(M) * 2 % mod;
            }
            else if (N - M == 1 || M - N == 1)
            {
                ans = Factorial(N) * Factorial(M) % mod;
            }

            Console.WriteLine(ans);
            Console.ReadLine();
        }

        static long Factorial(long num)
        {
            if (num == 0) return 1;

            var ret = 1L;

            while (num > 1)
            {
                ret = ret * num % mod;
                num--;
            }

            return ret;
        }

        static string Read() { return Console.ReadLine(); }
        static int ReadInt() { return int.Parse(Read()); }
        static long ReadLong() { return long.Parse(Read()); }
        static int[] ReadArrayInt() { return Read().Split(' ').Select(s => int.Parse(s)).ToArray(); }
        static long[] ReadArrayLong() { return Read().Split(' ').Select(s => long.Parse(s)).ToArray(); }
    }
}

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

/*
提出前に確認!
- setとmultisetを間違えない
*/

int	main(void)
{
	int n, k;
	cin >> n >> k;
	vector<int> p(n);
	for (int i = 0; i < n; i++) cin >> p[i];
	sort(p.begin(), p.end());
	int ans = 0;
	for (int i = 0; i < k; i++) ans += p[i];
	cout << ans << endl;
	return (0);
}


Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
int n, a, b, c, d;
int main()
{
    cin >> n >> a >> b >> c >> d;
    b -= a; n --;
    for (int i = 0; i <= n; ++ i)
        if (1ll * i * d - 1ll * (n - i) * c >= b && 1ll * i * c - 1ll * (n - i) * d <= b)
            return puts("YES"), 0;
    puts("NO");
}

Measured memory_bytes: 256
N, M = map(int, input().split())

d = {}
a = True
for i in range(M):
    s, c = map(int, input().split())
    if s in d:
        if d[s] != c:
            a = False
    d[s] = c

if N != 1:
    if 1 in d:
        if d[1] == 0:
            a = False
    else:
        d[1] = 1

ans = 0
for i in range(1, N+1):
    if i in d:
        ans += pow(10,N-i)*d[i]

if a:
    print(ans)
else:
    print(-1)


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

int main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int n, m;
	cin>>n>>m;
	vector<int> a(n);
	int sum = 0;
	for (auto &i : a){
		cin>>i;
		sum += i;
	}
	sort(a.rbegin(),a.rend());
	if (a[m-1] >= sum/(4.0*m)){
		cout<<"Yes\n";
	}else{
		cout<<"No\n";
	}
}


Measured memory_bytes: 3636
//
//  main.cpp
//  AOJ-1153
//
//  Created by Kenta Kodera on 2017/06/18.
//  Copyright ?? 2017??´ Kenta Kodera. All rights reserved.
//

#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <queue>
#include <numeric>
#include <string>
#include <string.h>
#include <map>
#include <set>
#include <functional>
#include <complex>
#include <stack>
#include <tuple>
#include <array>
#include <ctype.h> // isdigit
#include <cassert>
using namespace std;

int main(){
  int N, M;
  while(cin >> N >> M, N|M){
    vector<int> hand_H(N), hand_T(M);
    for(int i=0; i<N; i++){
      cin >> hand_H[i];
    }
    for(int i=0; i<M; i++){
      cin >> hand_T[i];
    }
    
    int sum_H = accumulate(hand_H.begin(), hand_H.end(), 0);
    int sum_T = accumulate(hand_T.begin(), hand_T.end(), 0);
    pair<int, int> ans = {999, 999};
 
    for(int i=0; i<N; i++){
      for(int j=0; j<M; j++){
        int pair_sum = ans.first + ans.second;
        int nH = sum_H-hand_H[i]+hand_T[j];
        int nT = sum_T-hand_T[j]+hand_H[i];
        if( nH == nT && pair_sum > hand_H[i]+hand_T[j]){
          ans = {hand_H[i],hand_T[j]};
        }
      }
    }
    if(ans.first == 999){
      cout << -1 << endl;
    }else{
      cout << ans.first << " " << ans.second << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 3080
import collections
n = int(input())
a = list(map(int, input().split()))
a = collections.Counter(a)
ans = []
for i, j in a.items():
    if j >= 2:
        for _ in range(j):
            ans.append(i)
ans.sort(reverse=True)
if len(ans) == 0:
    print(0)
else:
    print(ans[0]*ans[3])

Measured memory_bytes: 68760
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;

public class Main  implements Runnable { //Runnableを実装する

    public static void main(String[] args) {

        new Thread(null, new Main(), "", 16 * 1024 * 1024).start(); //16MBスタックを確保して実行

    }

    public void run() {
		Scanner sc = new Scanner(System.in);
		//Scanner sc = new Scanner("1000 1000 1000 8 ");
		//int n = Integer.parseInt(sc.next());
		int x, y, z;
		int n = Integer.parseInt(sc.next());
		int na[] = new int[n];
		int ans;
		for(int i = 0; i < n ; i++)
		{
			na[i] = Integer.parseInt(sc.next());
		}
		int max = 0;
		ans = 0;
		for(int i = 0; i < n ; i++)
		{
			if(na[i] >= max) 
			{
				max = na[i];
				ans++;
			}
		}
		PrintWriter out = new PrintWriter(System.out);

		out.println(ans);
		out.flush();
	}
}

Measured memory_bytes: 22868
#include <iostream>
#include <cstdio>

using namespace std;

int main(void){

  int n;
  int a[10][10];
  
  while( cin >> n , n ){
    
    for( int i = 0 ; i < n ; i++ )
      for( int j = 0 ; j < n ; j++ )
	cin >> a[i][j];
    
    for( int i = 0 ; i < n ; i++ ){
      for( int j = 0 ; j < n ; j++ ){
	printf("%5d", a[i][j]);
	
	if( j == n - 1 ){
	  int sum = 0;
	  for( int k = 0 ; k < n ; k++ ){
	    sum += a[i][k];
	  }
	  printf("%5d", sum);
	}
      }
      cout << endl;
    }
    
    for( int i = 0 ; i < n ; i++ ){
      int sum = 0;
      for( int j = 0 ; j < n ; j++ ){
	sum += a[j][i];
      }
      printf("%5d", sum);
    }
    
    int sum = 0;
    for( int i = 0 ; i < n ; i++ ){
      for( int j = 0 ; j < n ; j++ ){
	sum += a[i][j];
      }
    }
    printf("%5d", sum);
    cout << endl;
  }
  return 0;
}

Measured memory_bytes: 1192
#include <bits/stdc++.h>
#define _overload3(_1,_2,_3,name,...)name
#define _rep(i,n)repi(i,0,n)
#define repi(i,a,b)for(int i=int(a),i##_len=(b);i<i##_len;++i)
#define MSVC_UNKO(x)x
#define rep(...)MSVC_UNKO(_overload3(__VA_ARGS__,repi,_rep,_rep)(__VA_ARGS__))
#define all(c)c.begin(),c.end()
#define write(x)cout<<(x)<<'\n'
using namespace std; typedef long long ll; template<class T>using vv = vector<vector<T>>;
template<class T>auto vvec(int n, int m, T v) { return vv<T>(n, vector<T>(m, v)); }
constexpr int INF = 1 << 29, MOD = int(1e9) + 7; constexpr ll LINF = 1LL << 60;
struct aaa { aaa() { cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(10); }; }aaaa;

int main() {
    int R;
    cin >> R;
    write(3.141592 * 2 * R);
}

Measured memory_bytes: 3804
#include <stdio.h>

int main(void)
{
int x,y,n,i,k;
int a[99999];
int b[99999];
		i=0;
		scanf("%d %d",&x,&y);
		while(x!=0 |y!=0){
			a[i]=x;
			b[i]=y;
			i+=1;
			scanf("%d %d",&x,&y);
		}
	for(n=0;n+1<=i;n++){
		if(a[n]>b[n]){
			k=a[n];
			a[n]=b[n];
			b[n]=k;
		}
		printf("%d %d\n",a[n],b[n]);
	}
	return 0;
}

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

public class Main {
    static Scanner sc = new Scanner(System.in);
    static int num[] = new int[3];

    public static void main(String[] args) {
        for (int i = 0; i < 3; i++)
            num[i] = sc.nextInt();
        Arrays.sort(num);
        for (int i = 0; i < 3; i++) {
            System.out.print(num[i]);
            if (i != 2){
                System.out.print(" ");
            }
        }
        System.out.println();
    }
}



Measured memory_bytes: 26200
#![allow(unused, non_snake_case, dead_code, non_upper_case_globals)]
use {
    proconio::{marker::*, *},
    std::{cmp::*, collections::*, mem::*},
};

#[fastout]
fn main() {
    input! {//
        n:usize,
        k:usize,
        a:[i32;n],
    }
    for i in k..n {
        print!("{} ", if a[i - k] < a[i] { "Yes" } else { "No" });
    }
}


Measured memory_bytes: 4780
#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <cstring>
#include <utility>
#include <algorithm>
#include <functional>
#include <deque>
#include <cctype>
#include <ctime>
#include <cstdlib>
#include <iomanip>
using namespace std;

int main(){
    int R;;
    cin >> R;;
    ;
    if(R<1200) cout << "ABC" << endl;
    else if((1200<=R&&R<2800)) cout << "ARC" << endl;
    else cout << "AGC" << endl;;
}

Measured memory_bytes: 888
N = int(input())
A = sorted(list(map(int, input().split())), reverse=True)

ans = A[0]
cnt = 1
for a in A[1:]:
    if cnt + 1 < N:
        ans += a
        cnt += 1

    if cnt+ 1 < N:
        ans += a
        cnt += 1
print(ans)


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

int main()
{
    int n;
    std::cin >> n;
    std::vector<std::string> words;
    std::string str;
    for (int i = 0; i < n; i++)
    {
        std::cin >> str;
        words.push_back(str);
    }

    std::vector<std::string> cpy = words;
    std::sort(cpy.begin(), cpy.end());
    if (std::unique(cpy.begin(), cpy.end()) != cpy.end())
    {
        std::cout << "No" << std::endl;
        return 0;
    }

    for (int i = 0; i < n - 1; i++)
    {
        if (words[i][words[i].length() - 1] != words[i + 1][0])
        {
            std::cout << "No" << std::endl;
            return 0;
        }
    }

    std::cout << "Yes" << std::endl;

    return 0;
}

Measured memory_bytes: 256
(let ((n (read))
      (a (make-array 0 :element-type 'integer
                       :fill-pointer 0
                       :adjustable t))
      b
      (ans 0))
  (loop for i from 1 upto n do
        (vector-push-extend (- (read) i) a))
  (sort a #'<)
  (setf b (if (oddp n) (aref a (floor (/ n 2))) (floor (/ (+ (aref a (/ n 2)) (aref a (- (/ n 2) 1))) 2))))
  (loop for i below n do
        (incf ans (abs (- (aref a i) b))))
  (prin1 ans))


Measured memory_bytes: 59752
#include <bits/stdc++.h>
using namespace std;
int main () {
  int A1 , A2 , A3;
  cin >> A1 >> A2 >> A3;
int ans = max ({ A1 , A2 , A3 }) - min ({ A1 , A2 , A3 });
cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
using namespace std;
bool vis[1000001];
int main()
{
	int n;
	cin>>n;
	int a[n+1];
	for(int i=1;i<=n;i++)
	 cin>>a[i];
   sort(a+1,a+1+n);
   for(int i=1;i<=n;i++)
   {  if(a[i]==a[i-1])
          vis[a[i]]=true;
   } 
   int count=0;  
   for(int i=1;i<=n;i++)
      {
      	if(!vis[a[i]])
      	     count++;
      	  if(a[i]!=a[i-1])
			{
			      
      	     for(int j=2*a[i];j<=1000001;j+=a[i])
      	         {
      	         	vis[j]=true;
				   }
			}
	  }
	  cout<<count<<endl;
return 0;

}

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

int main()
{
    char str[1024];
    int len;

    scanf("%s", str);

    for (int i = 0; str[i] != '\0'; i++) {
        putchar((26 + (str[i] - 'A' - 3)) % 26 + 'A');
    }
    putchar('\n');
    
    return 0;
}



Measured memory_bytes: 2048
#include<iostream>
#include<algorithm>
using namespace std;
long long dp[6000],n,a[6000],i,maxm;
int main(){
  while(1){
    cin>>n;
    if(n==0)break;
    for(int i=1;i<=n;i++)cin>>a[i];
    dp[1]=maxm=a[1];
    for(int i=2;i<=n;i++){
      if(dp[i-1]>=0)dp[i]=dp[i-1]+a[i];
      else dp[i]=a[i];
       
      maxm=max(dp[i],maxm);
    }
    cout<<maxm<<endl;
  }
  return 0;
}


Measured memory_bytes: 3132
#include <bits/stdc++.h>
#define double long double
#define int long long
#define inf 1000000007 
#define sort(vec) sort(vec.begin(),vec.end());
#define rever(vec) reverse(vec.begin(),vec.end());
#define unsort(vec) sort(vec); rever(vec);
#define rep(i,n) for(int i=0;i<n;i++)
#define cend cout<<endl;
#define F first
#define S second
using namespace std;
int a[100010];
signed main() {
	int n;
	cin>>n;
	rep(i,n){
		cin>>a[i];
	}
	int ans=0;
	rep(i,n-1){
		if(a[i]!=i+1&&a[i+1]==i+2&&a[i+2]==i+3)continue;
		if(a[i]==i+1||a[i+1]==i+2){
			swap(a[i],a[i+1]);
			ans++;
		}
	}
	cout<<ans<<endl;
}
	


Measured memory_bytes: 1024
N, W = map(int, input().split())
dp = [-1] * (W+1)
dp[0] = 0

for n in range(N):
    w, v = map(int, input().split())

    for i in range(min(W, W-w), -1, -1):
        if dp[i] != -1:
            dp[i+w] = max(dp[i+w], dp[i]+v)

print(max(dp))


Measured memory_bytes: 43392
#include <iostream>
using namespace std;
long long gcd(long long a,long long b){
  return (a%b==0?b:gcd(b,a%b));
}
int main(){
  int n;cin>>n;
  long long ans = 1;
  for(int i = 0; n > i; i++){
    long long tmp;cin>>tmp;
    ans = tmp/gcd(ans,tmp)*ans;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
const int MAX_V=10000;
int V;				//substitute!!
vector<int> G[MAX_V];
int match[MAX_V];
bool used[MAX_V];
void add_edge(int u,int v){
	//printf("%d->%d\n",u,v);
	G[u].push_back(v);
	G[v].push_back(u);
}
bool dfs(int v){
	used[v]=true;
	rep(i,G[v].size()){
		int u=G[v][i],w=match[u];
		if(w<0 || (!used[w] && dfs(w))){
			match[v]=u;
			match[u]=v;
			return true;
		}
	}
	return false;
}
int nibu(){
	int res=0;
	memset(match,-1,sizeof(match));
	rep(v,V){
		if(match[v]<0){
			memset(used,0,sizeof(used));
			if(dfs(v)) res++;
		}
	}
	return res;
}
int H,W;
string st[100];
bool s[100][100];
int vc[100][100];
bool is3(int x,int y){
	return (int)(s[x][y])+(int)(s[x+1][y])+(int)(s[x][y+1])+(int)(s[x+1][y+1])==3;
}
bool is4(int x,int y){
	return (int)(s[x][y])+(int)(s[x+1][y])+(int)(s[x][y+1])+(int)(s[x+1][y+1])==4;
}
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
int main(){
	while(true){
		int ans=1,cnt=0;
		cin>>H>>W;
		if(H==0) break;
		V=H*W;
		rep(i,V) G[i].clear();
		rep(i,H) rep(j,W) vc[i][j]=-1;
		rep(i,H) cin>>st[i];
		rep(i,H) rep(j,W) s[i][j]=(st[i][j]=='#');
		rep(i,H-1) rep(j,W-1){
			if(!is3(i,j)) continue;
			ans++;
			int d_[2];
			if(!s[i+1][j+1]) d_[0]=2,d_[1]=3;
			if(!s[i+1][j]) d_[0]=2,d_[1]=1;
			if(!s[i][j+1]) d_[0]=0,d_[1]=3;
			if(!s[i][j]) d_[0]=0,d_[1]=1;
//			printf("i,j=(%d,%d)\n",i,j);
			rep(h,2){
				int d=d_[h];
				if(d>=2) continue;
				int x=i,y=j;
				x+=dx[d],y+=dy[d];
				while(0<=x&&x<H-1&&0<=y&&y<W-1){
					if(is3(x,y)){
						//show(x);
						//show(y);
						//show(d);
						bool is=0;
						switch(d){
							case 0:
								if(!s[x+1][y+1]||!s[x+1][y]) is=1;
								break;
							case 1:
								if(!s[x+1][y+1]||!s[x][y+1]) is=1;
								break;
						}
						if(!is) break;
						int ii=i,jj=j;
						if(vc[ii][jj]>=0) add_edge(vc[ii][jj],cnt);
						else vc[ii][jj]=cnt;
						while(true){
							ii+=dx[d],jj+=dy[d];
							if(vc[ii][jj]>=0) add_edge(vc[ii][jj],cnt);
							else vc[ii][jj]=cnt;
							if(ii==x&&jj==y) break;
						}
						cnt++;
						break;
					}else if(!is4(x,y)){
						break;
					}
					x+=dx[d],y+=dy[d];
				}
			}
		}
//		show(ans);
		cout<<ans-cnt+nibu()<<endl;
	}
}

Measured memory_bytes: 1940
// ABC049
// A - 居合を終え、青い絵を覆う / UOIAUAI
#include<bits/stdc++.h>

using namespace std;

int main(){
    string s = "aiueo";
    char c;
    cin >> c;
    if(s.find(c) != string::npos) cout << "vowel" << endl;
    else cout << "consonant" << endl;
    return 0;
}


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

using namespace std;

#define ok1 printf("ok1\n");
#define ok2 printf("ok2\n");
#define M 1000000000000000000LL
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n)　for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define pb push_back
#define pf push_front
#define MIN(a,b) a=min((a),(b))
#define MAX(a,b) a=max((a),(b))
#define SIZE(v) (int)v.size()
#define Eunique(v) v.erace(unique(all(v)),v.end())
#define pvec(v)　rep(i,v.size()){cout << v[i] << " ";}
#define INF 0x3f3f3f3f
#define mset(m,v) memset(m,v,sezeof(m))
#define mod 1e9 +7;

const double pi = acos(-1.0);

typedef string ss;
typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef deque<ll> dll;
typedef pair<ll,ll> P;
ll dx[4] = {1,0,-1,0},dy[4] = {0,1,0,-1};

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

ll lcm(ll x,ll y)
{
    x /= gcd(x,y);
    y /= gcd(x,y);
    return (x*y);
}

int main()
{
    ll n;
    cin >> n;
    vs s(n);
    rep(i,n)cin >> s[i];
    rep(i,n-1){
        if(s[i][SIZE(s[i])-1] != s[i+1][0]){
            cout << "No" << endl;
            return 0;
        }
    }
    rep(i,n){
        rep(j,n){
            if(i != j){
                if(s[i] == s[j]){
                    cout << "No" << endl;
                    return 0;
                }
            }
        }
    }
    cout << "Yes" << endl;
    return 0;
}


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

public class Main {
    static final long DIV = 998244353;
    public static void main(String[] args) {
        FastScanner sc = new FastScanner();
        int n = sc.nextInt();
        char[] c = sc.next().toCharArray();
        for (int i = 0; i < c.length; i++) {
            c[i] += n;
            if(c[i] > 'Z') c[i] -= 26;
        }
        String s = String.copyValueOf(c);
        System.out.println(s);
    }



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

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

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

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

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

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

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

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

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

}



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

int main(){
	int c=0;
	string s,x,pre;
	cin>>s;
	for(int i=0;i<s.length();i++){
		x+=s[i];
		if(x!=pre){
			pre=x;
			x.clear();
			c++;
		}
	}
	cout<<c;
}


Measured memory_bytes: 640
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <set>
#include <sstream>
#include <string>
#include <queue>
#include <vector>
using namespace std;

#define rep(i,n) for(int i=0; i<(n); ++i)
#define rrep(i,n) for(int i=1; i<=(n); ++i)
#define drep(i,n) for(int i=(n)-1; i>=0; --i)
#define foreach(it, v) for(typeof(v.begin()) it=v.begin(); it!=v.end(); ++it)
#define pb push_back
#define sz(x) (int)(x).size()
#define fi first
#define se second

typedef unsigned int uint;
typedef long long int ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef vector<pii> vpii;
typedef set<int> si;

//MOD//
const ll MOD = 1000000007;
struct big;
big ex(big a, ll tms);
typedef struct big{
  ll val;
  big():val(0){}
  big(ll val):val((val%MOD+MOD)%MOD){}
  big& operator += (const big& obj){ (val+=obj.val)%=MOD; return *this;}
  big& operator -= (const big& obj){ (val+=MOD-obj.val)%=MOD; return *this;}
  big& operator *= (const big& obj){ (val*=obj.val)%=MOD; return *this;}
  big& operator /= (const big& obj){ (val*=ex(obj,MOD-2).val)%=MOD; return *this;}
  big operator + (const big& obj)const{ return big(*this) += obj;}
  big operator - (const big& obj)const{ return big(*this) -= obj;}
  big operator * (const big& obj)const{ return big(*this) *= obj;}
  big operator / (const big& obj)const{ return big(*this) /= obj;}
  bool operator < (const big& obj)const{ return val < obj.val;}
  bool operator == (const big& obj)const{ return val == obj.val;}
} big;
istream& operator >> (istream& i, big& obj){ i>>obj.val; return i;}
ostream& operator << (ostream& o, const big& obj){ o<<obj.val; return o;}
big ex(big obj, ll tms){
  if(!tms) return 1;
  big ret = ex(obj, tms/2);
  ret *= ret;
  return (tms&1) ? ret*obj : ret;
}
//MOD//

ll pow(ll n, int m){
  if(!m) return 1;
  ll ret = pow(n, m/2);
  ret *= ret;
  return (m&1) ? ret*n : ret;
}

template <class F, class T>
void convert(const F &f, T &t){
  stringstream ss;
  ss << f;
  ss >> t;
}

int N, A, B;

int now;

void hoge(si d, si c) {
  int del = (*d.begin());
  d.erase(del);
  c.erase(del);
  if (d.size()) {
    int del2 = (*d.begin());
    d.erase(del2);
    si dn;
    dn.insert(del2);
    hoge(dn, c);
    now ^= 1<<del;
    cout << now << endl;
    hoge(d, c);
    d.insert(del2);
  } else if (c.size()) {
    int del2 = (*c.begin());
    si dn;
    dn.insert(del2);
    hoge(dn, c);
    now ^= 1<<del;
    cout << now << endl;
    hoge(dn, c);
  } else {
    now ^= 1<<del;
    cout << now << endl;
  }
  c.insert(del);
  d.insert(del);
}

int main(){
  scanf("%d%d%d",&N,&A,&B);

  si diffs;
  si changes;
  rep (i,N) {
    if ((A>>i ^ B>>i) & 1) diffs.insert(i);
  }
  if (diffs.size() % 2 == 0) {
    cout << "NO" << endl;
    return 0;
  }
  else cout << "YES" << endl;

  rep(i,N) changes.insert(i);

  now = A;
  cout << now << endl;
  hoge(diffs, changes);

  return 0;
}


Measured memory_bytes: 1024
N, M, C = map(int, input().split())
b_list = list(map(int, input().split()))

num_clear = 0
for i in range(N):
    a_list = list(map(int, input().split()))
    cur_score = 0
    for b, a in zip(b_list, a_list):
        cur_score += b * a
    cur_score += C
    if cur_score > 0:
        num_clear += 1

print(num_clear)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
#include <iostream>

#include <bitset>
#include <cassert>
#include <queue>
#include <random>
#include <stack>
#include <iomanip>

using namespace std;

#define rep(i, n) for (ll i = 0; i < (ll)n; i++)
#define repf(i, a, b) for (ll i = (ll)a; i < (ll)b; i++)
#define repr(i, a, b) for (ll i = (ll)a; i > (ll)b; i--)

#define repv(x, arr) for (auto &x : arr)
#define all(v) (v).begin(), (v).end()
#define vec(name, num) vector<ll> name((num), 0);
#define mp(a, b) make_pair(a, b)
#define op(i) cout << (i) << endl;
#define F first
#define S second

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pdd;
typedef vector<ll> vll;
typedef vector<vll> vvll;

const ll mod = 1e9 + 7;
const ll infl = 1e17;


int main()
{
    ll n;
    cin >> n;
    set<ll> yaku;
    repf(k,1,n+1){
        if (k*k>n)
            break;
        if (n%k==0){
            yaku.insert(k);
            yaku.insert(n / k);
        }
    }
    ll ans = 0;
    for (auto k:yaku){
        ll m = n / k - 1;
        if (m<=0)
            continue;
        if (n/m==n%m)
            ans += m;
    }
    cout << ans << endl;
}


Measured memory_bytes: 512
#include <stdio.h>
#include <set>

#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=(n)-1;i>=0;i--)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define STR(i,str) for(int i=0;(str)[i];i++)
#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define MAX3(a,b,c) ((a)>(b)?(a)>(c)?(a):(c):(b)>(c)?(b):(c))
#define MIN3(a,b,c) ((a)<(b)?(a)<(c)?(a):(c):(b)<(c)?(b):(c))
#define RNG(a,b) ((a)>(b)?(a)-(b):(b)-(a))
#define RNG3(a,b,c) ((a)>(b)?(b)>(c)?(a)-(c):(c)>(a)?(c)-(b):(a)-(b):(b)>(c)?(c)>(a)?(b)-(a):(b)-(c):(c)-(a))
#define MAXS(a,b) {if((a)<(b))(a)=(b);}
#define MINS(a,b) {if((a)>(b))(a)=(b);}

int main(){
	std::set<unsigned long> table;
	unsigned long n, a, ans = 0;
	scanf("%lu", &n);
	for(unsigned long i = 0; i < n; i++){
		scanf("%lu", &a);
		std::set<unsigned long>::iterator it = table.find(a);
		if(it == table.end()){
			table.insert(a);
			ans++;
		}else{
			table.erase(it);
			ans--;
		}
	}
	printf("%d\n", ans);
}

Measured memory_bytes: 4864
#include <stdio.h>
int map[1000];
char in[1000];
int main()
{
  int n,m,i,p;
  for(;;){
    scanf("%d%d",&n,&m);
    if(n == 0 && m == 0) break;
    for(i=0;i<n;i++){
      scanf("%d",&map[i]);
    }
    for(i=0;i<m;i++){
      scanf("%d",&in[i]);
    }
    p = 0;
    for(i=0;i<m;i++){
      p += in[i];
      p += map[p];
      if(p >= n-1) break;
    }
    printf("%d\n",i+1);
  }
  return 0;
}

Measured memory_bytes: 0
#include <set>
#include <map>
#include <cmath>
#include <stack>
#include <queue>
#include <vector>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#define debug(x) cout
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define sz(x) ((int)(x).size)
#define all(x) x.begin(),x.end()
#define rep(i,a,n) for (int i=(a);i<(n);++i)
#define per(i,a,n) for (int i=(n)-1;i>=(a);--i)
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
inline ll read() {
  ll x=0, f=1; char ch=getchar();
  while (ch<'0'||ch>'9') f=(ch=='-')?-1:1, ch=getchar();
  while (ch>='0'&&ch<='9') x=(x<<1)+(x<<3)+ch-'0', ch=getchar();
  return x*f;
}
inline void fileio() {
  freopen("t.in","r",stdin);
  //freopen("t.out","w",stdout);
}
//Produced By MiracleEEEE
//head

int main()
{
	int a=read(),b=read();
	printf("%d\n",max(a-b,0));
	return 0;
}


Measured memory_bytes: 128