akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define PB push_back
#define PF push_front
#define MP make_pair
typedef long long int ll;
const ll mod = 1e9+7;
const ll INF = 2e9;
const double epsilon = 1e-7;
const double PI = 3.1415926535;
ll gcd(ll a,ll b) {return b?gcd(b,a%b):a;}

int main(){
  int n;
  cin >> n;
  cout << n * n * n <<endl;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <cmath>
#include <queue>
#include <stack>
#include <list>
#include <functional>
#include <numeric>
#include <iostream>
#include <string>
#include <time.h>
#include <bitset>

using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }

int N, M, Q;
int a[56], b[56], c[56], d[56];

int main() {

	cin >> N >> M >> Q;
	rep(i, Q) cin >> a[i] >> b[i] >> c[i] >> d[i];

	int delta[12] = {};
	int sum[12] = {};
	delta[N - 1] = -1;
	ll ans = 0;

	for (int i = N - 1; i >= 0; --i) {
		delta[i]++;
		rep(i, N) {
			if (!i) sum[i] = delta[i] + 1;
			else sum[i] = sum[i - 1] + delta[i];
		}
		if (sum[N - 1] > M) {
			delta[i] = 0;
		}
		else {
			ll subans = 0;
			rep(i, Q) {
				if (sum[b[i] - 1] - sum[a[i] - 1] == c[i]) subans += d[i];
			}
			ans = max(ans, subans);


			i = N;
		}
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 3636
import java.util.*

fun main(args: Array<String>) {
    val scan = Scanner(System.`in`)
        var (x,y) = scan.nextLine().split(" ").map{ it.trim().toInt() }.toTypedArray()
        if(y<=(x*4) && y>=(x*2) && y%2==0)
            println("Yes")
    else
            println("No")

}


Measured memory_bytes: 38276
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;
import java.util.List;

/*


*/

public class Main {
    public static void main(String[] args){

        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int y = sc.nextInt();
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        List<Integer> A = new ArrayList<>();
        List<Integer> B = new ArrayList<>();
        List<Integer> C = new ArrayList<>();       

        for (int i = 0; i < a; i ++) {
            A.add(sc.nextInt());
        }
        for (int i = 0; i < b; i ++) {
            B.add(sc.nextInt());
        }
        for (int i = 0; i < c; i ++) {
            C.add( sc.nextInt());
        }

        Collections.sort(A,Collections.reverseOrder());
        Collections.sort(B,Collections.reverseOrder());

        for (int i= 0; i < x; i++) {
            C.add(A.get(i));
        }
        for (int i= 0; i < y; i++) {
        	C.add(B.get(i));
        }

        long ans = 0;
        Collections.sort(C,Collections.reverseOrder());

        for (int i = 0; i < x + y; i++) {
            ans += C.get(i);
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 99344
// time out
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; 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 INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main()
{
  int N;
  cin >> N;
  ll ans = 0;

  for(int i = 1; i <= N; i++) {
    for(int j = i; j <= N; j += i) {
      ans += j;
    }
  }

  cout << ans << endl;
}

Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
using Graph=vector<vector<int>>;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
typedef long long ll;
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(){
    int H,W,K;
    cin>>H>>W>>K;
    vector<string>M(H);
    rep(i,H){
        cin>>M[i];
    }
    int ans=0;
    for(int tmpH=0;tmpH<(1<<H);tmpH++){
        for(int tmpW=0;tmpW<(1<<W);tmpW++){
            bitset<6>BITH(tmpH);
            bitset<6>BITW(tmpW);
            int cnt=0;
            rep(i,H){
                rep(j,W){
                    if(!BITH.test(i)){
                        if(!BITW.test(j)){
                            if(M[i].at(j)=='#'){
                                cnt++;
                            }
                        }
                    }
                }
            }
            if(cnt==K){
                ans++;
            }
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3624
#include <iostream>
using namespace std;
int A[21],n;

bool solve(int A[], int i, int m)
{
	if(m==0) return true;
	if(i>=n) return false;
	bool res = (solve(A,i+1,m) || solve(A,i+1,m-A[i]));
	return res;
}

int main(int argc, char const *argv[])
{
	int q;
	cin>>n;
	for (int i = 0; i < n; ++i)
	{
		cin>>A[i];
	}
	cin>>q;
	for (int i = 0; i < q; ++i)
	{
		int m;
		cin>>m;
		if(solve(A,0,m)) cout<<"yes"<<endl;
		else cout<<"no"<<endl;
	}
	return 0;
}

Measured memory_bytes: 3036
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();
    char[][] a = new char[h+2][w+2];
    for(int i = 0; i < a.length; i++){
      Arrays.fill(a[i], '.');
    }
    for(int i = 1; i < h + 1; i++){
      String tmp = sc.next();
      for(int j = 0; j < w; j++){
        if(tmp.charAt(j) == '#'){
          a[i][j+1] = '#';
        }
      }
    }
    for(int i = 1; i < a.length-1; i++){
      for(int j = 1; j < a[i].length-1; j++){
        if(a[i][j] == '#'){
          System.out.print('#');
        }else{
          int count = 0;
          for(int k = -1; k < 2; k++){
            for(int l = -1; l < 2; l++){
              if(k == 0 && l == 0) continue;
              if(a[i+k][j+l] == '#'){
                count++;
              }
            }
          }
          System.out.print(count);
        }
      }
      System.out.println();
    }
  }
}

Measured memory_bytes: 22228
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int MOD = 1e9+7;

//vector<vector<int>> vec(縦,vector<int>(横));
/*deque<型> 配列の先頭にも用がある時はvectorの代わりに。
入力はstringでもらってからpush_back()*/
//printf("%書式指定" ,出力したい物);\nで改行


int N; //グローバル変数ってやつ？

void dfs(string s, char max){
  
  if(s.size()==N)
  {
   printf("%s\n",s.c_str());
  }
  
  else
  {
    
   for(char c='a'; c<=max; c++)
   {
     
    if(c == max)
    {
     dfs(s+c,max+1);
    }
     
     
    else
    {
     dfs(s+c,max);
    }
    
    
   }
    
  }
   
}


int main(){
  cin>>N;
  dfs("",'a');
}

Measured memory_bytes: 1536
import java.util.Scanner;

public class Main {
	public static int linearSearch(int[] input, int[] toFind) {
		int result = 0;
		
		for (int i = 0; i < toFind.length; i++) {
			for (int j = 0; j < input.length; j++) {
				if (toFind[i] == input[j]) {
					result++;
					break;
				}
			}
		}
		
		return result;
	}
	
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int[] input;
		int[] searchFor;
		int numInput;
		int numSearchFor;
		
		numInput = scanner.nextInt();
		input = new int[numInput];
		for (int i = 0; i < numInput; i++) {
			input[i] = scanner.nextInt();
		}
		
		numSearchFor = scanner.nextInt();
		searchFor = new int[numSearchFor];
		for (int i = 0; i < numSearchFor; i++) {
			searchFor[i] = scanner.nextInt();
		}
		
		scanner.close();
		
		System.out.println(linearSearch(input, searchFor));
	}
}



Measured memory_bytes: 40680
#include <iostream>
#include <iomanip> //! for setprecision(10)
#include <math.h>
#include <algorithm>
#include <functional> 
#include <string>
#include <vector>

#include <cstring>
#include <set>
#include <map>
#include <queue>
#include <utility>
#include <limits.h>

using namespace std;

typedef long long LL;

#define rep(i,n) for (int i = 0; i < (n); ++i)
#define dump(c) { for (auto it = c.begin(); it != c.end(); ++it) if (it == c.begin()) cout << *it; else cout << ' ' << *it; cout << endl; } 
#define dumpMap(m) { for (auto it: m) cout << it.first << "=>" << it.second << ' '; }

const int MOD = 1000000007;

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

    int ans = r * r;
    cout << ans << endl;

    return 0;
}


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

#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define REP(i, n) for(int i = 0; i < (n); ++i)
#define REPr(i, n) for(int i = (n)-1; i >= 0; --i)
#define FORq(i, m, n) for(int i = (m); i <= (n); ++i)
#define FORqr(i, m, n) for(int i = (n); i >= (m); --i)
#define MP make_pair
#define SIN(x, S) (S.count(x) != 0)
#define M0(x) memset(x, 0, sizeof(x))
#define FILL(x, y) memset(x, y, sizeof(x))
#define MM(x) memset(x, -1, sizeof(x))
#define ALL(x) (x).begin(), (x).end()
#define DB(x) cerr << #x << " = " << x << endl
#define DB2(x, y)                                                              \
    cerr << "(" << #x << ", " << #y << ") = (" << x << ", " << y << ")\n";
#define DEBUG                                                                  \
    int x12345;                                                                \
    cin >> x12345;
typedef pair<int, int> PII;
typedef pair<long long, long long> PLL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<long long> VL;
typedef long long ll;
typedef long long integer;
const long long MOD = 1e9 + 7;
///////////////////////////////////////////////
// for template
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;
}
///////////////////////////////////////////////
/// 🍈( '-' 🍈 |AC|
int main() {
    char c;
    cin >> c;
    if (('a' <= c) and (c <= 'z')){
        puts("a");
    }else{
        puts("A");
    }
    
}

Measured memory_bytes: 3584
#include<bits/stdc++.h>
#define F first
#define S second
#define MP make_pair
#define pb push_back
#define endl '\n'

using namespace std;

typedef long long LL;
typedef pair< int, int > P;
typedef pair< LL, LL > LP;
typedef pair< int, P > iP;
typedef pair< P, P > PP;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1000000007;

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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int n, m, k;
    cin >> n >> m >> k;
    
    bool flg = false;
    for( int i = 0; i <= n; ++i ) {
        for( int j = 0; j <= m; ++j ) {
            if( i * (m - j) + j * (n - i) == k ) flg = true;
        }
    }

    if( flg ) cout << "Yes";
    else cout << "No";
    cout << endl;
    return 0;
}



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

int main(){
	int num[3];
	cin>>num[0]>>num[1]>>num[2];
	sort(num,num+3);
	if(num[0]==num[1]&&num[1]==num[2]){
		cout<<0<<endl;
		return 0;
	}
	int x=num[1]-num[0];
	int y=num[2]-num[1];
	int kase1,kase2,kase3;
	if(x%2==0){
		kase1=x/2+y;
	}else{
		kase1=x/2+y+2;
	}
	if(y%2==0&&(x+y)%2==0){
		kase2=y/2+(x+y)/2;
	}else{
		if(y%2==0||(x+y)%2==0){
			kase2=y/2+(x+y)/2+2;
		}else{
			kase2=y/2+(x+y)/2+1;
		}
	}
	kase3=2*x+y;
	int res=min(min(kase1,kase2),kase3);
	cout<<res<<endl;
	return 0;
}

Measured memory_bytes: 256
def a():
    s = input()
    t = input()
    if s == t[0:-1]:
        print('Yes')
    else:
        print('No')



def b():
    a, b, c, k = map(int, input().split())
    xa = min(k, a)
    k1 = k - xa
    xb = min(k1, b)
    k2 = k1 - xb
    print(xa - k2)

# def c():

# def d():


b()

Measured memory_bytes: 9188
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    N = int(readline())
    D, X = map(int, readline().split())
    ans = X

    for _ in range(N):
        a = int(readline())
        for i in range(1, D + 1, a):
            ans += 1

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 64716
#[allow(unused_macros)]
macro_rules! input_byline {
    ($($r:tt)* ) => {
        let stdin = std::io::stdin();
        let mut q = std::collections::VecDeque::new();
        let mut next = || {
            if q.is_empty() {
                let mut s = String::new();
                stdin.read_line(&mut s);
                for v in s.split_whitespace() {
                    q.push_back(v.to_string());
                }
            }
            q.pop_front().unwrap()
        };
        input_inner!{next, $($r)*}
    };

}

#[allow(unused_macros)]
macro_rules! input {
    ($($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)*}
    };
}

#[allow(unused_macros)]
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)*}
    };

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

#[allow(unused_macros)]
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, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

trait Printable {
    fn p(&self);
}

impl<T: std::fmt::Display> Printable for T {
    fn p(&self) {
        println!("{}", self);
    }
}

impl<T: std::fmt::Display> Printable for [T] {
    fn p(&self) {
        for i in 0..self.len() {
            if i != 0 {
                print!(" ");
            }
            print!("{}", self[i]);
        }
        println!("");
    }
}

#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::{BinaryHeap, HashMap};

#[allow(dead_code)]
type Graph = Vec<Vec<usize>>;
#[allow(dead_code)]
const M: usize = 1e9 as usize + 9;

fn main() {
    input! {
        n: usize,
        a: [usize; n],
    }

    let mut cur = 1;
    for i in 0..n {
        if a[i] == cur {
            cur += 1;
        }
    }

    if cur != 1 {
        println!("{}", n + 1 - cur);
    } else {
        println!("{}", -1);
    }
}


Measured memory_bytes: 6396
#include <stdio.h>

#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

using ll = long long;
using ld = long double;
using vi = vector<int>;
using vb = vector<bool>;
using ii = pair<int, int>;

#define eb emplace_back

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

  int a, b, c, d;
  cin >> a >> b >> c >> d;
  bool first = 1;
  while (a > 0 && c > 0) {
    if (first) {
      c -= b;
    } else {
      a -= d;
    }
    first = !first;
  }

  if (a > 0) {
    cout << "Yes";
  } else {
    cout << "No";
  }
}


Measured memory_bytes: 3100
#include <bits/stdc++.h> 
 
using namespace std;
 
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
 
 
//typedef
//------------------------------------------
typedef pair<int, int> PII;
typedef long long LL;
typedef pair<long, long> PLL;
 
//container util
//------------------------------------------
#define PB emplace_back
#define MP make_pair 
#define SZ(a) int((a).size())
//repetition
//------------------------------------------
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SORT(c) sort((c).begin(),(c).end())
//constant
//--------------------------------------------
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
 
const double EPS=1e-10;
 
typedef int Weight;
//typedef
//------------------------------------------
 
typedef int Weight;
//typedef
//------------------------------------------
 
 
int main(){
    int N;
    cin>>N;
    vector<long>A(N);
    REP(i,N)cin>>A[i];
    SORT(A);
    deque<long> deq;
    int cnts=0,cntl=1;
    deq.push_front(A[0]);cnts++;
    bool flag=false;
    while(SZ(deq)<N){
        if(flag){
            deq.push_back(A[cnts]);cnts++;
            if(SZ(deq)==N)break;
            deq.push_front(A[cnts]);cnts++;
            if(SZ(deq)==N)break;
            flag=false;
        }else{
            deq.push_back(A[N-cntl]);cntl++;
            if(SZ(deq)==N)break;
            deq.push_front(A[N-cntl]);cntl++;
            if(SZ(deq)==N)break;
            flag=true;
        }
    }
    vector<long>B;
    for(auto itr = deq.begin(); itr != deq.end(); ++itr) {
        B.PB(*itr);
        //cout<<*itr<<" ";
    }
    //cout<<endl;
    long sum1=0;
    FOR(i,1,N)sum1+=abs(B[i]-B[i-1]);
    deq.clear();
    sort(A.begin(),A.end(),greater<long>());
    cnts=0,cntl=1;
    deq.push_front(A[0]);cnts++;
    flag=false;
    while(SZ(deq)<N){
        if(flag){
            deq.push_back(A[cnts]);cnts++;
            if(SZ(deq)==N)break;
            deq.push_front(A[cnts]);cnts++;
            if(SZ(deq)==N)break;
            flag=false;
        }else{
            deq.push_back(A[N-cntl]);cntl++;
            if(SZ(deq)==N)break;
            deq.push_front(A[N-cntl]);cntl++;
            if(SZ(deq)==N)break;
            flag=true;
        }
    }
    vector<long>C;
    for(auto itr = deq.begin(); itr != deq.end(); ++itr) {
        C.PB(*itr);
        //cout<<*itr<<" ";
    }
    //cout<<endl;
    long sum2=0;
    FOR(i,1,N)sum2+=abs(C[i]-C[i-1]);
    cout<<max(sum1,sum2)<<endl;
    return 0;
}

Measured memory_bytes: 4216
#include <bits/stdc++.h>
#include<math.h>
typedef long long ll;
using namespace std;
vector<vector<int>>comp;
vector<int>onecycle;
vector<int>clength;
vector<int>v9;
vector<int>v8;
int cycle_start;
int cycle_end;
vector<int>vbip1;
vector<int>vbip2;
#define FIO  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
int main()
{
    int n,k;
    cin>>n>>k;
    int dp[n+1];
    dp[0]=0;
    int i;
    ll sum=0;
    int h[n];
    for(i=0;i<n;i++)
    {
        cin>>h[i];
        dp[i+1]=INT_MAX;
    }
    dp[1]=0;
    dp[0]=0;
    for(i=1;i<=n;i++)
    {
        for(int j=1;j<=k;j++)
        {
            if(i-(j+1)>=0)
            {
                dp[i]=min(dp[i-j]+max(h[i-1]-h[i-j-1],h[i-j-1]-h[i-1]),dp[i]);
            }
        }
    }
    cout<<dp[n];
    
}


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

int main(){
    string s, t;
    cin >> s >> t;

    int n = s.length();

    bool doubling = false;
    map<char,char> ma, mb;

    for(int i = 0; i < n; i++){
        if(ma.count(s[i]) && ma[s[i]] != t[i]){
            doubling = true;
            break;
        }else{
            ma[s[i]] = t[i];
        }
        if(mb.count(t[i]) && mb[t[i]] != s[i]){
            doubling = true;
            break;
        }else{
            mb[t[i]] = s[i];
        }
    }

    if(doubling)    cout << "No" << endl;
    else            cout << "Yes" << endl;

    return 0;
}


Measured memory_bytes: 776
#![allow(unused_imports)]

use std::{i32, i64, u32, u64, usize, f64};
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::io::{stdout, Write, BufWriter};
use std::mem::{swap};
use maplit::*;
use proconio::marker::{Isize1, Usize1, Bytes, Chars};

#[proconio::fastout]
fn main() {
    proconio::input!{
        n: usize,
        c: usize,
        k: i64,
        mut ts: [i64; n],
    }
    ts.sort();
    let mut ans = 0;
    let mut i = 0usize;
    let mut m = 0;
    while m < n {
        let psgs = min(c, ts[i..].iter().copied().position(|t| t > ts[i] + k).unwrap_or(n - i));
        i += psgs;
        m += psgs;
        ans += 1;
    }
    println!("{}", ans);
}


Measured memory_bytes: 4264
//C++14 (Clang 3.8.0)

#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <string>
#include <climits>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const int maxn=200003;
int n,m;
int d[maxn];
vector<int> g[maxn];
int inf=maxn+5;
void dfs(int s){
  fill(d,d+maxn,inf);
  d[s]=0;
  priority_queue< P,vector<P>,greater<P> > que;
  que.push(P(0,s));
  while(!que.empty()){
    P p=que.top();que.pop();
    int v=p.second;
    if(d[v]<p.first)continue;
    for(int i=0;i<g[v].size();i++){
      int e=g[v][i];
      if(d[e]>d[v]+1){
        d[e]=d[v]+1;
        que.push(P(d[e],e));
      }
    } 
  }
}
int main(){
  cin>>n>>m;
  for(int i=0;i<m;i++){
    int a,b;
    cin>>a>>b;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  fill(d,d+maxn,-1);
  dfs(1);
  if(d[n]<3)cout<<"POSSIBLE"<<endl;
  else cout<<"IMPOSSIBLE"<<endl;

  return 0;
}


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

#define ALL(a) begin(a),end(a)
#define COUNTOF(a) (sizeof(a)/sizeof(a[0]))
#define SP << " " <<
#define FMT(a) #a<<":"<<a 
#define FMT2(a,b) #a<<":"<<a<<", "<<#b<<":"<<b 
#define FMT3(a,b,c) #a<<":"<<a<<", "<<#b<<":"<<b<<", "<<#c<<":"<<c 
#define FMT4(a,b,c,d) #a<<":"<<a<<", "<<#b<<":"<<b<<", "<<#c<<":"<<c<<", "<<#d<<":"<<d 
typedef long long ll;
template<class T> istream& operator >> (istream& s, vector<T>& v) {
  for (T& x: v) s >> x;
  return s;
}
inline void Yes(bool f=true){cout<<(f?"Yes":"No")<<endl;}
inline void YES(bool f=true){cout<<(f?"YES":"NO")<<endl;}

int main()
{
    cin.tie(0); ios::sync_with_stdio(false);
    //cout<<std::fixed<<std::setprecision(10);

    int a; cin >> a;
    string s; cin >> s;
    
    cout << (a>=3200?s:"red") << endl;
}


Measured memory_bytes: 256
#!/usr/bin/env python3

from pprint import pprint
import copy
import sys

sys.setrecursionlimit(10 ** 6)
INF = float('inf')


H, W, K = map(int, input().split())
field = []
for _ in range(H):
    line = list(input())
    field.append(line)
# pprint(field)


def calc(field_copy):
    res = 0
    for i in range(H):
        for j in range(W):
            if field_copy[i][j] == '#':
                res += 1
    return res


res = 0
for row in range(2 ** H):
    for col in range(2 ** W):
        field_copy = copy.deepcopy(field)
        for i_row in range(H):
            if row & (1 << i_row):
                for j_col in range(W):
                    field_copy[i_row][j_col] = '_'
        for i_col in range(W):
            if col & (1 << i_col):
                for j_row in range(H):
                    field_copy[j_row][i_col] = '_'
        if calc(field_copy) == K:
            res += 1

print(res)



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

using namespace std;

class RSQ{
public:
  int n;
  vector<int> d;

  RSQ(int size){
    initRSQ(size);
  }

  void initRSQ(int size){
    n = 1;
    //the size of array is power of 2
    while(n < size) n *= 2;
    //initialize all node in the segment tree
    d.resize(2*n, 0);
  }

  void add(int i, int x){
    d[i] += x;
  }

  int getSum(int s, int t){
    if(s == t) return d[s];

    int sum = 0;
    for(int i=s ; i<=t ; ++i){
      sum += d[i];
    }
    return sum;
  }
};

int main(){
  int n, q;
  int com, x, y;
  cin >> n >> q;
  RSQ rsq(n);

  for(int i=0 ; i<q ; ++i){
    cin >> com >> x >> y;
    x--;
    if(com == 0) rsq.add(x, y);
    else if(com == 1){
      y--;
      cout << rsq.getSum(x, y) << endl;
    }
  }
}



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

int main()
{
	int N;
	cin >> N;
	vector<string> s( N );
	for( int i = 0; i < N; i++ ) {
		cin >> s[i];
	}

	long long anum = 0;
	long long bnum = 0;
	long long abnum = 0;
	long long num = 0;
	for( int i = 0; i < N; i++ ) {
		if( s[i][0] == 'B' && s[i][s[i].size() - 1] == 'A' ) abnum++;
		else if( s[i][0] == 'B' ) bnum++;
		else if( s[i][s[i].size() - 1] == 'A' ) anum++;
		int n = 0;
		while( 1 ) {
			n  = s[i].find( "AB", n );
			if( n == string::npos ) break;
			num++;
			n += 2;
		}
	}
	long long ans = num;
	if( abnum == 0 ) {
		ans += min( anum, bnum );
	}
	else if( abnum && anum && bnum ) {
		anum--;
		bnum--;
		ans += abnum + 1 + min( anum, bnum );
	}
	else if( abnum && anum || bnum ) {
		if( anum > bnum ) anum--;
		else bnum--;
		ans += abnum + min( anum, bnum );
	}
	else if( abnum > 1 ) {
		ans += abnum - 1;
	}

	cout << ans << endl;
}


Measured memory_bytes: 3660
#include<stdio.h>
#include<stdbool.h>

void solve(int w,int h);

int main(void){
  int w,h;
  while(scanf("%d%d",&w,&h) && w && h){
    solve(w,h);
  }
  return 0;
}

void solve(int w,int h){
  unsigned short map[52][52];
  struct q{
    short ii,jj;
  }next[2500];
  int i,j,k,di,dj;
  int q_num,island;
  bool flg=true;

  for(i=0;i<52;i++) for(j=0;j<52;j++) map[i][j]=0;

  for(i=1;i<=h;i++) for(j=1;j<=w;j++) scanf("%hu",&map[i][j]);

  for(island=2;flg;island++){
    flg=false;
    for(i=1;i<=h && !flg ;i++)
      for(j=1;j<=w && !flg;j++) if(map[i][j]==1) flg=true;
    if(!flg) continue;

    next[0]=(struct q){i-1,j-1};
    map[i-1][j-1]=island;

    for(q_num=1,i=0;i<q_num;i++){
      for(di=-1;di<=1;di++){
	for(dj=-1;dj<=1;dj++){
	  if(map[next[i].ii+di][next[i].jj+dj]==1){
	    next[q_num++]=(struct q){next[i].ii+di,next[i].jj+dj};
	    map[next[i].ii+di][next[i].jj+dj]=island;
	  }
	}
      }
    }
  }
  printf("%d\n",island-3);
}

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

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<vvd> vvvd;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
typedef long long LL;
#define REP(i,s,N) for (int i=s; i<N; i++)

int main() {
	LL a, b, x;
	cin >> a >> b >> x;
	if(a%x==0) {
		cout << b/x-a/x+1 << endl;
	}
	else {
		cout << b/x-a/x << endl;
	}
}

Measured memory_bytes: 256
//	Id:lys2002
//	Time:2020/8/7 15:24
#include<bits/stdc++.h>
using namespace std;

#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--)

typedef double db;
typedef long long ll;

const ll md=1000000007;

inline void Fio(){
	freopen("1.in","r",stdin);
	freopen("1.out","w",stdout);
}
map <string,int> mp;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin>>n;
    string str;
    rep(i,0,n){
        cin>>str;
        if(!mp.count(str))
                mp[str]=0;
        mp[str]++;
    }
    cout<<"AC x "<<mp["AC"]<<endl;
    cout<<"WA x "<<mp["WA"]<<endl;
    cout<<"TLE x "<<mp["TLE"]<<endl;
    cout<<"RE x "<<mp["RE"]<<endl;
    return 0;
  }


Measured memory_bytes: 3624
#include<stdio.h>
int main()
{
	int max,min,a,b,c,d,time;
	while(scanf("%d%d%d%d",&a,&b,&c,&d)==4)
	{
		if(a<c) max=c;else max=a;
		if(b<d) min=b;else min=d;
		time=min-max;
		if(time<=0) time=0;
		printf("%d\n",time);
	}
} 

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

using namespace std;
using ll = long long;

const ll md = 998244353;

namespace mod {

template <class T, int M>
class MInt;

template <class T, int M>
MInt<T, M> Pow(const MInt<T, M> &base, T exp);

template <class T, int M>
MInt<T, M> Inv(const MInt<T, M> &n);

template <class T, int M>
class MInt {
  T n_;

 public:
  MInt() : n_(0) {}
  MInt(T n) : n_((n % M + M) % M) {}

  MInt &operator+=(const MInt &rhs) {
    n_ += rhs.n_;
    if (n_ >= M) {
      n_ -= M;
    }

    return *this;
  }

  MInt &operator-=(const MInt &rhs) {
    n_ += M - rhs.n_;
    if (n_ >= M) {
      n_ -= M;
    }

    return *this;
  }

  MInt &operator*=(const MInt &rhs) {
    n_ = n_ * rhs.n_ % M;
    return *this;
  }

  MInt &operator/=(const MInt &rhs) { return (*this) *= Inv(rhs); }

  T Get() { return n_; }
};

template <class T, int M>
MInt<T, M> operator-(const MInt<T, M> &lhs, const MInt<T, M> &rhs) {
  MInt<T, M> res(lhs);
  return res -= rhs;
}

template <class T, int M>
MInt<T, M> operator+(const MInt<T, M> &lhs, const MInt<T, M> &rhs) {
  MInt<T, M> res(lhs);
  return res += rhs;
}

template <class T, int M>
MInt<T, M> operator*(const MInt<T, M> &lhs, const MInt<T, M> &rhs) {
  MInt<T, M> res(lhs);
  return res *= rhs;
}

template <class T, int M>
MInt<T, M> operator/(const MInt<T, M> &lhs, const MInt<T, M> &rhs) {
  MInt<T, M> res(lhs);
  return res /= rhs;
}

template <class T, int M>
MInt<T, M> Pow(const MInt<T, M> &base, T exp) {
  if (exp == 0) {
    return 1;
  }

  auto a = Pow(base, exp / 2);
  a *= a;
  if (exp % 2 == 1) {
    a *= base;
  }

  return a;
}

template <class T, int M>
MInt<T, M> Inv(const MInt<T, M> &n) {
  return Pow(n, static_cast<T>(M - 2));
}
}  // namespace mod

using MInt = mod::MInt<long long, md>;

int main(int argc, const char *argv[]) {
  int n, k;
  cin >> n >> k;

  vector<pair<int, int>> vp(k);
  for (auto &p : vp) {
    cin >> p.first >> p.second;
  }

  vector<MInt> dp(n);
  dp[0] = 1 % md;
  dp[1] = -1 % md;
  for (int i = 0; i < n; ++i) {
    if (i != 0) {
      dp[i] += dp[i - 1];
    }

    for (auto &p : vp) {
      if (i + p.first < dp.size()) {
        dp[i + p.first] += dp[i];
      }

      if (i + p.second + 1 < dp.size()) {
        dp[i + p.second + 1] -= dp[i];
      }
    }
  }

  cout << dp.back().Get() << '\n';

  return 0;
}

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

#define ll long long
#define Fi first
#define Se second
#define Pb push_back
#define vi vector<int>
#define vp vector<pair<int,int>>
#define vvi vector<vector<int>>
#define vvp vector<vector<pair<int,int>>>

const int INF = 1e9;
const int MOD = 1e9+7;
using Graph = vector<vector<int>>; //Caution!! Segmentation Fault!! Don't forget to add +1!

#define all(v) v.begin(),v.end()
#define output_s(a) printf("%s",(a).c_str())

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define Rep(i,n,m) for(int i=(int)(n);i<(int)(m);i++)
#define RepS(i,n,m) for(int i=(int)(n);i<=(int)(m);i++)
#define RRepS(i,n,m) for(int i=(int)(n);i>=(int)(m);i--)
#define RepA(x) for(auto &item:(x))

void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail){
    cin>>head;
    CINT(move(tail)...);
}    
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)

template<typename TypeInt> //最大公約数
TypeInt GCD(TypeInt a,TypeInt b){
    if(a%b==0) return b;
    else return GCD(b,a%b);
}
template<typename TypeInt> //最小公倍数
TypeInt LCM(TypeInt a,TypeInt b){
    return a*b/GCD(a,b);
}

int IN_int(){
    int x;
    scanf("%d",&x);
    return x;
}

//library----------------------------------------------

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

const int NMAX = 25;
bool flag;


int main(){
    CIN(H,W);
    vector<string> field(H);
    rep(i,H) cin>>field[i];

    rep(i,W+2) printf("#");
    printf("\n");
    rep(i,H){
        printf("#");
        output_s(field[i]);
        printf("#\n");
    }
    rep(i,W+2) printf("#");
    printf("\n");

    return 0;
}

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

int N, L[100], SE[100], dp[100][1 << 16];

int solve(int i, int bit)
{
  if (i >= N)
    return 0;

  if (dp[i][bit] != -1)
    return dp[i][bit];

  int ret = 0;
  if ((SE[i] & bit) == 0)
    ret = max(ret, solve(i+1, bit | SE[i]) + L[i]);
  ret = max(ret, solve(i+1, bit));
  return dp[i][bit] = ret;
}

int main()
{
  while (cin >> N) {
    if (N == 0)
      break;

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

      SE[i] = 0;
      for (int j = 0; j < M; ++j) {
	int S, E;
	cin >> S >> E;
	for (int k = S-6; k < E-6; ++k)
	  SE[i] |= 1 << k;
      }
    }

    memset(dp, -1, sizeof(dp));
    cout << solve(0, 0) << endl;
  }
  return 0;
}

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

#define INF 1000000007
#define LINF 1000000000000000007

using namespace std;

typedef long long Int;
typedef pair<Int, Int> P;

Int gcd(Int x, Int y){
	if(y == 0)
		return x;
	return gcd(y, x % y);
}

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

bool sosuu(int x){
	bool b = 1;
	if(x == 1) b = 0;
	for(int i = 2; i * i <= x; i++){
		if(x % i == 0) {
			b = 0;
			break;
		}
	}
	return b;
}

int n, d, x, a[100];

int main(){
	cin >> n >> d >> x;
	int cnt = 0;
	for(int i = 0; i < n; i++){
		cin >> a[i];
		cnt += (d-1) / a[i] + 1;
	}
	
	cout << cnt + x << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int t,d,s,e;
    cin>>d>>t>>s;
    if(d%s==0)
    {
        e=d/s;
    }
    else
    {
        e=d/s;
        e++;
    }
    if(e<=t)
    {
        cout<<"Yes"<<endl;
    }
    else
    {

        cout<<"No"<<endl;
    }

}


Measured memory_bytes: 3580
#include<bits/stdc++.h>
#define rep(i,n) for(int (i) = 0;(i) < (n);(i)++)
#define SORT(c) sort((c).begin(),(c).end())
#define MOD 1000000007 //S(vector).size()
using namespace std;
typedef long long ll;

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

	map<int, int> a1, b1;
	int num, maxVa = -MOD, maxIte_a, maxIte_b;
	int cnt = 0;
	for(int i = 0; i < n; i += 2){
		a1[v[i]]++;
	}
	for(int i = 1; i < n; i += 2){
		b1[v[i]]++;
	}
	//奇数番目の処理
	for(int i = 1; i <= 100005; i++){
		if(a1[i] > maxVa){
			maxVa = a1[i];
			maxIte_a = i;
		}
	}
	for(int i = 0; i < n; i += 2){
		if(v[i] != maxIte_a) cnt++;
	}

	//偶数番目の処理
	maxVa = -MOD;
	for(int i = 1; i <= 100005; i++){
		if(b1[i] > maxVa && i != maxIte_a){
			maxVa = b1[i];
			maxIte_b = i;
		}
	}
	for(int i = 1; i < n; i += 2){
		if(v[i] != maxIte_b) cnt++;
	}



	int cnt2 = 0;
	map<int, int> a2, b2;
	for(int i = 0; i < n; i += 2){
		a2[v[i]]++;
	}
	for(int i = 1; i < n; i += 2){
		b2[v[i]]++;
	}


	//偶数番目の処理
	maxVa = -MOD;
	for(int i = 1; i <= 100005; i++){
		if(b2[i] > maxVa){
			maxVa = b2[i];
			maxIte_b = i;
		}
	}
	for(int i = 1; i < n; i += 2){
		if(v[i] != maxIte_b) cnt2++;
	}
	//奇数番目の処理
	maxVa = -MOD;
	for(int i = 1; i <= 100005; i++){
		if(a2[i] > maxVa && i != maxIte_b){
			maxVa = a2[i];
			maxIte_a = i;
		}
	}
	for(int i = 0; i < n; i += 2){
		if(v[i] != maxIte_a) cnt2++;
	}
	cout << min(cnt, cnt2) << endl;

	return 0;
}


Measured memory_bytes: 19456
# -*- coding: utf-8 -*-
"""
Created on Sat Aug 11 14:44:47 2018
ABC046C
@author: maezawa
"""
import math
n = int(input())
tp = 1
ap = 1
for i in range(n):
    ti, ai = list(map(int, input().split()))
    #nit = math.ceil(tp/ti)
    #nia = math.ceil(ap/ai)
    nit = -tp//ti
    nia = -ap//ai
    ni = max(-nit, -nia)
    vi = ni*(ti+ai)
    #print(ni, vi)
    tp = ni*ti
    ap = ni*ai

print(vi)

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

int main()
{
	int  x, y;
	
	for (int i = 0; i < 3000; i++) {
		cin >> x >> y;
		if (x > 0 || y > 0) {
			if (x > y) {
				swap(x, y);
			}

			cout << x << ' ' << y << '\n';
		}
		else if (x == 0 && y == 0) {
			break;
		}
	}

	
	


	return 0;
}

Measured memory_bytes: 3048
/*
[agc033] C - Removing Coins
*/

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;

const int MAX_N = 2e5;

int N;
vector<int> g[MAX_N];

// pii<distance, v>
pii dfs(int v, int par = -1) {
    pii r = {0, v};
    for (int to : g[v]) {
        if (to == par) {
            continue;
        }
        pii t = dfs(to, v);
        t.first += 1;
        if (t.first > r.first) {
            r = t;
        }
    }
    return r;
}

int diameter() {
    pii s = dfs(0);
    pii t = dfs(s.second);
    return t.first;
}

bool solve() { return diameter() % 3 != 1; }

int main() {
    cin >> N;
    for (int i = 0; i < N - 1; i++) {
        int a, b;
        cin >> a >> b;
        g[a - 1].push_back(b - 1);
        g[b - 1].push_back(a - 1);
    }

    cout << (solve() ? "First" : "Second") << endl;

    return 0;
}


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

int main(){
  int H,W;
  cin >> H >> W;
  vector<vector<char>> a(H,vector<char> (W));
  vector<vector<char>> b(H+2,vector<char> (W+2,'#'));
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      cin >> a.at(i).at(j);
      b.at(i+1).at(j+1) = a.at(i).at(j);
    }
  }
  for(int i=0;i<H+2;i++){
    for(int j=0;j<W+2;j++){
      cout << b.at(i).at(j);
      if(j==W+1)
        cout << endl;
    }
  }
  
  
  
  
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <iomanip>
#include <cstdio>
#include <cassert>
#include <algorithm>
#include <iterator>
#include <string>
#include <vector>
#include <list>
#include <deque>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <tuple>
#include <queue>
#include <stack>
#include <functional>
#include <utility>
#include <complex>
#include <bitset>
#include <numeric>
#include <random>
using namespace std;

#define REP(i,n) for(int (i)=0; (i)<(n) ;++(i))
#define REPN(i,a,n) FOR((i),(a),(a)+(n))
#define FOR(i,a,b) for(int (i)=(a); (i)<(b) ;++(i))
#define PB push_back
#define MP make_pair
#define SE second
#define FI first
#define DBG(a) cerr<<(a)<<endl;
#define ALL(v) (v).begin(),(v).end()
typedef long long LL;  typedef pair<LL, LL> PLL; typedef vector<LL> VLL;
typedef pair<int,int>PI; typedef vector<int> VI;
const LL LINF=334ll<<53; const int INF=15<<26; const LL MOD=1E9+7;
long long modpow(long long a, long long n){
    if(n==0) return 1;
    long long re=modpow((a*a)%MOD,n/2)%MOD;
    if(n%2==1) re= (re*a)%MOD;
    return re;
}
LL dp[3003][3003];
inline LL inv(LL a, LL b){return a*modpow(b,MOD-2)%MOD;}
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,m;
    int cnt[3003]={},l[3003]={},u[3003]={};
    cin >> n >> m;
    string s;
    cin >> s;

    cnt[1]=(s[0]=='1'?1:0);
    FOR(i,2,n+1){
        cnt[i]=cnt[i-1]+(s[i-1]=='1'?1:0);
    }
    FOR(i,0,n+1)l[i]=u[i]=cnt[i];

    vector<PI> q;
    q.push_back({0,0});
    REP(i,m){
        int a,b;
        cin >> a>>b;
        q.push_back({a,b});
    }

    for(auto it= q.begin()+1;it<q.end();){
        if(it->second<=(it-1)->second){
            it=q.erase(it);
        }else{
            it++;
        }
    }
    for(auto it= q.begin();it<q.end()-1;){
        if(it->first==(it+1)->first){
            it=q.erase(it);
        }else{
            it++;
        }
    }

    q.insert(q.begin(),{0,0});
    FOR(i,1,q.size()){
        int f=cnt[q[i].second]-l[q[i].first-1];
        FOR(j,q[i].first,q[i].second+1){
            l[j]=l[q[i].first-1]+max(0,f-q[i].second+j);
            u[j]=min(cnt[q[i].second],u[q[i].first-1]+j-q[i].first+1);
        }
    }
    dp[0][0]=1;
    FOR(i,1,n+1){
        FOR(j,l[i],u[i]+1){
            dp[i][j]=(dp[i-1][j]+(j==0?0:dp[i-1][j-1]))%MOD;
            //cout << i << j << dp[i][j]<<endl;
        }
    }
    cout << dp[n][cnt[n]]<<endl;

    return 0;
}


Measured memory_bytes: 12800
using System;

namespace abc160_a
{
    class Program
    {
        static void Main(string[] args)
        {
            string str = Console.ReadLine();
            if(str[2]== str[3])
            {
                if (str[4] == str[5])
                {
                    Console.WriteLine("Yes");
                }
                else
                {
                    Console.WriteLine("No");
                }
            }
            else
            {
                Console.WriteLine("No");
            }
        }
    }
}


Measured memory_bytes: 13140
#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>
#include <bitset>
#include <map>
#include <vector>
#include <cstdlib>
#include <stack>
#include <queue>
#include <list>
#include <set>

#define llong long long int

using namespace std;

int main(int argc, char *argv[]) {
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n, k;
    cin >> n >> k;
    llong h[100001];
    for (int i = 0; i < n; ++i) {
        cin >> h[i];
    }
    sort(h, h + n);
    llong ans = 100000000000000000;
    for (int i = 0; i <= n - k; ++i) {
        llong tmp = abs(h[i] - h[i + k - 1]);
        if (tmp <= ans) ans = tmp;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1024
defmodule Main do
  def main do
    s = IO.read(:line) |> String.trim |> String.to_charlist |> Enum.sort(:asc)
    t = IO.read(:line) |> String.trim |> String.to_charlist |> Enum.sort(:desc)
    if t > s do
      IO.puts("Yes")
    else
      IO.puts("No")
    end
  end
end


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

struct edge {int /*from**/to,cost;};
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> VI;
typedef vector<long long int> VL;
typedef vector<edge> VE;
//static const int INF = 2147483647;
//static const long long INf = 9223372000000000000;
//static const long long INF = 9223372000000000000/2;
static const int INF = 1000010000;
static const int NIL = -1;
static const int MOD = 1000000007;
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define np next_permutation
#define pq priority_queue
#define itn int
#define scnaf scanf
#define reutnr return
#define scamf scanf
//int dx4[4] = {0,1,0,-1}, dy4[4] = {-1,0,1,0};
//int dx5[5] = {-1,0,0,0,1}, dy5[5] = {0,-1,0,1,0};
//int dx8[8] = {-1,0,1,1,1,0,-1,-1}, dy8[8] = {1,1,1,0,-1,-1,-1,0};
//int dx9[9] = {-1,0,1,1,1,0,-1,-1,0}, dy9[9] = {1,1,1,0,-1,-1,-1,0,0};
//#define int ll

signed main(){
    int a,b;
    scanf("%d%d",&a,&b);
    int c = b - a;
    printf("%d\n",b+c);
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    int x,y;
    cin>>x>>y;
    int total=4*x;
    int t1=(total-y);
    if(y>=2*x && y<=4*x && y%2==0)
    {
        t1/=2;
        int t2=x-t1;
        if(t1>=0 && t2>=0)
        {
            cout<<"Yes";
        }
        else
        {
            cout<<"No";
        }
    }
    else
    {
        cout<<"No";
    }
  	return 0;
}







Measured memory_bytes: 3592
#include<iostream>
using namespace std;
int main(){
    int card[3];
    int kazu;
    for(int a=0;a<=2;a++){
        cin >> card[a];
    }
    cin >> kazu;
    for(int n=1;n<=kazu;n++){
        if(card[0]>=card[1]){
            card[1]=card[1]*2;
            continue;
        }else if(card[1]>=card[2]){
            card[2]=card[2]*2;
            continue;
        }
    }
    if(card[0]<card[1]&&card[1]<card[2]){
        cout << "Yes";
    }else{
        cout << "No";
    }
    return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define reps(i, n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
#define rrep(i, n) for(int i=((int)(n)-1); i>=0; --i)
#define rreps(i, n) for(int i=((int)(n)); i>0; --i)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((int)(x).size())
#define pl(s) cout << (s) << "\n";
#define pls(...) {bool space = false; for(auto i : __VA_ARGS__) (cout << (space?" ":"") << i), space = true; cout << "\n";}
#define plexit(s) {cout << (s) << "\n"; exit(0);}
#define yes(s) cout << ((s)?"Yes":"No") << "\n";
template<typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using ll = long long; using ull = unsigned long long; using ld = long double;
template<typename T = int> using V = vector<T>; template<typename T = int> using P = pair<T, T>;
using Vi = V<int>; using Vl = V<ll>; using Vd = V<ld>; using VVi = V<Vi>; using VVl = V<Vl>; using Pi = P<int>; using Pl = P<ll>; using Pd = P<ld>;
constexpr ll MOD = 1000000007; constexpr int INF = (1 << 30) - 1; constexpr ll INFL = 1LL << 60; constexpr ld EPS = 1e-12; constexpr ld PI = 3.141592653589793238462643383279;

int main(void) {
  int n; cin >> n;
  Vi a(n); rep(i,n) { cin >> a[i]; --a[i];}
  int nx = 0;
  int loop = 0;
  int ans = 0;
  while(1) {
    ++ans;
    nx = a[nx];
    if (nx == 1) plexit(ans)
    if (ans > n) plexit(-1)
  }
  return 0;
}


Measured memory_bytes: 3940
#pragma GCC optimize ("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse4")
#include"bits/stdc++.h"
using namespace std;
typedef long long ll;
#define int ll
#define sz(x) (int)(x).size();
#define all(x) x.begin(), x.end()
#define trav(i,a) for(auto &i:a) 
inline int in(){int x;scanf("%lld",&x);return x;}
int32_t main()
{
	string s,t;
	cin>>s>>t;
	int a=0;
	for(int i=0;i<s.length();i++)if(s[i]!=t[i])a++;
	cout<<a;
	
}

Measured memory_bytes: 3808
A, B = (int(x) for x in input().split())

yes = 0
no = 0
for tax_free in range(1,1011):
    if A == int(tax_free*0.08) and B == int(tax_free*0.1):
        yes += 1
        if yes == 1: Z = tax_free
        else: pass
    else:
        no += 1

if no == 1010: print(-1)
else: print(Z)

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

int main()
{
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  vector<int> b(n);
  for (int i = 0; i < n; ++i) {
    cin >> b[i];
  }
  vector<int> sol;
  while (!b.empty()) {
    bool found = false;
    for (int i = b.size() - 1; i >= 0; --i) {
      if (b[i] == i + 1) {
        sol.push_back(b[i]);
        b.erase(b.begin() + i);
        found = true;
        break;
      }
    }
    if (!found) {
      cout << -1 << endl;
      return 0;
    }
  }
  reverse(sol.begin(), sol.end());
  for (int i : sol) {
    cout << i << '\n';
  }
  return 0;
}


Measured memory_bytes: 256
'use strict'

const main = input => {
	const args = input.split('\n').map(arg => arg.split(' '))

	const t = {
		a: args[0][0].split(''),
		b: args[1][0].split(''),
		c: args[2][0].split('')
	}

	let next = 'a'

	while (true) {
		if (t[next].length === 0) break
		next = t[next].shift()
	}

	console.log(next.toUpperCase())
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'))


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

const int MAXN = 55;
long long dp[MAXN][MAXN * MAXN];
int n, A, a[MAXN];

int main() {
	cin >> n >> A;
	for (int i = 0; i < n; i++)
		cin >> a[i];
	dp[0][0] = 1;
	for (int t = 0; t < n; t++)
		for (int j = MAXN * MAXN - 1; j >= 0; j--)
			for (int i = MAXN - 1; i >= 1; i--)
				if (j - a[t] >= 0)
					dp[i][j] += dp[i - 1][j - a[t]];
	long long ans = 0;
	for (int i = 1; i <= n; i++)
		ans += dp[i][i * A];
	cout << ans;
}

Measured memory_bytes: 1536