akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>
#include<iostream>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<map>
#include<algorithm>

using namespace std;

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

    if (b % a == 0) {
        cout << a + b << endl;
    } else {
        cout << b - a << endl;
    }
}


Measured memory_bytes: 256
/// Kazuki Hoshino


#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
#define inf 1000000000
#define mod 1000000007
#define rep(i,a,b) for (int i = a; i <= b; i++)
#define rep1(i, a, b) for(int i =a; i >=b; i--)
#define dmp(x) cerr<<"line "<<__LINE__<<" "<<#x<<":"<<x<<endl
#define fs first
#define sc second
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define mt make_tuple
//#define endl '\n'
typedef tree<
int,
null_type,less<int>,
rb_tree_tag,tree_order_statistics_node_update>
ordered_set;
int n,x,a[202020],ans,sum[202020], fac[202020];
signed main(){
ios::sync_with_stdio(0);
cin.tie(0);
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
cin >> n >> x;
for(int i=1;i<=n;i++){
    cin >> a[i];
}
reverse(a+1,a+n+1);
for(int i=1;i<=n;i++){
    sum[i]=sum[i-1]+a[i];
}
for(int i=1;i<=n;i++){
    if(i==1)fac[i]=5;
    else 
    fac[i]=2*i + 1;
}
ans = 1e18;
for(int i=1;i<=n;i++){
    int cur = i*x;
    for(int j=0;j<n;j+=i){
        int pre = sum[min(n,j+i)]-sum[j];
        if(fac[j/i]>ans/pre){
            cur = ans;
            break;
        }
        cur+= pre*fac[(j+i)/i];
        if(cur>ans)break;
    }
    ans = min(ans,cur);
}
cout << ans+n*x << endl;
return 0;
}
///....


Measured memory_bytes: 4992
#[allow(unused_imports)]
use std::cmp::{max, min};
use std::collections::BTreeMap;
#[allow(unused_imports)]
use std::io::{stdin, stdout, Read, Write};
use std::str::FromStr;

#[derive(Default)]
struct Scanner<R: Read> {
    reader: R,
}

impl<R: Read> Scanner<R> {
    fn new(reader: R) -> Scanner<R> {
        Scanner { reader }
    }

    fn scan<T: FromStr>(&mut self) -> Option<T> {
        let s = self
            .reader
            .by_ref()
            .bytes()
            .map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        s.parse::<T>().ok()
    }

    fn next<T: FromStr>(&mut self) -> T {
        if let Some(s) = self.scan() {
            s
        } else {
            std::process::exit(1);
        }
    }
}

fn partition(a: &mut [Card], p: usize, r: usize) -> usize {
    let x = a[r].v;
    let mut i = p;
    for j in p..r {
        if a[j].v <= x {
            a.swap(i, j);
            i += 1;
        }
    }
    a.swap(i, r);
    i
}

fn quicksort(a: &mut [Card], p: usize, r: usize) {
    if p < r {
        let q = partition(a, p, r);
        quicksort(a, p, q - 1);
        quicksort(a, q, r);
    }
}

struct Card {
    suit: char,
    v: i32,
}

fn main() {
    let cin = stdin();
    let cin = cin.lock();
    let mut sc = Scanner::new(cin);
    let out = stdout();
    let mut out = out.lock();

    let n = sc.next();
    let mut a = Vec::new();
    let mut map = BTreeMap::<i32, Vec<char>>::new();
    for _ in 0..n {
        let s: String = sc.next();
        let suit = s.chars().next().unwrap();
        let v = sc.next();
        let c = Card { suit, v };
        a.push(c);

        if !map.contains_key(&v) {
            map.insert(v, Vec::new());
        }
        map.get_mut(&v).unwrap().push(suit);
    }

    quicksort(&mut a[..], 0, n - 1);
    let mut i = 0;
    'outer: for (_, v) in map.iter() {
        for s in v.iter() {
            if a[i].suit != *s {
                break 'outer;
            }
            i += 1;
        }
    }
    if i == n {
        writeln!(out, "Stable").ok();
    } else {
        writeln!(out, "Not stable").ok();
    }
    for i in 0..n {
        writeln!(out, "{} {}", a[i].suit, a[i].v).ok();
    }
}



Measured memory_bytes: 7104
#include <bits/stdc++.h>
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define ll long long
#define mod 1000000007
#define INF (ll)1e19
#define N 2000006

using namespace std;

int n, k, a[N], b[N];
map<int, int> m;

int main() {
    //freopen("txt.in", "r", stdin);
    //freopen("txt.out", "w", stdout);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cin >> n;
    for (int i = 1; i <= n; i++)
        cin >> a[i], m[a[i]]++;
    cin >> k;
    for (int i = 1; i <= k; i++) {
        cin >> b[i];
        if (!m[b[i]]) {
            cout <<"NO" << endl;
            return 0;
        }
        m[b[i]]--;
    }
    cout << "YES" << endl;

	return 0;
}


Measured memory_bytes: 14464
#include <bits/stdc++.h>
#define fst first
#define snd second
#define rep(n) for(lint I = 0; (I) < (lint)(n); ++(I))
#define repeat(i, n) for(lint i = 0; (i) < (lint)(n); ++(i))
#define repeat_to(i, n) for(lint i = 0; (i) <= (lint)(n); ++(i))
#define repeat_from(i, m, n) for(lint i = (m); (i) < (lint)(n); ++(i))
#define repeat_from_to(i, m, n) for(lint i = (m); (i) <= (lint)(n); ++(i))
#define repeat_reverse_from_to(i, m, n) for(lint i = (m); (i) >= (lint)(n); --(i))
#define el cout<<endl
#define dump(x) cout<<" "<<#x<<"="<<x
#define vdump(v) for(size_t I=0; I<v.size(); ++I){cout<<" "<<#v<<"["<<I<<"]="<<v[I];} cout<<endl
using namespace std;
using lint = long long;
using ld = long double;

int main(void) {
    int k, n;
    cin >> k >> n;
    
    auto prev = [&k](vector<int> &v, int &tail) {
        if (v[tail] == 1) {
            --v[tail];
            --tail;
        }
        else {
            --v[tail];
            repeat_from (i, tail + 1, v.size()) v[i] = k;
            tail = v.size() - 1;
        }
        //return pair<vector<int>, int> {v, tail};
    };
      
    if (k % 2 == 0) {
        cout << k / 2 << ' ';
        rep(n - 1) cout << k << ' ';
    }
    else {
        vector<int> v(n, (k + 1) / 2);
        int tail = n - 1;
        rep(n / 2) {
            //tie(v, tail) = prev(v, tail);
            prev(v, tail);
        }
        repeat(i, n) if (v[i] > 0) cout << v[i] << ' ';
    }
}

Measured memory_bytes: 3456
import java.util.*;

public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int h = sc.nextInt(), w = sc.nextInt(), k = sc.nextInt();
		String c[] = new String[h];
		for (int i = 0; i < h; ++i)
			c[i] = sc.next();
		sc.close();
		int black = 0, ans = 0;
		for (int maski = 0; maski < (1 << h); ++maski) {
			for (int maskj = 0; maskj < (1 << w); ++maskj) {
				black = 0;
				for (int i = 0; i < h; ++i) {
					if ((maski & (1 << i)) == 0) {
						for (int j = 0; j < w; ++j) {
							if ((maskj & (1 << j)) == 0) {
								if (c[i].charAt(j) == '#')
									black++;
							}
						}
					}
				}
				if (black == k)
					ans++;
			}
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 35720
#include <stdio.h>
#include <stdlib.h>

typedef struct _node {
	int key;
	struct _node *left;
	struct _node *right;
} node;

typedef void(*FUNCP)(node *);

node *allocNode(int key) {
	node *p = (node *)malloc(sizeof(node));
	p->key = key;
	p->left = NULL;
	p->right = NULL;

	return p;
}

void terminate(node *p) {
	if (p == NULL) return;
	terminate(p->left);
	terminate(p->right);
	free(p);
}

node *insert(node *p, node *c) {
	if (p == NULL) return c;
	if (c->key < p->key) p->left = insert(p->left, c);
	else p->right = insert(p->right, c);
	return p;
}

int find(node *p, int key) {
	if (p == NULL) return 0;
	if (p->key == key) return 1;
	if (key < p->key) return find(p->left, key);
	else return find(p->right, key);
}

void inParse(node *p) {
	if (p == NULL) return;
	inParse(p->left);
	printf(" %d", p->key);
	inParse(p->right);
}

void preParse(node *p) {
	if (p == NULL) return;
	printf(" %d", p->key);
	preParse(p->left);
	preParse(p->right);
}

void dump(node *p, FUNCP funcp) {
	(funcp)(p);
	printf("\n");
}

int main() {
	int n, i, key;
	char order[7];
	node *p, *root = NULL;

	scanf("%d", &n);
	for (i = 0; i < n; i++) {
		scanf("%s", order);
		switch (order[0])
		{
		case 'i':
			scanf("%d", &key);
			p = allocNode(key);
			root = insert(root, p);
			break;
		case 'p':
			dump(root, &inParse);
			dump(root, &preParse);
			break;
		case 'f':
			scanf("%d", &key);
			if (find(root, key)) printf("yes\n");
			else printf("no\n");
		}
	}
	terminate(root);

	return 0;
}



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

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
#define MOD 1000000007
//#define MOD 998244353
#define LINF (long long)4e18
#define jck 3.141592

const double EPS = 1e-10;

using ll = long long;
using Pi = pair<int,int>;
using Pl = pair<ll,ll>;


int main(){
    int X,Y; cin >> X >> Y;
    int ans = 0;
    if(X == 1) ans += 300000;
    if(X == 2) ans += 200000;
    if(X == 3) ans += 100000;
    if(Y == 1) ans += 300000;
    if(Y == 2) ans += 200000;
    if(Y == 3) ans += 100000;
    if(X == 1 && Y == 1) ans += 400000;
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define repin(Array,n) for(int i=0;i<n;i++){cin>>Array[i];}
using namespace std;

using ll = long long;
const int INF = 1e9 + 1;
const ll LLINF = 1e18;
const int MOD = 1e9 + 7;
using Graph = vector<vector<int>>;

int main() {

	int N, M;
	cin >> N;

	vector<int>T(N);
	repin(T, N);

	cin >> M;

	int sum = 0;
	rep(i, N)
		sum += T[i];

	rep(i, M) {
		int p, x;
		cin >> p >> x;
		p--;
		cout << sum + (x - T[p]) << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(n) begin(n), end(n)
using ll = long long;
using namespace std;

int main(){
  int n;
  cin >> n;
  vector<int> h(n+1);
  h.at(0) = 0;
  rep(snip_i, n) cin >> h.at(snip_i+1);
  ll ans = 0;
  while(1){
    int gr = 0;
    rep(i, n+1){
      if(h.at(i) > 0){
        if(h.at(i-1) == 0) gr++;
      }
    }
    rep(i, n+1){
      if(h.at(i) > 0) h.at(i)--;
    }
    if(gr == 0){
      cout << ans << endl;
      return 0;
    }
    ans += gr;
  }
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int main(void){
int A,B,C,D,E,N,M,x,y,i,j,cou=0,cou2,cou3,v[1000000],w[1000000],min_i,en=0;
    char S[100],W[100],s[100],X,Y;
    scanf("%s %s %s",&S,&W,&s);
    if(S[i]>=97&&S[i]<=122){
      S[i]=S[i]-32;
  }
  if(W[i]>=97&&W[i]<=122){
      W[i]=W[i]-32;
  }
  if(s[i]>=97&&s[i]<=122){
      s[i]=s[i]-32;
  }
    printf("%c%c%c",S[0],W[0],s[0]);
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    string s;
    int a = 0;
    cin >> s;
    for (int i = 0; i < s.length(); i++) a += s[i] - '0';
    if (a % 9) cout << "No";
    else cout << "Yes";
}


Measured memory_bytes: 3376
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <cmath>
#include <queue>
#include <set>
#include <stack>

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define inf int(1e9)
#define half_inf int(1e5)
#define ll_inf ll(1e9)*ll(1e9)
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(ll i = n - 1; i >= 0; i--)
#define repone(i, n) for(ll i = 1; i <= (ll)(n); i++)
#define each(i, mp) for(auto i:mp)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const int mod = 1000000007;

const int max_n = half_inf;
ll n, k;
vector<ll> a;

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

void solve() {
    if (k > *max_element(a.begin(), a.end())) {
        cout << "IMPOSSIBLE" << endl;
        return;
    }
    ll n_gcd = a[0];
    repone(i, n - 1) n_gcd = gcd(n_gcd, a[i]);
    if (k % n_gcd == 0) cout << "POSSIBLE" << endl;
    else cout << "IMPOSSIBLE" << endl;
}

int main() {
    cin >> n >> k;
    a.resize(n);
    rep(i, n) cin >> a[i];
    solve();
    return 0;
}

Measured memory_bytes: 1024
//#define NDEBUG
#include <algorithm>
#include <cstddef>
#include <cstdint>
#include <iostream>
#include <vector>

namespace n91 {

  using i8 = std::int_fast8_t;
  using i32 = std::int_fast32_t;
  using i64 = std::int_fast64_t;
  using u8 = std::uint_fast8_t;
  using u32 = std::uint_fast32_t;
  using u64 = std::uint_fast64_t;
  using isize = std::ptrdiff_t;
  using usize = std::size_t;

  struct rep {
    struct itr {
      usize i;
      constexpr itr(const usize i) noexcept : i(i) {}
      void operator++() noexcept { ++i; }
      constexpr usize operator*() const noexcept { return i; }
      constexpr bool operator!=(const itr x) const noexcept { return i != x.i; }
    };
    const itr f, l;
    constexpr rep(const usize f, const usize l) noexcept
      : f(std::min(f, l)), l(l) {}
    constexpr auto begin() const noexcept { return f; }
    constexpr auto end() const noexcept { return l; }
  };
  struct revrep {
    struct itr {
      usize i;
      constexpr itr(const usize i) noexcept : i(i) {}
      void operator++() noexcept { --i; }
      constexpr usize operator*() const noexcept { return i; }
      constexpr bool operator!=(const itr x) const noexcept { return i != x.i; }
    };
    const itr f, l;
    constexpr revrep(const usize f, const usize l) noexcept
      : f(l - 1), l(std::min(f, l) - 1) {}
    constexpr auto begin() const noexcept { return f; }
    constexpr auto end() const noexcept { return l; }
  };
  template <class T> auto md_vec(const usize n, const T& value) {
    return std::vector<T>(n, value);
  }
  template <class... Args> auto md_vec(const usize n, Args... args) {
    return std::vector<decltype(md_vec(args...))>(n, md_vec(args...));
  }
  template <class T> constexpr T difference(const T& a, const T& b) noexcept {
    return a < b ? b - a : a - b;
  }
  template <class T> void chmin(T& a, const T& b) noexcept {
    if (b < a)
      a = b;
  }
  template <class T> void chmax(T& a, const T& b) noexcept {
    if (a < b)
      a = b;
  }
  template <class T> T scan() {
    T ret;
    std::cin >> ret;
    return ret;
  }

} // namespace n91

#include <algorithm>
#include <iostream>
#include <utility>

namespace n91 {

  void main_() {
    /*
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    //*/
    const u32 x = scan<u32>();
    const u32 y = scan<u32>();
    u32 ans = 0;
    if (x == 3) {
      ans += 100000;
    }
    else if (x == 2) {
      ans += 200000;
    }
    else if (x == 1) {
      ans += 300000;
    }
    if (y == 3) {
      ans += 100000;
    }
    else if (y == 2) {
      ans += 200000;
    }
    else if (y == 1) {
      ans += 300000;
    }
    if (x == 1 && y == 1) {
      ans += 400000;
    }
    std::cout << ans << std::endl;
  }

} // namespace n91

int main() {
  n91::main_();
  return 0;
}


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

vector<string> input;


int main(){
#ifdef LOCAL
    freopen("./input.txt", "r", stdin);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    
    int N,L;
    string temp;
    cin>>N>>L;
    while (N--) {
        cin>>temp;
        input.push_back(temp);
    }
    sort(input.begin(), input.end());
    for(auto i: input){
        cout<<i;
    }
    cout<<endl;
    
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
using namespace std;
int main(void)
{	
    int c1=0,c5=0,c10=0,c50=0,c100=0,c500=0;
	scanf("%d %d %d %d %d %d",&c1,&c5,&c10,&c50,&c100,&c500);
	if(c1+c5*5+c10*10+c50*50+c100*100+c500*500>=1000)
	{
		printf("1\n");
	}
	else
	{
		printf("0\n");
	}
	return 0;
}


Measured memory_bytes: 3104
#include<bits/stdc++.h>
#define ll unsigned long long
using namespace std;
ll i,j,k,n,m,p,ans=1;
ll Pow(ll n,ll m){
	ll ans=1;
	while(m>1){
		if(m%2==0){
			m/=2;
			n=n*n;
		}else{
			ans=ans*n;
			m/=2;
			n=n*n;
		}
	}
	return n*ans;
}
int main(){
	cin>>p>>n;
	if(p==1){
		cout<<n<<endl;
		return 0;
	}
	if(n==1){
		cout<<1<<endl;
		return 0;
	}
	ll ans=(ll)pow((double)n,(double)(1.0/p));
	for(i=ans+1;i>=2;i--){
		ll k=Pow(i,p);
		if(k>0 && n%k==0){
			cout<<i<<endl;
			return 0;
		}
	}
	cout<<1<<endl;
	return 0;
}
/*
2 999999999999
3
*/

Measured memory_bytes: 256
fun main(args: Array<String>) {

    val numN = readLine().orEmpty().toInt()
    var fList = mutableListOf<List<Int>>()
    val pList = mutableListOf<List<Int>>()

    for(i in 0 until numN){
        val schedule = readLine()!!.split(" ").map(String::toInt)
        fList.add(schedule)
    }
    for(i in 0 until numN){
        val price = readLine()!!.split(" ").map(String::toInt)
        pList.add(price)
    }

    var maxProfit = 0
    for(i in 1 until 1024){

        var iBStr = Integer.toBinaryString(i)
        if(iBStr.length < 10){
            for(j in 0 until 10 - iBStr.length){
                iBStr = "0$iBStr"
            }
        }
        var profit = 0
        var l = 0
        fList.forEach {
            var result = 0 // 営業被りの数
            var k = 0
            it.forEach{it2 ->
                if(it2 == 1 && iBStr[k] == '1'){
                    result += 1
                }
                k += 1
            }
            if(l == 0){
                profit = pList[l][result]
            }else{
                profit += pList[l][result]
            }
            l += 1
        }
        if(i == 1){
            maxProfit = profit
        }else if(maxProfit < profit){
            maxProfit = profit
        }

    }

    println(maxProfit)


}

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

int main(void){
    string s;
    cin >> s;
    vector<char> ab(26, 0);
    for (int i = 0; i < s.size();i++){
        ab.at(s.at(i) - 'a')++;
    }
    for (int i = 0; i <26;i++){
        if(ab.at(i)!=0&&ab.at(i)!=1){
            cout << "no" << endl;
        return 0;
        }
    }
    cout << "yes" << endl;

    return 0;
}

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

class Div
{
public:
    int ans1,ans2,ans3,res;
    int calc(int a,int b){
        ans1=a+b;
        ans2=a-b;
        ans3=a*b;
        res=max(ans1,max(ans2,ans3));
        return res;
            }
    

};
void solve(){
    Div div;
    int A,B,ans;
    cin>>A>>B;
    ans=div.calc(A,B);
    cout<<ans<<endl;
}

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

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

const int mod = 1000000007;
int n, k, i, lim;
int dp [100001];
int pre [100001];

int main ()
	{
	scanf ("%d%d",&n,&k);
	fill (pre, pre+k+1, 1);
	while (n--)
		{
		scanf ("%d",&lim);
		for (i=0; i<=k; i++)
			{
			dp[i]=pre[i];
			if (i-lim-1>=0)
				{
				dp[i]-=pre[i-lim-1];
				if (dp[i]<0)
					dp[i]+=mod;
				}
			}
		for (i=1; i<=k; i++)
			{
			pre[i]=pre[i-1]+dp[i];
			if (pre[i]>=mod)
				pre[i]-=mod;
			}
		}
	printf ("%d\n",dp[k]);
	return 0;
	}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
 
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long int
#define mod 1000000007
#define inf 1e18+42
#define endl "\n"

#define out1(a) cout<<#a<<" "<<a<<endl
#define out2(a,b) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<endl
#define out3(a,b,c) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<endl

#define rep(i,a,b) for(int i=a;i<b;i++)
#define repr(i,a,b) for(int i=a;i>=b;i--)
#define fori(it,A) for(auto it=A.begin();it!=A.end();it++)

#define ft first
#define sd second
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define zero(x) memset(x,0,sizeof(x));
 
using namespace std;

int binpow(int,int);
void dfs( vector< vector<int> >&, int , vector<int>& );
void bfs( vector< vector<int> >&, int , vector<int>& );

void solve()
{
   int r;
   cin>>r;

   cout<<r*r<<endl; 
}

signed main()
{
    fast;
    int t = 1;
    // cin>>t;

    while(t--)
    {
        solve();
    }
    return 0;
}

int binpow(int a, int b) {
    int res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}

void dfs ( vector< vector<int> > &v , int x , vector<int> &vis )
{
    vis[x] = 1;

    rep(i,0,v[x].size())
    {
        if( vis[v[x][i]] == 0 )
        {
            dfs(v,v[x][i],vis);
        }
    }
}

void bfs( vector< vector<int> > &v , int x , vector<int> &vis )
{
    queue<int> q;
    q.push(x);

    while( !q.empty() )
    {
        int p = q.front();
        q.pop();

        rep(i,0,v[p].size())
        {
            if ( vis[v[p][i]] == 0 )
            {
                vis[v[p][i]] = 1;
                q.push(v[p][i]);
            }
        }
    }
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std;
typedef long long LL;

LL ans = -1;
LL n,a[25],x[25][25],y[25][25];
LL hns[25];

void dfs(int dep){
	if(dep > n){
		LL tot = 0,flg = 1;
		for(LL i = 1;i <= n;i ++) tot += hns[i];
		for(LL i = 1;i <= n;i ++){
			LL tcc = 0;
			for(LL j = 1;j <= a[i];j ++){
				if(hns[i] && hns[x[i][j]] != y[i][j]) flg = 0;
				if((!hns[i]) && hns[x[i][j]] == y[i][j]) tcc ++;
			}
			if((!hns[i]) && tcc == a[i]) flg = 0;
		}
//		cout << tot << ' ' << flg << endl;
		if(flg) ans = max(ans,tot);
		return;
	}
	for(LL i = 0;i < 2;i ++){
		hns[dep] = i;
		dfs(dep + 1);
		hns[dep] = 0;
	}
}

int main(){
	cin >> n;
	for(LL i = 1;i <= n;i ++){
		cin >> a[i];
		for(LL j = 1;j <= a[i];j ++) cin >> x[i][j] >> y[i][j];
	}
	dfs(1);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include <string.h>
#include<math.h>
#define scani(x) scanf("%d",&x)
#define scanc(x) scanf("%s",x)
#define printi(x) printf("%d",x)
#define printin(x) printf("%d\n",x)
#define printc(x) printf("%s",x)
#define repd(i,n,m) for(int i = n; i > m; i--)
#define repu(i,n,m) for(int i = 0; i < m; i++)
#define allprintu(i,n,m,a) for(int i = 0; i < m; i++){if(i != m-1){printf("%d ",a[i]);}else{printf("%d\n",a[i]);}}
#define allprintd(i,n,m,a) for(int i = n; i > m; i--){if(i != 0){printf("%d ",a[i]);}else{printf("%d\n",a[i]);}}
#define LEN 100000

typedef struct pp{
	char name[10];
	int t;
}P;

P Q[LEN];
int head,tail,n,q;


void enqueue(P x){
	Q[tail] = x;
	tail = (tail + 1)% LEN;
}
P dequeue(){
	P x = Q[head];
	head = (head + 1)%LEN;
	return x;
}

int min(int a, int b){
	return a < b ? a : b;
}


int main(void){
	P u;
	int elap = 0;

	scani(n);
	scani(q);

	repu(i,0,n){
		scanc(Q[i].name);
		scani(Q[i].t);
	}
	head = 0;
	tail = n;

	while(head != tail){
		u = dequeue();
		if(u.t <= q){
			printc(u.name);
			printf(" ");
			printin(u.t+elap);
			elap += u.t;
		}else{
			u.t -= q;
			enqueue(u);
			elap += q;
		}
		
	}
	return 0;
}


Measured memory_bytes: 3288
#include <iostream>
#include <algorithm>    // std::sort
#include <vector>       // std::vector
using namespace std;
int main(void){
    // Your code here!
    vector<int> a(3);
    for(int i=0;i<3;i++)cin>>a[i];
    sort(a.begin(), a.end());
    for(int i=0;i<3;i++){
        cout<<a[i];
        if(i!=2)cout<<" ";
    }
    cout<<endl;
    return 0;
}



Measured memory_bytes: 3120
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <numeric>
#include <climits>
#include <math.h>
#include <memory.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rrep(i, k, n) for(int i = (k); i < (int)(n); i++)
using namespace std;
using ll = long long;
int N, M;
int cnt = 0;
ll ans = 0LL;
int i_index;
int dh[4] = {1, 0, -1, 0};
int dw[4] = {0, 1, 0, -1};
string board[64];

int main(){
    int A, B, C;
    cin >> A >> B >> C;
    for(int i = 1; i <= B; i++){
        if(i * A % B == C){
            cout << "YES" << endl;
            return 0;
        }
    }
    cout << "NO" << endl;
    return 0;
}

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

int a[300];
int n;

int main()
{
  cin >> n;
  for (int i = 0; i < 2 * n; i++){
    cin >> a[i];
  }

  sort(a, a + 2 * n, greater<int>());

  int ans = 0;
  for (int i = 1; i < 2 * n; i += 2){
    ans += a[i];
  }

  cout << ans << endl;
}


Measured memory_bytes: 256
def main():
    n = int(input())
    aa = list(map(int, input().split()))

    s = 0
    res1 = 0
    for i in range(n):
        s += aa[i]
        if i % 2 == 0:
            if s <= 0:
                res1 += abs(s) + 1
                s = 1
        else:
            if s >= 0:
                res1 += abs(s) + 1
                s = -1

    s = 0
    res2 = 0
    for i in range(n):
        s += aa[i]
        if i % 2 == 0:
            if s >= 0:
                res2 += abs(s) + 1
                s = -1
        else:
            if s <= 0:
                res2 += abs(s) + 1
                s = 1

    print(min(res1, res2))


if __name__ == '__main__':
    main()


Measured memory_bytes: 14468
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
    ll n,i,x,cnt=1,ans=0;
    cin>>n;
    for (i=0;i<n;i++){
        cin>>x;
        if (x!=cnt)ans++;
        else cnt++;
    }
    if (cnt==1)cout<<"-1\n";
    else cout<<ans<<'\n';
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define FOR(I,A,B) for(int I = int(A); I < int(B); ++I)
const ll INF=1e16+7;
ll minlen(ll s,ll t,ll x){
	if(s<=x&&t<=x)return max(abs(s-x),abs(t-x));
	else if(s>=x&&t>=x)return max(abs(s-x),abs(t-x));
	else return min(abs(s-x),abs(t-x))*2+max(abs(s-x),abs(t-x));
}
int main(){
	ll A,B,Q,x,S[2],T[2];
	cin >> A >> B >> Q;
	vector<ll> s(A+2),t(B+2);
	FOR(i,0,A)cin>>s[i+1];
	FOR(i,0,B)cin>>t[i+1];
	s[0] = -INF; s[A+1] = INF;
	t[0] = -INF; t[B+1] = INF;
	FOR(i,0,Q){
		cin >> x;
		FOR(j,0,2)S[j] = s[int(POSL(s,x))-j];
		FOR(j,0,2)T[j] = t[int(POSL(t,x))-j];
		ll ans = INF;
		FOR(j,0,2)FOR(k,0,2)ans = min(ans,minlen(S[j],T[k],x));
		cout << ans << endl;
	}
}

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

#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 ALL(obj) (obj).begin(), (obj).end()
#define INF 1e9
typedef long long ll;

int main() {
    int N,M,K; cin >> N >> M >> K;
    vector<ll> A(N+1, 0);
    vector<ll> B(M+1, 0);

    FOR(i,1,N+1){
        ll a;
        cin >> a;
        A[i] = a + A[i-1];
    }
    FOR(i,1,M+1){
        ll b;
        cin >> b;
        B[i] = b + B[i-1];
    }

    int ans = 0;

    REP(i,N+1){
        ll a_read_time = K-A[i];
        if (a_read_time < 0) continue;
        auto itr = upper_bound(ALL(B), a_read_time);
        int b_read_number = itr - B.begin() - 1;

        ans = max(ans, i+b_read_number);
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 6400
#include <bits/stdc++.h>
#define REP(i, e) for(int (i) = 0; (i) < (e); ++(i))
#define FOR(i, b, e) for(int (i) = (b); (i) < (e); ++(i))
#define ALL(c) (c).begin(), (c).end()
#define PRINT(x) cout << (x) << "\n"
using namespace std;
using ll = long long; using pint = pair<int, int>; using pll = pair<ll, ll>;
const long long MOD = 1000000007;

ll solve(ll X, ll K, ll D){
    if(K < X / D){
        return X - K * D;
    }else{
        return min(X % (2 * D), 2 * D - X % (2 * D));
    }
}

signed main(){
    ll X, K, D;
    cin >> X >> K >> D;
    X = abs(X);
    if(K == 1){
        PRINT(min(abs(X - D), abs(X + D)));
        return 0;
    }
    if(K % 2 == 0){
        PRINT(solve(X, K, D));
    }else{
        PRINT(min(solve(abs(X - D), K - 1, D), solve(X + D, K - 1, D)));
    }
    return 0;
}

Measured memory_bytes: 3632
#include<stdio.h>
#define NMAX 100

int count = 0;

void bubbleSort(int[], int);
void output(int[], int);

int main(){

  int N, i, j;
  int A[NMAX];

  scanf("%d", &N);
  for(i = 0; i < N; i++)
    scanf("%d", &A[i]);

  bubbleSort(A, N);
  output(A, N);
  
  return 0;
}

void bubbleSort(int A[], int N){

  int j, tmp, flag = 1;

  while(flag){

    flag = 0;
    
    for(j = N - 1; j >= 1; j--){
      if(A[j] < A[j - 1]){

	tmp = A[j];
	A[j] = A[j - 1];
	A[j - 1] = tmp;

	flag = 1;
	count++;
      }
     
    }
  }

}

void output(int A[], int N){

  int i;

  for(i = 0; i < N; i++){
    if(i > 0) printf(" ");
    printf("%d", A[i]);
  }
  printf("\n%d\n", count);
}
  



Measured memory_bytes: 2144
#include <iostream>

using namespace std;
int main()
{


	int N, M, X, Y, x[101], y[101], mx = -100, my = 100;
	cin >> N >> M >> X >> Y;
	for (int i = 1; i < N + 1; i++) {
		cin >> x[i];
		if (mx < x[i]) mx = x[i];
	}
	for (int i = 1; i < M + 1; i++) {
		cin >> y[i];
		if (my > y[i]) my = y[i];
	}


	x[0] = X;
	y[0] = Y;

	for (int i = 0; i < N; i++) {
		if (mx < x[i]) mx = x[i];
	}
	for (int i = 0; i < M; i++) {
		if (my > y[i]) my = y[i];
	}

	if (mx + 1 > my) cout << "War";
	else cout << "No War";

}

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

int main(){
int N,X;
  cin>>N>>X;
  vector<int>m(N);
  for(int i=0; i<N; i++){
   cin>>m[i];
   X-=m[i];}
  
  int min=*min_element(m.begin(), m.end());
  int d=X/min;
  cout<<d+N;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T> V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> > Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T> mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }

/*
 <url:>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */

#define Day 2*60*60*24+10
int imos[Day];
int solve(int n){
    int res = 0;
    fill(imos,imos+Day,0);
    for(int i = 0; i < n;i++){
        int h,m,s; char c;
        cin >> h >> c >> m >> c >> s;
        int T = h*3600+60*m+s;
       // cout << 2*T << " ";
        imos[2*T]++;
        cin >> h >> c >> m >> c >> s;
        T = h*3600+60*m+s;
        imos[2*T]--;
       // cout << 2*T << " " << endl;
    }
    res = imos[0];
    for(int i = 1; i < Day;i++){
        imos[i] += imos[i-1];
        res = max(res,imos[i]);
    }
  //  vector<ll> x(imos,imos+Day);
   // cout << x << endl;
    return res;
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    int n;
    while(cin >> n,n){
        cout << solve(n) << endl;
    }
    return 0;
}



Measured memory_bytes: 3676
import java.util.*;

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

        int N = sc.nextInt();
        int Q = sc.nextInt();
        String S = sc.next();

        int[] count = new int[N+2];
        for(int i = 0; i< N+2; i++) count[i] = 0;
        
        for(int i = 0; i< N-1; i++){
            String Ssub = S.substring(i, i+2);
            if(Ssub.equals("AC")){
                count[i+1] = count[i] + 1;
            }else{
                count[i+1] = count[i];
            }
        }

        int ans = 0;
        for(int i = 0; i < Q; i++){
            int l = sc.nextInt() - 1;
            int r = sc.nextInt() - 1;
            ans = count[r] - count[l];
            System.out.println(ans);
        }
    }
}


Measured memory_bytes: 83024
#include<iostream>
using ll = long long;
const ll MOD = 1000000007;

ll pow(ll x, ll n) {
    ll mod = MOD;
    ll res = 1;
    while (n > 0) {
        if (n % 2 == 1) res = res * x % mod;
        x = x * x % mod;
        n = n / 2;
    }
    return res;
}

ll modInverse(ll x) {
  return pow(x, MOD - 2);
}

int main()
{
  ll n,k;
  std::cin>>n>>k;
  ll res = ((n * (n + 1) % MOD * (n + 2) % MOD + k * (k - 1) % MOD * (2 * k - 3 * n - 4) % MOD + MOD) % MOD * modInverse(6) % MOD + n - k + 2) % MOD;
  std::cout<<res<<std::endl;
}


Measured memory_bytes: 3620
#include <stdio.h>

int main(){
  int h, n;
  scanf("%d %d",&h,&n);
  int a[n];
  int sum=0;
  for(int i=0;i<n;i++){
    scanf("%d",&a[i]);
    sum+=a[i];
  }
  
  if(sum<h){
    printf("No\n");
  }else{
    printf("Yes\n");
  }  
  return 0;
}


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

int a,b;

template<typename Drake>
void read(Drake &x){
	x=0;char ch=getchar();bool f=1;
	while(!isdigit(ch)){
		if(ch=='-')f^=1;
		ch=getchar();
	}
	while(isdigit(ch)){
		x=(x<<1)+(x<<3)+(ch^48);
		ch=getchar();
	}
	x*=(2*f-1);
}

template<typename Drake>
void write(Drake x){
	if(x<0){x=-x;putchar('-');}
	if(x>9)write(x/10);
	putchar(x%10+'0');
}

template<typename Drake>
void writeln(Drake x){
	write(x);
	puts("");
}

void init(){
	read(a);read(b);
}

int main(){
	init();
	if(a==2||b==2){
		puts("No");
	}
	else{
		puts("Yes");
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define all(x) x.begin(), x.end()
#define pb(x) push_back(x)
#define INF 1000000000000000000
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define x first 
#define y second
const int maxx = 2000006;
const int mod2 = 987654319;
const int maxlog = 20;
const ll mod = 1000000007;

int main() {
    IOS
    ll N;
    cin >> N;
    ll ans = INF;
    for (ll i = 1; i * i <= N; i++) {
        if (N % i == 0) {
            ans = min(ans, i - 1 + (N / i) - 1);
        }
    }
    cout << ans;
}


Measured memory_bytes: 256
public class Main {
    public static void main(String[] args) {
        int value = Integer.parseInt(readLine(255));
        System.out.printf("%f",(2*Math.PI*value));
    }

    public static  String readLine(int maxLen){
        int[] holder = new int[maxLen];
        int counter =0, reader =1;

        try{
            while(counter < maxLen){
                reader = System.in.read();
                if(reader <0 || (reader =='\n'))break;
                holder[counter++] = reader;
            }
        }catch(Exception ex){
            return (null);
        }

        if(counter ==0 && reader <0)return (null);
        return new String(holder,0,counter);
    }
}


Measured memory_bytes: 25696
#include <iostream>
#include <vector>
#include <set>
#include <deque>
#include <map>
#include <iomanip>
#include <queue>
#include <stack>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <utility>
using namespace std;
int ky[8] = {-1,1,-2,2,-2,2,-1,1}; 
int kx[8] = {-2,-2,-1,-1,1,1,2,2};
int dy[4] = {-1,0,1,0};
int dx[4] = {0,1,0,-1};
int ddy[8] = {-1,0,1,-1,1,-1,0,1};
int ddx[8] = {-1,-1,-1,0,0,1,1,1};
typedef long long ll;
#define pi pair
#define MP make_pair
#define PB push_back
#define F first
#define S second
#define rep1(i,a,b) for(int i = a; i < b; i++)
#define rep2(i,a,b) for(int i = a; i <= b; i++) 
#define INF 999999999999
const double PI = acos(-1.0); 
ll N,D;
ll x,y;
ll ans;

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    cin >> N >> D;
    rep1(i,0,N){
        cin >> x >> y;
        ll dis = x * x + y * y;
        if(dis <= D * D) ans++;
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 3640
#include <iostream>
#include <cstdio>
#include<algorithm>
#include <vector>
using namespace std;
vector<int >G;
long long cnt=0;
int A[1000000],n;
void insertionSort(int A[],int n,int g)
{
  int v,i,j;
  for( i = g ;i< n;i++)
    {
      v = A[i];
      j = i - g;
      while (j >= 0 && A[j] > v)
	{
	  A[j+g] = A[j];
	  j = j - g;
	  cnt++;
	}
      A[j+g] = v;
    }
}
void shellSort(int A[],int  n)
{
  cnt=0;
  int h=1;
  while(h<=n)
    {
      G.push_back(h);
      h=3*h+1;
    }
  for(int i=G.size()-1;i>=0;i--)
    insertionSort(A, n, G[i]);
}
int main()
{
  cin>>n;
  for(int  i=0;i<n;i++)
    scanf("%d",&A[i]);
  shellSort(A,n);
  printf("%d\n",G.size());
  for(int i=G.size()-1;i>0;i--)
    {
      printf("%d ",G[i]);

    }
  printf("%d\n",G[0]);
  cout<<cnt<<endl;
  for(int i=0;i<n;i++)
    printf("%d\n",A[i]);
  return 0;
}



Measured memory_bytes: 7192
#include<cstdio>
#include<vector>
#include<algorithm>


using namespace std;


int main(void)
{
	int n, sum, ans;
	vector<int> s, dp;

	while(scanf("%d", &n)==1)
	{
		s.resize(n);
		sum=0;
		for(int i=0;i<n;i++)
		{
			scanf("%d", &s[i]);
			sum+=s[i];
		}
		dp.assign(sum+1, 0);
		dp[0]=1;
		ans=0;
		for(int i=0;i<n;i++)
		{
			for(int j=sum;j>=0;j--)
			{
				if(dp[j])
				{
					dp[j+s[i]]=1;
					if((j+s[i])%10) ans=max(ans, j+s[i]);
				}
			}
		}
		printf("%d\n", ans);
	}
	return 0;
}


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

int x;

int expo(int n){
    int p=2;
    if(pow(n,p)>x) return -1;
    while(pow(n,p)<=x){
        p++;
    }
    return (int)pow(n,p-1);
}

int main(){
    cin>>x;
    if(x==1) cout<<1<<endl;
    else{
    int M=0;
    for(int i=2;i<x;i++){
        M=max(M,expo(i));
    }
    cout<<M<<endl;
    }
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using static System.Console;
using Pair = System.Collections.Generic.KeyValuePair<int, int>;
//using System.Numerics;
//using static System.Math;
 
class Program
{
    static void Main()
    {
        //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
        new Program().solve();
        Out.Flush();
    }
    Scanner cin = new Scanner();
    readonly int[] dd = { 0, 1, 0, -1, 0 };
    readonly int mod = 1000000007;
    readonly string alfa = "abcdefghijklmnopqrstuvwxyz";
    readonly string ALFA = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
 
    int N;
    void solve()
    {
        var S = cin.next;
        N = S.Length;
        for (int i = 0; i < N - 8; i++)
        {
            Write(S[i]);
        }
        WriteLine();
    }
 
}
 
class Scanner
{
    string[] s; int i;
    char[] cs = new char[] { ' ' };
    public Scanner() { s = new string[0]; i = 0; }
    public string[] scan { get { return ReadLine().Split(); } }
    public int[] scanint { get { return Array.ConvertAll(scan, int.Parse); } }
    public long[] scanlong { get { return Array.ConvertAll(scan, long.Parse); } }
    public double[] scandouble { get { return Array.ConvertAll(scan, double.Parse); } }
    public string next
    {
        get
        {
            if (i < s.Length) return s[i++];
            string st = ReadLine();
            while (st == "") st = ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            i = 0;
            return next;
        }
    }
    public int nextint { get { return int.Parse(next); } }
    public long nextlong { get { return long.Parse(next); } }
    public double nextdouble { get { return double.Parse(next); } }
}

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


#define FOR(i, start, end) for(uint64_t i=start; i<end; i++)
#define REP(i, n) FOR(i, 0, n)

// 最大公約数gcd
// 最小公倍数lcm=m*n/gcd
uint64_t gcd(uint64_t m, uint64_t n) {
  uint64_t temp;
  while (m % n != 0){
    temp = n;
    n = m % n;
    m = temp;
  }
  return n;
}

uint64_t lcm(uint64_t m, uint64_t n) {
  return (m*n)/gcd(m,n);
}

void comb(vector<vector <uint64_t> > &v){
  for(uint64_t i = 0;i <v.size(); i++){
    v[i][0]=1;
    v[i][i]=1;
  }
  for(uint64_t k = 1;k <v.size();k++){
    for(uint64_t j = 1;j<k;j++){
      v[k][j]=(v[k-1][j-1]+v[k-1][j]);
    }
  }
}

// 掛け算オーバーフロー判定
bool is_product_overflow(uint64_t a, uint64_t b) {

	uint64_t prod = a * b;
	
	return (prod / b != a);
}

//素因数分解
void primeFactorization(uint64_t a, list<uint64_t> &factors){ //素因数分解を出力するプログラム
  long i,sq;
  if(a%2==0){ //偶数の場合
    factors.push_back(2);
    primeFactorization(a/2,factors); //2で割った値で再帰
    return;
  }
  sq = sqrt(a);
  for(i=3;i<=sq;i+=2){ //3以上√a以下の奇数の場合
	if(a%i==0){
	  factors.push_back(i);
      primeFactorization(a/i,factors); //割れた値で再帰
      return;
	}
  }
  //偶数でも3以上√a以下の奇数の場合でも割り切れない場合
  if(a!=1){ //aが1でないなら、a自身は素数
    factors.push_back(a);
  }
}

// 円周率
// M_PI

// #include <iomanip> // setprecisionを使用するのに必要
// cout << std::fixed << std::setprecision(15) << y << endl;

// 昇順
// priority_queue<int, vector<int>, greater<int> > queue;

signed main() {
  int64_t n,k;
  cin >> n >> k;
  priority_queue<int, vector<int>, greater<int> > queue;
  int val;
  for(int64_t i=0;i<n;i++){
    cin >> val;
    queue.push(val);
  }
  int64_t sum = 0;
  for(int64_t i=0;i<k;i++){
    sum += queue.top();
    queue.pop();
  }
  cout << sum << endl;
  return 0;
}

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

#define BR "\n"
#define SP " "

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  if (a < b && b < c) {
    cout << "Yes" << BR;
  } else {
    cout << "No" << BR;
  }

  return 0;
}


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

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

    string str;
    str = to_string(n);
    const char* nstr = str.data();

    int sevenflag=0;
    rep(i,strlen(nstr)) {
        if (nstr[i]=='7') {
            sevenflag = 1;
        }
    }
    if (sevenflag == 0) {
        cout << "No" << endl;
    } else {
        cout << "Yes" << endl;
    }

    return 0;
}

Measured memory_bytes: 3692
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
#define ff first
#define ss second
#define pb push_back
#define all(s) (s).begin(), (s).end()
const ll mod = 1e9 + 7;

ll h, w, x;
vector<pair<ll,ll>> arr;
vi ans, fact;

ll binexp(ll a)
{
    ll res = 1, y = mod - 2;
    while (y > 0)
    {
        if (y & 1)
            res = ((res * a) % mod + mod) % mod;
        y >>= 1;
        a = ((a * a) % mod + mod) % mod;
    }
    return res % mod;
}

ll num(ll x1, ll y1, ll x2, ll y2)
{
    ll x = fact[x2 - x1 + y2 - y1];
    ll y = binexp(((fact[x2 - x1] * fact[y2 - y1]) % mod + mod) % mod);
    return ((x * y) % mod + mod) % mod;
}

void solve()
{
    for (int i = 2; i <= h + w; i++)
        fact[i] = ((fact[i - 1] * i) % mod + mod) % mod;

    for (int i = 0; i <= x; i++)
    {
        ll ans_i = num(1, 1, arr[i].ff, arr[i].ss);
        ll ans_t = 0;
        for (int j = 0; j < i ; j++)
        {
            if (arr[j].ff <= arr[i].ff && arr[j].ss <= arr[i].ss)
            {
                ans_t += (ans[j] * num(arr[j].ff, arr[j].ss, arr[i].ff, arr[i].ss) + mod) % mod;
                ans_t %= mod;
            }
        }
        ans[i] = (ans_i - ans_t) % mod + mod;
        ans[i] %= mod;
    }    
}

signed main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(nullptr);
    cout.tie(nullptr);

    cin >> h >> w >> x;
    arr.resize(x);
    ans.resize(x + 1);
    fact.resize(h + w + 1);
    fact[0] = fact[1] = 1;
    for (int i = 0; i < x; i++)
    {
        ll a, b;
        cin >> a >> b;
        arr[i] = make_pair(a, b);
    }
    sort(all(arr));
    arr.pb({h, w});
    solve();
    cout << ans[x] << endl;
    return 0;
}

Measured memory_bytes: 2048
#include <bits/stdc++.h>
//#pragma GCC optimize(2)

using namespace std;

#define LL long long
#define Rint register int
#define U unsigned
#define forn(i,a,b) for(int i = a;i <= b;++i)
#define nfor(i,a,b) for(int i = a;i >= b;--i)
#define pii pair<int ,int>
#define MS0(X) memset(X,0,sizeof(X))
#define MSf(X) memset(X,false,sizeof(X))
#define MS1(X) memset(X,-1,sizeof(X))
#define BR printf("--------------------\n")
#define pb push_back
#define rep(i,a,b) for(Rint i=a;i<=b;++i)
#define DEBUG(x) std::cerr << #x << '=' << x << std::endl
const double PI=atan(1.)*4.;
const int maxn=1e6+5;
const int inf = 0x3f3f3f3f;
const int mod=1e9+7;
const double e=2.71828182845904523536;
int dirx[8]={1,0,-1,0,1,-1,-1,1};
int diry[8]={0,1,0,-1,1,1,-1,-1};

int main()
{
	ios::sync_with_stdio(false);
    cin.tie(0);
   	cout.tie(0);
    int a,b;
    cin>>a>>b;
    cout<<max(0,a-2*b)<<endl;
	return 0;
}


Measured memory_bytes: 256
N = input()

if N[0] == N[1] == N[2]:
    print(int(N))

else:
    if int(N[0]) < int(N[1]):
        x = (int(N[0])+1) * 100 + (int(N[0])+1) * 10 + int(N[0])+1
        print(x)

    elif N[0] == N[1] and int(N[1]) > int(N[2]):
        x = int(N[0]) * 100 + int(N[0]) * 10 + int(N[0])
        print(x)

    elif N[0] == N[1] and int(N[1]) < int(N[2]):
        x = (int(N[0])+1) * 100 + (int(N[0])+1) * 10 + int(N[0])+1
        print(x)

    elif int(N[0]) > int(N[1]):
        x = int(N[0]) * 100 + int(N[0]) * 10 + int(N[0])
        print(x)

Measured memory_bytes: 9044
#pragma region Macros
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i, n) for(int i=(n); i>=0; --i)
#define FOR(i, n, m) for(int i=(m), i##_len=(n); i<i##_len; ++i)
#define EACH(i, v) for(const auto& i : v)
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<class Value>using vec = vector< Value >;
using ll = long long;
using P = pair< long long, long long >;
#define fi first
#define se second
#define el endl
#pragma endregion

void Main();

int main(){
    std::cin.tie(nullptr);
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


void Main(){
    int a;
    string s;
    cin >> a >> s;
    cout << (a>=3200?s:"red") << el;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define pll pair<ll, ll>
using namespace std;
const ll N = 1e7 + 5;
const ll maxn = 5005;
ll m, n, t, T, k, a[N], b[N], ans, tong;
string s, ss;
struct dang
{
    ll pos, val, mn, mx, vtri;
};
bool so(const dang& x, const dang& y)
{
    return (x.val < y.val) || (x.val == y.val && x.pos < y.pos);
}
void sol()
{
    cin >> n >> s;
    for(int i = 0, j = n - 1; ; )
    {

        while(s[i] == 'R')++i;
        while(s[j] == 'W')--j;
        if(i >= j)break;
        ++i;
        --j;
        ++ans;
    }
    cout << ans;
}
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    //cin >> T; while(T -- > 0)
    sol();
}


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

int main() {
  int N, M, a;
  a = 0;
  cin >> N;
  M = N;
  while (M > 0) {
    a += M % 10;
    M /= 10;
  }
  
  if (N % a == 0) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<string>
using namespace std;
int arr[105][105],n,m,k,a[10005];
int main(){
	scanf("%d%d%d",&n,&m,&k);
	int xb,x2,cx=0,cy=0;
	for(xb=0;xb<k;xb++){
		scanf("%d",a+xb);
		for(x2=0;x2<a[xb];x2++){
			arr[cx][cy]=xb+1;
			cy++;
			if(cy==m){
				cy=0;
				cx++;
			}
		}
	}
	for(xb=0;xb<n;xb+=2){
		reverse(arr[xb],arr[xb]+m);
	}
	for(xb=0;xb<n;xb++){
		for(x2=0;x2<m;x2++){
			printf("%d ",arr[xb][x2]);
		}
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 256