akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <iomanip> // cout<<setprecision(n)
#include <functional> // std::function<void(long long)>
using namespace std;
#define All(v) (v).begin(),(v).end()
const long long mod = 1000000007;
const long long inf = mod*mod;
const int AMAX = 100000;
const double EPS=1e-10;
const double INF=1e+10;
const double PI=acos(-1.0);

signed main(){
    int n;
    long long k;
    cin>>n>>k;
    long long A[AMAX+1];
    for(int i=0;i<=AMAX;i++)A[i]=0;
    for(int i=0;i<n;i++){
        int a,b;
        cin>>a>>b;
        A[a]+=b;
    }
    for(int i=1;i<=AMAX;i++){
        if(k<=A[i]){
            cout<<i<<endl;
            break;
        }
        k-=A[i];
    }
}


Measured memory_bytes: 1152
#include <iostream>
#include <iomanip>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>

using namespace std;

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

  vector<long long int> C(N), count(N);
  vector<vector <long long int> > seq(200000);
  vector<int> pointer(200000);

  for (int i = 0; i < N; i++) {
    cin >> C[i];
    C[i]--;
    seq[C[i]].push_back(i);
  }

  long long int MOD = 1000000007;
  count[0] = 1;
  for(int i = 0; i < N - 1; i++) {
    long long int c = C[i];
    count[i + 1] = (count[i] + count[i + 1]) % MOD;
    pointer[c]++;
    // cout << c << " " << seq[c].size() << " " << pointer[c] << endl;
    if (seq[c].size() > pointer[c] && seq[c][pointer[c]] > i + 1) {
      count[seq[c][pointer[c]]] = (count[seq[c][pointer[c]]] + count[i]) % MOD;
    }
    count[i] = 0;
    // for (int j = 0; j < N; j++) {
    //   cout << count[j] << " ";
    // }
    // cout << endl;
  }

  cout << count[N - 1] << endl;

  return 0;
}


Measured memory_bytes: 15104
#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>

using namespace std;

int main() {
	int n, P;

	cin >> n >> P;

	int g = 0, k = 0;

	for (int i = 0; i < n; i++) {
		int x;
		cin >> x;
		if (x % 2) k++;
		else g++;
	}


	long long ans = 0;
	int a;
	if (k == 0) {
		if (P == 0) ans = pow(2, k + g);
		else ans = 0;
	}
	else  ans = pow(2, k + g - 1);

	cout << ans << endl;


	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#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 FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 999999999

using namespace std;


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

int A[100100];
int main() {
	int N, K;
	cin >> N >> K;
	REP(i, N) {
		cin >> A[i];
	}
	int c = N - K;
	int ans = 1;
	while (c > 0) {
		c -= (K - 1);
		ans++;
	}
	cout << ans << endl;
}


Measured memory_bytes: 640
import java.util.*;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
        
        int n = sc.nextInt();
        int data[] = new int[n];

        for (int i = 0; i < n; i++) {
            data[i] = sc.nextInt();
        }

        int s1 = 0;
        int s2 = 0;

        int index = 0;
        int i = 0;
        int j = n - 1;

        while (index < n) {
            if (s1 < s2) {
                s1 += data[i];
                i++;
            } else {
                s2 += data[j];
                j--;
            }
            index++;
        }

        if (s1 >= s2) {
            System.out.println(s1 - s2);
        } else {
            System.out.println(s2 - s1);
        }
	}
}

Measured memory_bytes: 23124
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N, A, B = map(int, readline().split())

    ans = 0
    for i in range(1, N + 1):
        if A <= sum(map(int, str(i))) <= B:
            ans += i

    print(ans)
    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 68392
#include<stdio.h>

// NO ERROR handling implemented!! full, empty


typedef struct pp{
    char name[100];
    int t;
}p;

#define len 100005
p queue[len];

int head, tail, n;// tail always points next empty, head always points NON-null

void enqueue(p x){
    queue[tail]=x;  
    tail=(tail+1)%len;  
}

// 要素得てからhead increしたいときはp xにbuffering
p dequeue(){
    p x=queue[head];
    head=(head+1)%len;
    return x;
}

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

int main(){

    int q;
    p u;
    int elaps=0, c;
    scanf("%d %d",&n, &q);
    for(int i=1;i<=n;i++){  // i==0 remains empty
        scanf("%s", queue[i].name);
        scanf("%d", &queue[i].t );
    }
    head=1;
    tail=n+1;// points to next empty


    while(head!=tail){
        u=dequeue();
        c=min(q,u.t);
        u.t-=c;
        elaps+=c;
        if(u.t>0){
            enqueue(u);
        }else{  // process finished
            printf("%s %d\n", u.name, elaps);
        }
    }



    return 0;
}


Measured memory_bytes: 11856
import java.util.*;

public class Main {
    public static final void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int a = N / 10;
        int b = N % 10;
        if (a == 9 || b == 9) System.out.println("Yes");
        else System.out.println("No");
    }
}


Measured memory_bytes: 21972
#include<bits/stdc++.h>
using namespace std;
const long long INF = 1e7 + 1;
const long long MOD = 1000000007;
const long double PI = 3.1415926;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(x) x.begin(),x.end()
#define RALL(x) x.rbegin(),x.rend()
typedef long long int ll;
typedef vector <ll> vi;
typedef vector < pair<ll, ll > > vp;
typedef vector <vector<ll>> vv;
typedef vector <string> vs;
typedef vector <char> vc;
 
 
ll n, m, k, ans = 0, sum = 0, cnt = 0;
string s;
//char c;
 
#define Endl endl
 
 
/*--------------------template--------------------*/
 
ll a[100] = { 0 };
 
int main() {
    cin >> n;
    a[0] = 2;
    a[1] = 1;
    REP(i, n) {
        a[i + 2] = a[i + 1] + a[i];
    }
    cout << a[n] << endl;
}

Measured memory_bytes: 256
module mod_binary_indexed_tree
  implicit none
  type fenwick_tree
    integer :: n
    integer, pointer :: arr(:)
  end type fenwick_tree
  private
  public :: fenwick_tree, init_bit, release_bit
  public :: add, summate, update, maximum
contains
  subroutine init_bit(bit,n)
    implicit none
    type(fenwick_tree) :: bit
    integer, intent(in) :: n
    bit%n = n
    allocate(bit%arr(n))
    bit%arr = 0
    return
  end subroutine init_bit
  subroutine release_bit(bit)
    implicit none
    type(fenwick_tree) :: bit
    if (associated(bit%arr)) deallocate(bit%arr)
    return
  end subroutine release_bit
  subroutine add(bit,i,v)
    implicit none
    type(fenwick_tree) :: bit
    integer, intent(in) :: i, v
    integer :: x
    if (i.eq.0) return
    x = i
    do while (x.le.bit%n)
      bit%arr(x) = bit%arr(x)+v
      x = x+and(x,-x)
    end do
    return
  end subroutine add
  function summate(bit,i) result(s)
    implicit none
    type(fenwick_tree) :: bit
    integer, intent(in) :: i
    integer :: x, s
    x = i
    s = 0
    do while (x.gt.0)
      s = s+bit%arr(x)
      x = x-and(x,-x)
    end do
    return
  end function summate
  subroutine update(bit,i,v)
    implicit none
    type(fenwick_tree) :: bit
    integer, intent(in) :: i, v
    integer :: x
    x = i
    do while (x.le.bit%n)
      if (bit%arr(x).lt.v) bit%arr(x) = v
      x = x+and(x,-x)
    end do
    return
  end subroutine update
  function maximum(bit,i) result(m)
    implicit none
    type(fenwick_tree) :: bit
    integer, intent(in) :: i
    integer :: x, m
    x = i
    m = 0
    do while (x.gt.0)
      m = max(m,bit%arr(x))
      x = x-and(x,-x)
    end do
    return
  end function maximum
end module mod_binary_indexed_tree
program sorted_and_sorted
  use mod_binary_indexed_tree
  implicit none
  integer, parameter :: infty = 1000000000
  type(fenwick_tree) :: bit
  integer :: n, a, aw, ab, i, j
  integer :: ib(2000), iw(2000), dp(0:2000,0:2000)
  character(1) :: c
  ib = 0
  iw = 0
  dp = infty
  dp(0,0) = 0
  read(*,*) n
  call init_bit(bit,2*n)
  do i = 1, 2*n
    read(*,*) c, a
    if (c.eq."B") then
      ib(a) = i
    else
      iw(a) = i
    end if
  end do
  do i = 0, n
    if (i.ne.0) then
      call add(bit,1,1)
      call add(bit,ib(i),-1)
    end if
    do j = 0, n
      if (j.ne.0) then
        call add(bit,1,1)
        call add(bit,iw(j),-1)
      end if
      if (i.ne.0) dp(i,j) = min(dp(i,j),dp(i-1,j)+ib(i)-i-j+summate(bit,ib(i)))
      if (j.ne.0) dp(i,j) = min(dp(i,j),dp(i,j-1)+iw(j)-i-j+summate(bit,iw(j)))
    end do
    do j = n, 1, -1
      call add(bit,1,-1)
      call add(bit,iw(j),1)
    end do
  end do
  write(*,'(i0)') dp(n,n)
  call release_bit(bit)
  stop
end program sorted_and_sorted

Measured memory_bytes: 15872
#include <stdio.h>
int main(void){
    int cards[4][14];
    int i,j;
    int a,n;
    char m,d;

    for(i=0; i<4; i++){
        for(j=0; j<14;j++){
            cards[i][j]=0;
        }
    }    
    scanf("%d", &a);
    for(i=0; i<a; i++){
        scanf("%c", &d);
        scanf("%c %d", &m, &n);
        if(m=='S'){
            cards[0][n]=1;
        }
        else if(m=='H'){
            cards[1][n]=1;
        }
        else if(m=='C'){
            cards[2][n]=1;
        }
        else if(m=='D'){
            cards[3][n]=1;
        }
    }
    
    for(j=1; j<14; j++){
        if(cards[0][j]!=1) printf("S %d\n", j);
    }
    for(j=1; j<14; j++){
        if(cards[1][j]!=1) printf("H %d\n", j);
    }
    for(j=1; j<14; j++){
        if(cards[2][j]!=1) printf("C %d\n", j);
    }
    for(j=1; j<14; j++){
        if(cards[3][j]!=1) printf("D %d\n", j);
    }
    
    return 0;
}


Measured memory_bytes: 2120
#pragma GCC optimize("O3")
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("unroll-loops")

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds; 

#define int long long
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define f first
#define s second
#define sz(x) (int)x.size()
#define endl '\n'
#define forn(i,n) for(int i=0;i<n;++i)
#define fore(i,l,r) for(int i=int(l);i<=int(r);++i)
#define rep(i,begin,end) for(__typeof(end) i=(begin);i!=(end);i++)
#define fill(a,value) memset(a,value,sizeof(a));
#define gcd(a,b) __gcd((a),(b))
#define watch1(x) cout << (x) << endl
#define watch2(x,y) cout << (x) << " " << (y) << endl
#define watch3(x,y,z) cout << (x) << " " << (y) << " " << (z) << endl
#define fastio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);

typedef long long ll;
typedef long double ld; 
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef tree<pii,null_type,less<pii>,rb_tree_tag,tree_order_statistics_node_update> oset;

// find_by_order(k) returns iterator to kth element starting from 0;
// order_of_key(k) returns count of elements strictly smaller than k;

const int mod = 1e9 + 7;
const int inf = 9e18;
const int N = 2e5 + 5;

int i,j,n,k,d;

void solve(){
    cin>>n>>k;
    vi freq(n+1);
    for(i=1;i<=k;++i){
        int d;
        cin>>d;
        for(j=1;j<=d;++j){
            int a;
            cin>>a;
            freq[a]++;
        }
    }
    int ans=0;
    for(i=1;i<=n;++i){
        ans+=(freq[i]==0);
    }
    cout<<ans;
}

signed main(){
    fastio;
    int t;
    //cin>>t;
    t=1;
    while(t--){
        solve();
        cout<<endl;
    }
    return 0;
}

Measured memory_bytes: 3652
# -*- coding:utf-8-*-
"""
1~Nの料理がある
{Ai}は実際に食べた順番である。
{Bi}はiを食べたときに得られる満足度である。
{Ci}はiを食べた直後にi+1を食べたときに得られる追加の満足度である。
"""
# 入力
N=int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))

manzoku=0

pre_dish = None
for ai in A:
    ai_index = ai-1
    manzoku += B[ai_index]
    if pre_dish == ai-1: # 前に食べたものがai-1
        pre_dish_index=pre_dish-1
        manzoku += C[pre_dish_index]
        pre_dish = ai
    else:
        pre_dish = ai

print(manzoku)


Measured memory_bytes: 3064
///////////////////////////////////////////// Template /////////////////////////////////////////////
#![allow(non_snake_case, unused)]
use std::collections::*;

//////////////////// missing functions in 1.15.1 ////////////////////
macro_rules! eprint {
	($($t:tt)*) => { {
		use ::std::io::Write;
		let _ = write!(::std::io::stderr(), $($t)*);
	} };
}
macro_rules! eprintln {
	($($t:tt)*) => { {
		use ::std::io::Write;
		let _ = writeln!(::std::io::stderr(), $($t)*);
	} };
}

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

macro_rules! debug {
	($($v: expr),*) => {
		$(eprint!("{} = {:?} ", stringify!($v), $v);)*
		eprintln!("@ {}:{}", file!(), line!());
	}
}

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

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

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

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

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

fn run() {
	let N = read!(usize);
	let a = read!([i64]);
	println!("{}", a.iter().sum::<i64>() - N as i64);
}


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

typedef long long ll;
typedef pair<int,int> P;

#define p_ary(ary,a,b,i) do { cout << "["; for (int (i) = (a);(i) < (b);++(i)) cout << ary[(i)] << ((b)-1 == (i) ? "" : ", "); cout << "]\n"; } while(0)
#define p_map(map,it) do {cout << "{";for (auto (it) = map.begin();;++(it)) {if ((it) == map.end()) {cout << "}\n";break;}else cout << "" << (it)->first << "=>" << (it)->second << ", ";}}while(0)

int main() {
    int n;
    cin >> n;
    vector<int> w(n),s(n),v(n);
    vector<P> a(n);
    vector<vector<ll>> dp(n+1,vector<ll>(20010,0));
    for (int i = 0;i < n;++i) cin >> w[i] >> s[i] >> v[i];
    for (int i = 0;i < n;++i) a[i] = P(w[i]+s[i],i);
    sort(a.begin(),a.end());
    for (int i = 0;i < n;++i) {
        int x = a[i].second;
        for (int j = 0;j < 20010;++j) dp[i+1][j] = dp[i][j];
        for (int j = 0;j <= s[x];++j) if (j+w[x] < 20010) dp[i+1][j+w[x]] = max(dp[i+1][j+w[x]],dp[i][j]+v[x]);
    }
    cout << *max_element(dp[n].begin(),dp[n].end()) << endl;
    return 0;
}

Measured memory_bytes: 160640
from itertools import permutations

N, M = map(int, input().split())
matrix = [[0] * N for i in range(N)]
ans = 0

for i in range(M):
    a, b = map(int, input().split())
    matrix[a-1][b-1] = 1
    matrix[b-1][a-1] = 1

for p in list(permutations(range(N))):
    if p[0] != 0:
        continue
    else:
        check = 1
        for i in range(N - 1):
            check *= matrix[p[i]][p[i+1]]
        ans += check

print(ans)

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

int main(){
  long n;
  cin >> n;
  long a[n];
  rep(i,n)cin >> a[i];
  long prime[1000001],flag[1000001];
  rep(i,1000001){
    prime[i] = i;
    flag[i] = 0;
  }
  for(int i=2;i*i<=1000000;i++){
    if(prime[i]==i){
      for(int j=i;j*i<=1000000;j++){
        if(prime[j*i] == j*i)prime[j*i] = i;
      }
    }
  }
  int pairflag = 1;
  rep(i,n){
    long tmp = a[i];
    vector<long> pri;
    while(tmp > 1){
      if(flag[prime[tmp]] != 0){
        pairflag = 0;
        i = n;
        break;
      }
      pri.push_back(prime[tmp]);
      tmp /= prime[tmp];
    }
    rep(j,int(pri.size()))flag[pri[j]] = 1;
  }
  if(pairflag){
    cout << "pairwise coprime\n";
    return 0;
  }
  long res = a[0];
  rep(i,n-1){
    res = __gcd(a[i+1],res);
  }
  if(res == 1)cout << "setwise coprime\n";
  else cout << "not coprime\n";
  return 0;
}

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

int main(){
	int N , a , answer = 0 ,tmp = 0;
  	cin >> N;
  	vector<int> A(N);
  
  	for (int i = 0 ; i  < N ; i++){
    	cin >> A.at(i);
    }
  	
  for (int i = 0 ; i < N ; i++){
  	for(int j = i+1 ; j < N ; j ++){
    	if(A.at(i) < A.at(j)){
        	tmp = A.at(j);
          	A.at(j) = A.at(i);
          	A.at(i) = tmp;
        }
    }
  }
  
    if (N % 2 == 0){
    	for(int i = 0 ; i < N / 2 ; i ++){
            answer += A.at(2*i) - A.at(2*i+1); 
        }
    }else{
      	for(int i = 0 ; i < N / 2 ; i ++){
        	answer += A.at(2*i) - A.at(2*i+1); 
        }
        answer += A.at(N-1);
    }
    cout << answer << endl;
}

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

using namespace std;
using ll = long long;
using v1 = vector<int>;
using vl = vector<long long>;
using v2 = vector<vector<int>>;
using v3 = vector<vector<char>>;

v2 a(3, v1(3));
int n;

int main(){
	rep(i, 3){
		rep(j, 3){
			cin >> a[i][j];
		}
	}
	cin >> n;
	rep(i, n){
		int x;
		cin >> x;
		rep(i, 3){
			rep(j, 3){
				if(a[i][j] == x){
					a[i][j] = 0;
				}
			}
		}
	}
	rep(i, 3){
		if(a[i][0] == 0 && a[i][1] == 0 && a[i][2] == 0){
			cout << "Yes" << endl;
			return 0;
		}
	}
	rep(i, 3){
		if(a[0][i] == 0 && a[1][i] == 0 && a[2][i] == 0){
			cout << "Yes" << endl;
			return 0;
		}
	}
	if(a[1][1] == 0 && a[2][2] == 0 && a[0][0] == 0){
		cout << "Yes" << endl;
		return 0;
	}
	if(a[0][2] == 0 && a[1][1] == 0 && a[2][0] == 0){
		cout << "Yes" << endl;
		return 0;
	}
	cout << "No" << endl;
}


Measured memory_bytes: 3632
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <functional>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> P;
#define rep(i,a,n) for(ll i = (a);i < (n);i++)
#define per(i,a,n) for(ll i = (a);i > (n);i--)
#define lep(i,a,n) for(ll i = (a);i <= (n);i++)
#define pel(i,a,n) for(ll i = (a);i >= (n);i--)
#define clr(a,b) memset((a),(b),sizeof(a))
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(),(c).end()
#define sz size()
#define print(X) cout << (X) << endl
const ll INF = 1e+9+7;
ll n,m,l;
string s,t;
ll d[10001],dp[100][100];

int main(){
  cin >> n >> m;
  if(n % 3 == 0 || m % 3 == 0 || (n+m) % 3 == 0)puts("Possible");
  else puts("Impossible");
  return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<vector>
#include<algorithm>
#include<utility>
#include<numeric>
#include<iostream>
#include<array>
#include<string>
#define _USE_MATH_DEFINES

#include<math.h>
#include<unordered_map>

#define min(a,b) (a)>(b)?(b):(a)
#define max(a,b) (a)>(b)?(a):(b)

using namespace std;

int main()
{
	vector<string> s;

	while (true)
	{
		string ts;
		cin >> ts;
		if (ts == "0")
		{
			break;
		}
		else
		{
			s.push_back(ts);
		}
	}

	for (int i = 0; i != s.size(); i++)
	{
		int digits = 0;
		for (auto& c : s[i])
		{
			digits += (c - '0');
		}
		printf("%d\n", digits);
	}
	return 0;
}

Measured memory_bytes: 3348
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb emplace_back
typedef long long ll;
typedef pair<int,int> pint;

int g[8][8];
int h,w,c;
bool used[8][8];
const int dx[]={-1,0,1,0},dy[]={0,-1,0,1};
int dfs(int cnt,int tg[8][8]){
    int ret=0;
    if(cnt==5){
        int mx=0;
        memset(used,0,sizeof(used));
        rep(i,h)rep(j,w)if(!used[i][j]&&tg[i][j]==c){
            int cnt=0;
            queue<pint> q;
            q.push({j,i});
            used[j][i]=true;
            while(!q.empty()){
                pint pi=q.front();q.pop();
                ++cnt;
                rep(k,4){
                    int tx=pi.first+dx[k],ty=pi.second+dy[k];
                    if(tx>=0&&ty>=0&&tx<w&&ty<h&&tg[ty][tx]==c&&!used[ty][tx]){
                        q.push({tx,ty});
                        used[ty][tx]=true;
                    }
                }
            }
            mx=max(mx,cnt);
        }
        return mx;
    }
    else{
        rep(i,6){
            if(tg[0][0]==i) continue;
            int cc=tg[0][0];
            int ttg[8][8];
            rep(j,h)rep(k,w) ttg[j][k]=tg[j][k];
            memset(used,0,sizeof(used));
            queue<pint> q;
            q.push({0,0});
            used[0][0]=true;
            while(!q.empty()){
                pint pi=q.front();q.pop();
                ttg[pi.second][pi.first]=i;
                rep(j,4){
                    int tx=pi.first+dx[j],ty=pi.second+dy[j];
                    if(tx>=0&&ty>=0&&tx<w&&ty<h&&tg[ty][tx]==cc&&!used[ty][tx]){
                        q.push({tx,ty});
                        used[ty][tx]=true;
                    }
                }
            }
            ret=max(ret,dfs(cnt+1,ttg));
        }    
    }
    return ret;
}
int main(){
    while(cin>>h>>w>>c,h){
        --c;
        rep(i,h)rep(j,w) cin>>g[i][j],--g[i][j];
        cout<<dfs(0,g)<<endl;
    }
    return 0;
}


Measured memory_bytes: 3084
//
//  main.cpp
//  AC
//
//  Created by makinofuya on 2019/07/08.
//  Copyright © 2019 makinofuya. All rights reserved.
//
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <stack>
#include <math.h>
#include <map>

typedef long long ll;
using namespace std;
#define mod 1000000007
#define rep(i,n) for(ll i=0;i<n;i++)
#define out(s) cout << s << endl


int main(){
    int n;cin >> n;
    vector<int>t(n);
    int ans=0;
    rep(i,n){
        cin >> t[i];
        ans+=t[i];
    }
    int m;cin >> m;
    vector<int>p(m),x(m);
    rep(i,m){
        cin >> p[i] >> x[i];
    }
    
    rep(i,m){
        int dif=t[p[i]-1]-x[i];
        cout << ans-dif << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
using namespace std;
int main() {
  
  int A,B,C,D;cin>>A>>B>>C>>D;
  
  if(abs(A-B)<=D&&abs(B-C)<=D||abs(A-C)<=D){
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }
}

Measured memory_bytes: 3600
#include <cstdio>
//找规律 不用真正模拟计算，只要找出数字个数的规律
int main(void)
{
    int a1count = 0, a2count = 0, a4count = 0;
    int i, N, x;
    scanf("%d", &N);
    while (N--)
    {
        scanf("%d", &x);
        if (x % 4 == 0)
            a4count++; //是4的倍数，可以放在任何数旁边构成幸运数列
        else if (x % 2 == 0)
            a2count++; //不是4但是2的倍数，要么放在a4旁边，要么放在a2 自己旁边
        else
            a1count++;//不是2的倍数，也不是4的倍数，就是其他数字，必须放在a4旁边
    }
    //先让a1与a4交替出现，a1的个数只能比a4的个数最多多一个，最好小于a4的个数
    if (a2count > 0 && a1count <= a4count) //类似 a1,a4,a1,a4,a2,a2,a2...
        printf("Yes\n");
    else if (a2count == 0 && a1count <= a4count + 1)//类似 a1,a4,a1 
        printf("Yes\n");
    else
        printf("No\n");

    return 0;
}

Measured memory_bytes: 128
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
struct node{
	char s[15];
}q[200010];
int cnt[200010];
int cmp(node a,node b){
	return strcmp(a.s,b.s)<0;
}
int max(int a,int b){
	return a>b?a:b;
}
int main(){
	int n,i,mx=0;
	scanf("%d",&n);
	for(i=1;i<=n;i++)scanf("%s",q[i].s);
	sort(q+1,q+1+n,cmp);
	for(i=1;i<=n;i++){
		cnt[i]=1;
		if(strcmp(q[i].s,q[i-1].s)==0)cnt[i]+=cnt[i-1];
	}
	for(i=1;i<=n;i++)
		mx=max(mx,cnt[i]);
	for(i=1;i<=n;i++)
		if(mx==cnt[i])printf("%s\n",q[i].s);
}


Measured memory_bytes: 5632
(let ((h (read))
      (w (read))
      (d (read))
      (co (make-array '(100000 2) :element-type 'integer
                                 :initial-element 0
                                 :adjustable t))
      (dif (make-array '(100000) :element-type 'integer
                                :initial-element 0
                                :adjustable t))
      q
      l
      r)
  (dotimes (i h)
    (dotimes (j w)
      (setf q (read))
      (setf (aref co q 0) i)
      (setf (aref co q 1) j)))
  (loop for x from (1+ d) upto (* h w)
        do (setf (aref dif x) (+ (aref dif (- x d)) (abs (- (aref co x 0) (aref co (- x d) 0))) (abs (- (aref co x 1) (aref co (- x d) 1))))))
  (setf q (read))
  (loop repeat q
    do (setf l (read))
       (setf r (read))
       (format t "~A~%" (- (aref dif r) (aref dif l)))))

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

typedef long long int ll;
#define rep(i,n) for (int i = 0; i < (n); i++)

const ll mod = 1000000007;

int main() {
    int n,m;
    cin >> n >> m;
    ll s[n];
    rep(i,n) cin >> s[i];
    ll t[m];
    rep(j,m) cin >> t[j];

    ll dp[n+1][m+1];
    rep(i,n+1) rep(j,m+1) dp[i][j] = 0;
    rep(i,n+1) dp[i][0] = 1;
    rep(j,m+1) dp[0][j] = 1;

    rep(i,n) {
      rep(j,m) {
        dp[i+1][j+1] = (mod+dp[i+1][j]-dp[i][j]+dp[i][j+1])%mod;
        if (s[i] == t[j]) {
          dp[i+1][j+1] = (dp[i+1][j+1]+dp[i][j])%mod;
        }
      }
    }
    cout << dp[n][m] << endl;
    return 0;
}

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

#define _USE_MATH_DEFINES
#define F first
#define S second
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define remax(x, y) (x) = max((x), (y))
#define remin(x, y) (x) = min((x), (y))

using namespace std;

using ll = long long;
using pi = pair<int, int>;
using pll = pair<ll, ll>;

int main() {
    ios_base::sync_with_stdio(false);
    cout << setprecision(12);
    cin.tie(nullptr);

    int N, M;
    cin >> N >> M;

    vector<int> balls(N, 1);
    vector<bool> red(N);
    red[0] = true;

    forn(i, M) {
        int x, y;
        cin >> x >> y;
        x--, y--;

        if (red[x])
            red[y] = true;

        if (balls[x] == 1)
            red[x] = false;

        balls[x]--;
        balls[y]++;
    }

    int ans = 0;
    forn(i, N)
        if (red[i])
            ans++;

    cout << ans << endl;
}


Measured memory_bytes: 640
#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
#include<cassert>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
//問題文および制約はちゃんと確認しよう！
//サイズは10^5じゃなくて2×10^5とかかもしれないし、重要な制約・条件を見落としているかも
//とりあえずサンプルを読んでから解法を考えよう？
vector<pint> gr[100100];
/*int ve[100100],ed[100100];
bool used[100100];
int la;
ool dfs(int v,int d){
	ve[d]=v;
	if(used[v]){
		la=d;return true;
	}
	used[v]=true;
	rep(i,gr[v].size()){
		ed[d]=i;
		if(dfs(gr[v][i].fi,d+1)) return true;
	}
	used[v]=false;
	return false;
}*/
int pat[100100];lint dp[100100];
int n1=-1,n2=-1,o2=1;
void dfs(int v,int p,lint nu){
	//cout<<v<<' '<<p<<' '<<nu<<endl;
	dp[v]=nu;pat[v]=p;
	rep(i,gr[v].size()){
		int np=1-p,nv=gr[v][i].fi;
		if(pat[nv]!=-1){
			if(pat[nv]!=np) n1=v,n2=nv;
			else if(gr[v][i].se-nu!=dp[nv]) o2=0;
			continue;
		}
		dfs(nv,np,gr[v][i].se-nu);
	}
}
int ok=1;
void dfs2(int v,lint nu){
	if(nu<=0) ok=0;
	if(dp[v]>=0){
		if(nu<=0 || dp[v]!=nu){
			//cout<<v<<' '<<nu<<' '<<dp[v]<<endl;
			ok=0;
		}
		return;
	}
	dp[v]=nu;
	rep(i,gr[v].size()) dfs2(gr[v][i].fi,gr[v][i].se-nu);
}
int main()
{
	int n,m,u,v,s;
	cin>>n>>m;
	rep(i,m){
		cin>>u>>v>>s;u--;v--;
		gr[u].pb(mp(v,s));
		gr[v].pb(mp(u,s));
	}
	/*if(dfs(0,0)){
		int s;
		for(s=la-1;i>=0;i--){
			if(ve[s]==ve[la]) break;
		}
	}*/
	memset(pat,-1,sizeof(pat));
	dfs(0,0,0);
	//cout<<n1<<n2<<endl;
	if(o2==0){
		cout<<0<<endl;return 0;
	}
	if(n1<0){
		lint p0=0,p1=123456789012345678LL;
		rep(i,n){
			if(pat[i]==0) p0=min(p0,dp[i]);else p1=min(p1,dp[i]);
		}
		cout<<max(0LL,p0+p1-1LL)<<endl;
		return 0;
	}
	lint t;
	rep(i,gr[n1].size()){
		if(gr[n1][i].fi==n2) t=gr[n1][i].se;
	}
	//cout<<t<<' '<<dp[n1]<<' '<<dp[n2]<<endl;
	if((t+dp[n1]-dp[n2])%2!=0L){
		cout<<0<<endl;return 0;
	}
	lint x=(t+dp[n1]-dp[n2])/2;
	//cout<<x<<' '<<n1<<endl;
	memset(dp,-1,sizeof(dp));
	dfs2(n1,x);
	cout<<ok<<endl;
}

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

typedef long long ll;

int n;
ll p, a[10005];
string s;
vector<array<ll, 2>> v;
int mod = 998244353;
int main(){
	cin >> n;
	v.resize(n);
	for(int i=0;i<n;++i){
		cin >> v[i][0] >> v[i][1] ;
	}
	sort(v.begin(), v.end());
	vector<ll>dp(n+1, 0);
	dp[n] = 1;
	vector<pair<ll,ll>> p;
	p.push_back({n, 2e9});
	for(int i = n - 1; i >= 0;--i){
		while(v[i][0]+v[i][1] > p.back().second){
			p.pop_back();
		}

		int take = p.back().first;
		dp[i] = dp[take];
		dp[i] += dp[i+1];
		dp[i] %= mod;
		p.push_back({i, v[i][0]});
	}
	dp[0] += mod;
	dp[0] = dp[0]%mod;
	cout << dp[0];
}

Measured memory_bytes: 7156
#include <bits/stdc++.h>
using namespace std;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    vector<char> c;
    string s;
    cin >> s;
    char f = 'a';
    for (int j = 0; j < 26; j++)
    {
        char k = f + j;
        bool flag = true;
        // cout << k << " ";
        for (int i = 0; i < s.length(); i++)
        {
            if (s[i] == k)
            {
                flag = false;
            }
        }
        if (flag)
        {
            cout << k << endl;
            return 0;
        }
    }
    cout << "None" << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
int main(void){

    int H, N;
    cin >> H >> N;
    vector<int> A(N);
    for(int i=0; i<N; i++){
        cin >> A[i];
        H=H-A[i];
    }
    if(H<=0) cout << "Yes" << endl;
    else cout << "No" << endl;

}


Measured memory_bytes: 640
t = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
n = int(input())
print(t[n-1])

Measured memory_bytes: 3060
while True:
    n = int(input())
    if n == 0:
        break
    for _ in range(n):
        p = list(map(int, input().split()))
        x = sum(p) // 3
        if 100 in p:
            print("A")
        elif (p[0] + p[1]) // 2 >= 90:
            print("A")
        elif x >= 80:
            print("A")
        elif x >= 70:
            print("B")
        elif x >= 50 and (p[0] >= 80 or p[1] >= 80):
            print("B")
        else:
            print("C")

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

int main() {
	bool isPrime[1000000] = {true};

	for (int i = 0; i < 1000000; i++) {
		isPrime[i] = true;
	}

	isPrime[1] = false;
	for (int i = 2; i < 1000000; i++) {
		if (!isPrime[i])
			continue;

		if (isPrime[i]) {
			int k = 2*i;
			while (k < 1000000) {
				isPrime[k] = false;
				k += i;
			}
		}
	}

	int n;
	while (cin >> n) {
		int sum = 0;
		for (int i = 2; i <= n; i++) {
			if (isPrime[i])
				sum++;
		}
		cout << sum << endl;
	}

	return 0;
}

Measured memory_bytes: 3928
#include<bits/stdc++.h>
using namespace std;
struct node{
	int u,v,w;
}a[200005];
int fa[200005];
int find(int x){
	if(x!=fa[x])
		return fa[x]=find(fa[x]);
	return fa[x];
}
int cmp(node a,node b){
	return a.w<b.w;
}
int main(){
	int n,m;
	scanf("%d%d",&n,&m);
	int u,v,w;
	int cnt=0;
	for(int i=0;i<m;i++){
		scanf("%d%d%d",&a[cnt].u,&a[cnt].v,&w);
		a[cnt++].w=0;
	}
	for(int i=1;i<=n;i++)
		a[cnt].u=n+1,a[cnt].v=i,a[cnt++].w=1;
	for(int i=1;i<=n;i++)
		fa[i]=i;
	sort(a,a+cnt,cmp);
	int ans=0;
	for(int i=0;i<cnt;i++){
		int fx=find(a[i].u),fy=find(a[i].v);
		if(fx!=fy){
			ans+=a[i].w;
			fa[fy]=fx;
		}
		else continue;
	}
	printf("%d\n",ans); 
}


Measured memory_bytes: 3200
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ll;
const ll sz=1e18;
int n;
ll a[100005],ans=1;
int main(){
	cin>>n;
	bool f=0;
	for(int i=0;i<n;++i){
		cin>>a[i];
		if(a[i]==0){
			f=1;
		}
	}
	if(f){
		cout<<"0\n";
		return 0;
	}
	for(int i=0;i<n;++i){
		ll prev=ans;
		ans*=a[i];
		if(ans<prev||ans>sz){
			cout<<"-1\n";
			return 0;
		}
	}
	cout<<ans<<'\n';
	return 0;
}

Measured memory_bytes: 4372
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using ld=long double;
using P=pair<ll,ll>;
#define MOD 1000000007ll
#define INF 1000000000ll
#define EPS 1e-7
#define FOR(i,n,m) for(ll i=n;i<(ll)m;i++)
#define REP(i,n) FOR(i,0,n)
#define DUMP(a) REP(d,a.size()){cout<<a[d];if(d!=a.size()-1)cout<<" ";else cout<<endl;}
#define ALL(v) v.begin(),v.end()
#define UNIQUE(v) sort(v.begin(),v.end());v.erase(unique(v.begin(),v.end()),v.end());
#define pb push_back

class segtree {
#define SEG_MAX ((1ll<<60)-1)
public:
	segtree(int n) {
		_n=1;
		while(_n<n) _n*=2;
		_dat.resize(2*_n-1);
		for(int i=0;i<2*_n-1;++i) _dat[i]=-(SEG_MAX);
	}
	int size() {
		return _n;
	}
	void update(int k,long long a) {
		k+=_n-1;
		_dat[k]=a;
		while(k>0) {
			k=(k-1)/2;
			_dat[k]=max(_dat[k*2+1],_dat[k*2+2]);
		}
	}
	// return the minimum number in [a,b)
	// external call should be written like query(a,b,0,0,_n)
	ll query(int a,int b,int k=0,int l=0,int r=-1) {
		if(r==-1) r=_n;
		if(r<=a||b<=l) return -(SEG_MAX);
		if(a<=l&&r<=b) return _dat[k];
		else {
			ll vl=query(a,b,k*2+1,l,(l+r)/2);
			ll vr=query(a,b,k*2+2,(l+r)/2,r);
			return max(vl,vr);
		}
	}
private:
	int _n;
	vector<ll> _dat;
};

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n;
	cin>>n;
	ll sum=n*(n+1)/2;
	vector<ll> x(n);
	segtree seg(n);
	REP(i,n) {
		cin>>x[i];
		x[i]--;
	}
	REP(i,n) {
		if(seg.query(0,x[i])==-(SEG_MAX)) seg.update(x[i],x[i]+1);
		else seg.update(x[i],seg.query(0,x[i])+x[i]+1);
	}
	cout<<sum-seg.query(0,n)<<endl;
}



Measured memory_bytes: 5744
import sys, re
from math import ceil, floor, sqrt, pi, factorial, gcd
from copy import deepcopy
from collections import Counter, deque
from heapq import heapify, heappop, heappush
from itertools import accumulate, product, combinations, combinations_with_replacement
from bisect import bisect, bisect_left, bisect_right
from functools import reduce
from decimal import Decimal, getcontext
# input = sys.stdin.readline 
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_str(N): return [s_list() for _ in range(N)]
def s_row_list(N): return [list(s_input()) for _ in range(N)]
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 6)
INF = float('inf')
MOD = 10 ** 9 + 7
num_list = []
str_list = []

def main():
    n = i_input()
    num_list = i_list()

    tmp_list = [0] * 10 ** 5

    for i in range(n):
        tmp_list[num_list[i]] += 1

    count = 0

    for i in range(10**5-2):
        tmp = tmp_list[i] + tmp_list[i+1] + tmp_list[i+2]
        count = max(count, tmp)

    print(count)

if __name__ == '__main__':
    main()


Measured memory_bytes: 85688
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor, cos, radians, pi, sin
from operator import mul
from functools import reduce
from operator import mul


sys.setrecursionlimit(2147483647)
INF = 10 ** 13
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 10 ** 9 + 7


n = I()
s = S()
s1 = s[:n]
s2 = s[n:][::-1]
D1 = defaultdict(int)
D2 = defaultdict(int)
for i in range(2 ** n):
    a1 = ""
    b1 = ""
    for j in range(n):
        if i >> j & 1:
            a1 += s1[j]
        else:
            b1 += s1[j]
    D1[(a1, b1)] += 1

for i in range(2 ** n):
    a2 = ""
    b2 = ""
    for j in range(n):
        if i >> j & 1:
            a2 += s2[j]
        else:
            b2 += s2[j]
    D2[(a2, b2)] += 1

ret = 0
for i in D1:
    ret += D1[i] * D2[i]

print(ret)







Measured memory_bytes: 297220
#include<stdio.h>
int main(void){
	int a,b,c,d;
	scanf("%d %d %d",&a,&b,&c);
	if(a>b){
		d=a;
		a=b;
		b=d;
	}
	if(b>c){
		d=b;
		b=c;
		c=d;
	}
	if(a>b){
		d=a;
		a=b;
		b=d;
	}
	printf("%d %d %d\n",a,b,c);
	return 0;
}

Measured memory_bytes: 596
#include <bits/stdc++.h>
#define PI 3.14159265359
using namespace std;
template <class T>
inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
const long long INF = 1LL << 60;
using pll = pair<long long, long long>;

int main() {
  // 標準入力が早くなる。Cスタイルの入出力とC++スタイルの入出力を混合させてはならない。
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);

  int N;
  cin >> N;
  map<long long, long long> sum;
  map<long long, long long> dif;

  for (int i = 1; i <= N; i++) {
    int tmp;
    cin >> tmp;
    ++sum[i + tmp];
    ++dif[i - tmp];
  }
  long long res = 0;

  /*
  なぜ、for文をN回しか回さないのか

  https://img.atcoder.jp/abc166/editorial.pdf
  i + Ai = j − Aj
  この問題では上記の式が元になっています。

  懸念してる点は1≤Ai≤10^9(1≤i≤N)だからN回for文を回すと漏れがでるのではということです。
  そのように考える理由はsumとdifのkeyには10^9や負数もありえるからです。(サンプルケースでも出ます。)
  でも、そんなことは考える必要はありません。
  keyが0~N-1の範囲以外のものがマッチング?するのは無理だからです。

  2≤N≤2×10^5
  1≤Ai≤10^9(1≤i≤N)
  という制約から
  j - Aj < N (負数もありえる。)
  i + Ai > N (負数はありえない)
  これで、keyがN以上、0以下のものを見る必要がないからです。
  片方がkeyがN以上もつが、もう片方はもつことはない
  負数に関しても同じです。

  なので、forをN回回せば十分です。
  */
  for (int i = 0; i < N; i++) {
    res += sum[i] * dif[i];
  }

  cout << res << endl;

  return 0;
}


Measured memory_bytes: 46448
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,o,n) for(long long i = o;i<n;i++)
#define oneforall ios::sync_with_stdio(false);cin.tie(0);
#define all(v) (v).begin(),(v).end()
#define ini(...) int __VA_ARGS__; in(__VA_ARGS__)
#define inl(...) long long __VA_ARGS__; in(__VA_ARGS__)
#define ins(...) string __VA_ARGS__; in(__VA_ARGS__)
#define int long long 
const long long INF=1e18;
void in(){} template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);}
void out(){cout << "\n";} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);}
typedef vector<int> vi;
typedef vector<long long> vl;
typedef long long ll;
typedef vector<pair<long, long > > vpll;
typedef vector<pair<int, int > > vpii;
#define FORR(x,arr) for(auto& x:arr)

/*
bool isprime(int x){
	for(int i = 2;i*i<=x;i++){
		if(x%i == 0)return false;
	}
	return x!=1;
}
int gcd(int a, int b) 
{ 
    if (a == 0) 
       return b; 
    if (b == 0) 
       return a; 
   
    if (a == b) 
        return a; 
   
    if (a > b) 
        return gcd(a-b, b); 
    return gcd(a, b-a); 
} 
void dfs(int x,int y){
		if(x == n+1){
			int tmp = 0;
			FOR(i,0,k){
				if(tmp1[mortyy[i]]-tmp1[morty[i]] == mortyyy[i])tmp+=mortyyyy[i];
			}
			rick = max(rick,tmp);
			return ;
		}
		int i;
		for(i = y;i<=n1;i++){
			tmp1[x] = i;
			dfs(x+1,i);
		}
	}
*/


int gcd(int a, int b){
    return b==0 ? a : gcd(b, a%b);
}
int lcm(int a, int b){
    return a * (b/gcd(a, b));
}
//3111111111111111111111111111111


	void solve(){

		ini(n);
		ini(n1);
		vi morty(n);
		FOR(i,0,n){
			in(morty[i]);
			morty[i]/=2;
		}
		int ll = 1;
		FOR(i,0,n){
			ll  = lcm(ll,morty[i]);
			if(ll >1e9)return out(0);
		}
		FOR(i,0,n){
			if((ll/morty[i])%2 == 0)return out(0);
		}
		int rick = n1/ll;
		out((rick+1)/2);
















	}









































int32_t main() {
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall 
	oneforall

	solve();
	


	return 0;
}

Measured memory_bytes: 1024
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define int ll
#define double long double
#define YES {cout<<"YES"<<'\n';}
#define NO {cout<<"NO"<<'\n';}
#define Yes {cout<<"Yes"<<'\n';}
#define No {cout<<"No"<<'\n';}
#define yes {cout<<"yes"<<'\n';}
#define no {cout<<"no"<<'\n';}
void YN(bool flg){cout<<(flg?"YES":"NO")<<'\n';}
void Yn(bool flg){cout<<(flg?"Yes":"No")<<'\n';}
void yn(bool flg){cout<<(flg?"yes":"no")<<'\n';}
#define SORT(a) sort(a.begin(),a.end())
#define REVERSE(a) reverse(a.begin(),a.end())
#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 out(n) {cout << n << '\n';}
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<VI> VVI;
const int MOD = 1000000007;
const long long INF = 10e10;
const double PI = acos(-1.0);
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T>auto MAX(const T& a) { return *max_element(a.begin(),a.end()); }
template<class T>auto MIN(const T& a) { return *min_element(a.begin(),a.end()); }
int ABS(int a) {if(a<0) a = -a; return a;}
template<class T, class U>U SUM(const T& a, const U& v) { return accumulate(a.begin(),a.end(), v); }
template<class T, class U>U COUNT(const T& a, const U& v) { return count(a.begin(),a.end(), v); }
template<class T, class U>int LOWER(const T& a, const U& v) { return lower_bound(a.begin(),a.end(), v) - a.begin(); }
template<class T, class U>int UPPER(const T& a, const U& v) { return upper_bound(a.begin(),a.end(), v) - a.begin(); }
int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
int LCM(int a, int b) { int g = GCD(a, b); return a / g * b; }
int POW(int a, int n) { int r = 1; while (n > 0) { if (n & 1)r *= a; a *= a; n /= 2; }return r; }
int isPrime(int n){if(n<2){return 0;}for(int i=2; i*i<=n; i++){if(n%i==0){return 0;}}return 1;}
/*素因数分解*/map< int, int >prime_factor(int n){map< int, int > ret;for(int i = 2; i * i <= n; i++) {while(n % i == 0) {ret[i]++;n /= i;}}if(n != 1) ret[n] = 1;return ret;}
/*約数の個数*/int divisor_number(int n){auto p = prime_factor(n); int res = 1; for(auto x:p)res*=(x.second+1); return res;}
/*約数列挙*/vector<int> divisor(int n){vector<int> v; for(int i=1; i*i<=n; i++){if(n%i==0){v.push_back(i);if(i!=n/i){v.push_back(n/i);}}}sort(v.begin(),v.end()); return v;}
//----------------ライブラリとか----------------

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout<<fixed<<setprecision(15);

    int d,n; cin >> d >> n;
    out(POW(100,d)*(n/100+n));

    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<iostream>
#include<cmath>
#include<iomanip>
#include<cstring>
#define R register
#define EN printf("\n")
#define LL long long
inline int read(){
	int x=0,y=1;
	char c=std::getchar();
	while(c<'0'||c>'9'){if(c=='-') y=-1;c=std::getchar();}
	while(c>='0'&&c<='9'){x=x*10+(c^48);c=std::getchar();}
	return x*y;
}
int n;
int main(){
	int h=read(),a=read();
	std::printf("%d",(int)std::ceil((double)h/a)); 
	return 0;
}


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

int main(int argc, char **argv) {
  int N, M, X, Y;
  cin >> N >> M >> X >> Y;
  
  vector<int> x, y;
  x.push_back(X);
  for (int i = 0; i < N; ++i) {
    int a;
    cin >> a;
    x.push_back(a);
  }
  sort(x.begin(), x.end());
  y.push_back(Y);
  for (int i = 0; i < M; i++) {
    int a;
    cin >> a;
    y.push_back(a);
  }
  sort(y.begin(), y.end());
  
  if (x.back() < y.front()) {
    cout << "No War" << endl;
  } else {
    cout << "War" << endl;
  }
  
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#define MAX 2000001
#define VMAX 10000

int main(){
  unsigned short *A, *B;

  int C[VMAX+1];
  int n, i, j;
  scanf("%d", &n);

  A = malloc(sizeof(short) * n + 1);
  B = malloc(sizeof(short) * n + 1);

  for ( i = 0; i <= VMAX; i++ ) C[i] = 0;

  for ( i = 0; i < n; i++ ){
    scanf("%hu", &A[i + 1]);
    C[A[i + 1]]++;
  }

  for ( i = 1; i <= VMAX; i++ ) C[i] = C[i] + C[i - 1];

  for ( j = 1; j <= n; j++ ){
    B[C[A[j]]] = A[j];
    C[A[j]]--;
  }

  for ( i = 1; i <= n; i++ ){
    if ( i > 1 ) printf(" ");
    printf("%d", B[i]);
  }
  printf("\n");

  return 0;
}


Measured memory_bytes: 9636