akhauriyash/Code-Regression huggingface dataset:
/*
    Author:zzugzx
    Lang:C++
    Blog:blog.csdn.net/qq_43756519
*/
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define endl '\n'
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int mod=1e9+7;
//const int mod=998244353;
const double eps = 1e-10;
const double pi=acos(-1.0);
const int maxn=1e6+10;
const ll inf=0x3f3f3f3f;
const int dir[4][2]={{0,1},{1,0},{0,-1},{-1,0}};


int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    int a,b;
    cin>>a>>b;
    cout<<a*b;
    return 0;
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
int main()
{
    long N;
    cin >> N;
    vector<long long> div(N + 1, 1);
    for (int i = 2; i <= N; i++)
    {
        if (div[i] == 1)
        {
            for (int j = 1; j * i <= N; j++)
            {
                int num = j * i;
                int ex = 0;
                while (num % i == 0)
                {
                    ex++;
                    num /= i;
                }
                div[j * i] *= ex + 1;
            }
        }
    }
    long long sum = 0;
    for (int i = 1; i <= N; i++)
    {
        //cout << i << "/" << div[i] << endl;
        sum += i * div[i];
    }
    cout << sum << endl;
}


Measured memory_bytes: 81400
#include <cassert>

#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
#define ll long long
#define all(v) ((v).begin(),(v).end())
#define Sort(v) sort(all(v))
#define INF 1000000000
#define endd return 0
using namespace std;
int day[12]={31,28,31,30,31,30,31,31,30,31,30,31};


int main(){
    string s;
    cin>>s;
    if(s[0]!='A'){
        cout<<"WA"<<endl;
        endd;
    }
    int count=0;
    rep(i,1,s.size()){
        if(2<=i && i<=s.size()-2){
            if(s[i]=='C')count++;
            else if('A'<=s[i]&&s[i]<='Z'&&s[i]!='C'){
                cout<<"WA"<<endl;
                endd;
            }
        }else{
            if('A'<=s[i]&&s[i]<='Z'){
                cout<<"WA"<<endl;
                endd;
            }
        }
    }
    if(count==1)cout<<"AC"<<endl;
    else cout<<"WA"<<endl;

}



    

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


int main() {

    int h, w;
    cin >> h >> w;
    string board[60];
    for (int i = 0; i < h; ++i) cin >> board[i];
    int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
    int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
    for (int i = 0; i < h; ++i) {
        for (int j = 0; j < w; ++j) {
            if (board[i][j] == '.') {
                int cnt = 0;
                for (int k = 0; k < 8; ++k) {
                    int ni = i + dx[k];
                    int nj = j + dy[k];
                    if (0 <= ni && ni < h && 0 <= nj && nj < w && board[ni][nj] == '#') {
                        ++cnt;
                    }
                }
                board[i][j] = '0' + cnt;
            }
        }
    }
    for (int i = 0; i < h; ++i) cout << board[i] <<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
 
int main()
{
    int multiplier,multiplicand;
 
    for( multiplicand = 1; multiplicand < 10 ; multiplicand++)
    {
       for(multiplier = 1; multiplier < 10 ; multiplier++)
           cout << multiplicand << "x" << multiplier << "=" << multiplicand * multiplier << endl;
    }
 
    return 0;
}

Measured memory_bytes: 3024
#include <stdio.h>
int main(void){
    // Your code here!
    int a[3][3];
    int n;
    int b[10];
    
    for(int i=0; i<3; i++){
        scanf("%d %d %d", &a[i][0], &a[i][1], &a[i][2]);
    }
    scanf("%d", &n);
    for(int i=0; i<n; i++){
        scanf("%d", &b[i]);
        
        for(int j=0; j<3; j++){
            for(int k=0; k<3; k++){
                if(a[j][k] == b[i]){
                    a[j][k] = 0;
                }
            }
        }
    }
    
    for(int j=0; j<3; j++){
        if(a[j][0]+a[j][1]+a[j][2] == 0){
            printf("Yes");
            return 0;
        }
    }
    for(int k=0; k<3; k++){
        if(a[0][k]+a[1][k]+a[2][k] == 0){
            printf("Yes");
            return 0;
        }
    }
    
    if(a[0][0]+a[1][1]+a[2][2] == 0){
        printf("Yes");
        return 0;

    }
    if(a[0][2]+a[1][1]+a[2][0] == 0){
        printf("Yes");
        return 0;
    }
    
    printf("No");
    return 0;
    
}


Measured memory_bytes: 128
#include <stdio.h>

int main(void)
{
    int k, p;
    int n;
    int i;
    int ans;
    
    
    scanf("%d", &n);
    
    for (i = 0; i < n; i++){
        scanf("%d %d", &k, &p);
        ans = k % p;
        if (ans == 0){
            ans = p;
        }
        
        printf("%d\n", ans);
    }
    
    return (0);
}

Measured memory_bytes: 596
var
 a,b:ansistring;
 i,len:longint;
begin
 readln(a);
 readln(b);
 len:=length(a);
 if len>length(b) then len:=length(b);
  for i:=1 to len do write(a[i],b[i]);
  if length(a)>length(b) then for i:=len+1 to length(a) do write(a[i])
                         else for i:=len+1 to length(b) do write(b[i]);
 writeln;
end.

Measured memory_bytes: 128
//#define NDEBUG
#include <cstddef>
#include <cstdint>
#include <vector>

using i8 = ::std::int_least8_t;
using i32 = ::std::int_least32_t;
using i64 = ::std::int_least64_t;
using u8 = ::std::uint_least8_t;
using u32 = ::std::uint_least32_t;
using u64 = ::std::uint_least64_t;
using isize = ::std::ptrdiff_t;
using usize = ::std::size_t;

class rep {
	const usize f, l;

public:
	class itr {
		friend rep;
		usize i;
		itr(usize x) noexcept : i(x) {}

	public:
		void operator++() noexcept { ++i; }
		usize operator*() const noexcept { return i; }
		bool operator!=(const itr x) const noexcept { return i != x.i; }
	};
	rep(usize first, usize last) noexcept : f(first), l(last) {}
	itr begin() const noexcept { return itr(f); }
	itr end() const noexcept { return itr(l); }
};
class revrep {
	const usize f, l;

public:
	class itr {
		friend revrep;
		usize i;
		itr(usize x) noexcept : i(x) {}

	public:
		void operator++() noexcept { --i; }
		usize operator*() const noexcept { return i; }
		bool operator!=(const itr x) const noexcept { return i != x.i; }
	};
	revrep(usize first, usize last) noexcept : f(first), l(last) {}
	itr begin() const noexcept { return itr(l - 1); }
	itr end() const noexcept { return itr(f - 1); }
};
template <class T> bool maxi(T &a, const T &b) {
	return a <= b ? (a = b, 1) : 0;
}
template <class T> bool mini(T &a, const T &b) {
	return b <= a ? (a = b, 1) : 0;
}
template <class T> bool smaxi(T &a, const T &b) {
	return b <= a ? 0 : (a = b, 1);
}
template <class T> bool smini(T &a, const T &b) {
	return a <= b ? 0 : (a = b, 1);
}
template <class T> using vec_alias = ::std::vector<T>;
template <class T> auto md_vec(usize n, const T &value) {
	return ::std::vector<T>(n, value);
}
template <class... Args> auto md_vec(usize n, Args... args) {
	return ::std::vector<decltype(md_vec(args...))>(n, md_vec(args...));
}
template <class T> const T &as_const(const T &v) noexcept { return v; }

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

int main() {
	usize n;
	u32 l;
	::std::cin >> n >> l;
	u32 ans = 1 << 10;
	while (n--) {
		u32 c, t;
		::std::cin >> c >> t;
		if (t <= l)
			smini(ans, c);
	}
	if (ans == 1 << 10) {
		::std::cout << "TLE" << ::std::endl;
	}
	else {
		::std::cout << ans << ::std::endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,m,n) for(int i=m;i<n;i++)
#define co(n) cout<<n<<endl
using namespace std;

int main(){ 
  int a=0,b=0,c=0,d=0,n,x,y,m;
  cin>>a>>b;
  int aa[b];
  rep(i,0,b){
    cin>>aa[i];
    c+=aa[i];
    d=max(d,aa[i]);
  }
  c-=d;
  if(c+1>=d) co(0);
  else co(d-c-1);
  
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define N 100005
using namespace std;
int n;
int a[N],dis[N];
vector<int> g[N];
void DFS(int u){
    vector<int> t;
    for(int i:g[u]) DFS(i),t.push_back(dis[i]+1);
    sort(t.begin(),t.end());
    for(int i=0,v=t.size()-1;i<t.size();i++,v--)
        dis[u]=max(dis[u],v+t[i]);
}
int main(){
    scanf("%d",&n);
    for(int i=2;i<=n;i++) scanf("%d",&a[i]),g[a[i]].push_back(i);
    DFS(1);
    cout<<dis[1]<<endl;
    return 0;
}

Measured memory_bytes: 15872
#include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>

using namespace std;

#define FOR(i,k,n) for(int i=(k); i<(int)n; ++i)
#define REP(i,n) FOR(i,0,n)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

template<class T> void debug(T begin, T end){ for(T i = begin; i != end; ++i) cout<<*i<<" "; cout<<endl; }

typedef long long ll;
const int INF = 100000000;
const double EPS = 1e-8;
const int MOD = 1000000007;
typedef pair<int, int> P;

int main(){
  int N, M;
  while(cin>>N>>M && N){
    P t[20000];
    int from[20000], to[20000];
    set<int> virus;
    virus.insert(1);
    REP(i, M){
      cin>>t[i].first>>from[i]>>to[i];
      t[i].second = i;
    }
    sort(t, t + M);
    REP(i, M){
      int idx = t[i].second;
      if(virus.count(from[idx])){
        virus.insert(to[idx]);
      }
    }
    cout<<virus.size()<<endl;
  }
  return 0;
}

Measured memory_bytes: 1692
#include"bits/stdc++.h"
#include <boost/multi_array.hpp>
#include <boost/optional.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/algorithm.hpp>
#include <boost/range/adaptors.hpp>
//#include <vector>
//#include <iostream>

typedef long long ll;
typedef unsigned long long ull;


bool keys[1000];
bool search(std::string S, int N, int candidate) {
	std::ostringstream sout;
	sout << std::setfill('0') << std::setw(3) << candidate;

	std::string v = sout.str();



	int temp_index = 0;
	for (int i = 0; i < N; i++) {
		if (S[i] == v[temp_index]) {
			//std::cout << temp_index << v[temp_index][0] << std::endl;
			temp_index++;
			if (temp_index == 3)
				return true;
		}
	}
	return false;
}

void Main()
{
	int N;
	std::string S;
	std::cin >> N;
	std::cin >> S;
	for (int i = 0; i < 1000; i++)
		keys[i] = false;

	for (int candidate = 0; candidate < 1000; candidate++) {
		if (search(S, N, candidate))
			keys[candidate] = true;
	}
	int ans = 0;
	for (int i = 0; i < 1000; i++)
		if (keys[i])
			ans++;

	std::cout << ans << std::endl;

}

int main()
{
	std::cin.tie(nullptr);
	std::ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	Main();
}


Measured memory_bytes: 384
n = int(input())
d = [1] * (n + 1)
for i in range(2, n+1):
    for j in range(i, n+1, i):
        d[j] += 1
ans = 0
for i in range(1, n+1, 2):
  if d[i] == 8:
    ans += 1
 
print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long
#define pb push_back
#define sz(i) (int)(i.size())
#define F first
#define S second
#define L long double
#define P pair<int, int>
const int inf = 0x3f3f3f3f3f3f3f3LL;
const int mod = (int)1e9 + 7;
using namespace std;
#if LOCAL
#include "../../tr.h"
#else
#define tr(...)
#define endl '\n'
#endif
template<class T> void smin(T& a, T val) {if (a > val) a = val;}template<class T> void smax(T& a, T val) {if (a < val) a = val;}
const int N = (int)1e5 + 10;

int n;
string s;
int dp[N][2];

int solve(int idx, bool is_prefix){
   if(idx >= n){
      return 1;
   }

   int &ans = dp[idx][is_prefix];
   if(~ans)
      return ans;

   int new_is_prefix = is_prefix;
   ans = 0;
   if(!is_prefix){
      ans += 3 * solve(idx+1, new_is_prefix) % mod;
      ans %= mod;
      return ans;
   }

   int num = s[idx] - '0';
   if (num == 0){
      ans += solve(idx+1, is_prefix);
      ans %= mod;
   }
   else{
      ans += solve(idx+1, 0);
      ans %= mod;

      ans += 2*solve(idx+1, 1) % mod;
      ans %= mod;                        
   }
   return ans;
}

int32_t main(){_

   cin>>s;
   n = sz(s);
      
   memset(dp, -1, sizeof dp);
   cout<<solve(0, 1);
   

   return 0;
}

// Common sense: do smth instead of nothing
// Even a single second counts...
// If other's can do it, even I can do it. It wouldn't be that tough. Let me give it a try.
// Mistakes made in past
// -Ques. ask for max-min => think binary_search, DP, greedy
// -not reading question properly / skipping to read & understand all samples properly & wasting time in wrong direction.
// -Using wrong indexing in nested loops something like a[i], when it is supposed to be a[j](WA)
// -value of const int N is not correct (WA/RTE).
// -Did you memset dp to -1 ?
// -check for small edges cases and work on small test cases manually if WA
// -not deallocating memory to pointers can lead to MLE. Use delete :))
// -not reading problem statements of harder problems E,..., thinking it couldn't be solved, but it isn't the case.
// -Avoid using #define int long long as much as possible when it's dp problem and requires high memory say, O(N^2, N=5000) (MLE)
// -Check Bitwise Operator Precedence 
// -Use pragmas to optimize (by constant factor) when necessary..
// -Think before coding & starting to debug. Have patience to look inside code and actually see how it works

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

int main() {
	string word;
  	cin >> word;
  	int n = 0, count = 0 ;
  	string answer = "No";
  	n = word.size();
  
  ///////////////////////////////////////////////
  
  
  	for(int i = 0; i < (n - 1) / 2; i++) {
      if(word.at(i) == word.at(n - 1 - i)) {
        count++;
      }
    }
  
  
  	if(count == (n - 1) / 2) {
      count = 0;
      for(int i = 0; i < (n - 1) / 4; i++) {
      	if(word.at(i) == word.at((n - 1) / 2 - i - 1)) {
        	count++;
      	}
      }
      
      
      
      if(count == (n - 1) / 4) {
        count = 0;
        for(int i = 0; i < (n - 1) / 4 ; i++) {
      		if(word.at((n + 1) / 2 + i) == word.at(n - 1 - i)) {
        	count++;
      		}
        }
        if(count == (n - 1) / 4) answer = "Yes" ;
      }
      
      
    }
        
    
        
        
    
  	cout << answer << endl;
}

Measured memory_bytes: 256
N,K = map(int,input().split())
A = list(map(int,input().split()))
A.sort()
A.insert(len(A),0)
L = []
k = 1
for i in range(len(A)-1):
  if (A[i] == A[i+1]):
    k += 1
    i += 1
  else:
    L.append(k)
    k = 1
    i += 1  
L.sort()
if (len(L) <= K):
  print(0)
else:
  print(sum(L[:len(L)-K]))

Measured memory_bytes: 25644
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::collections::HashMap;
use std::collections::HashSet;
use std::collections::VecDeque;

#[allow(unused_macros)]
macro_rules! read {
    ([$t:ty] ; $n:expr) =>
        ((0..$n).map(|_| read!([$t])).collect::<Vec<_>>());
    ($($t:ty),+ ; $n:expr) =>
        ((0..$n).map(|_| read!($($t),+)).collect::<Vec<_>>());
    ([$t:ty]) =>
        (rl().split_whitespace().map(|w| w.parse().unwrap()).collect::<Vec<$t>>());
    ($t:ty) =>
        (rl().parse::<$t>().unwrap());
    ($($t:ty),*) => {{
        let buf = rl();
        let mut w = buf.split_whitespace();
        ($(w.next().unwrap().parse::<$t>().unwrap()),*)
    }};
}

#[allow(dead_code)]
fn rl() -> String {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).unwrap();
    buf.trim_end().to_owned()
}

fn main() {
    let k = read!(usize);
    let s = read!(String);
    if s.len() <= k {
        println!("{}", s);
    } else {
        println!("{}...", &s[0..k]);
    }
}


Measured memory_bytes: 2068
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using vs = vector<string>;
using pll = pair<ll, ll>;
using vp = vector<pll>;
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, a, b) for (ll i = (a); i < (b); i++)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((int)(x).size())
#define PRINT(V) for (auto v:(V)) {cerr << v << " ";} cerr << endl
#define dump(x) cerr << #x << " : " << (x) << endl
#define dump2(x, y) cerr << "(" << #x << ", " << #y << ") = (" << x << ", " << y << ")" << endl
inline ll GCD(ll a, ll b){return b ? GCD(b, a % b) : a;}
const ll MOD = 1000000007;
const ll INF = 100000000000000000LL;
/* END OF TEMPLATE */

void enum_div(ll x, vll& v){
    for(ll i = 1; i * i <= x; i++){
        if(x % i == 0){
            v.emplace_back(i);
            if(i * i != x){
                v.emplace_back(x/i);
            }
        }
    }
}

ll sumdig(ll x, ll b){
    ll ret = 0;
    while(x){
        ret += x % b;
        x /= b;
    }
    return ret;
}

int main(){
    cin.tie(0); ios::sync_with_stdio(false);
    ll n, s;
    cin >> n >> s;
    if(n < s){
        cout << -1 << endl;
        return 0;
    }
    if(n == s){
        cout << n+1 << endl;
        return 0;
    }
    vll div;
    enum_div(n-s, div);
    sort(ALL(div));
    bool f = 0;
    for(auto& i: div){
        if(sumdig(n, i+1) == s){
            cout << i+1 << endl;
            f = 1;
            break;
        }
    }
    if(!f) cout << -1 << endl;
    return 0;
}

Measured memory_bytes: 384
import std.stdio, std.string, std.conv, std.algorithm, std.numeric;
import std.range, std.array, std.math, std.typecons, std.container, core.bitop;
import std.ascii;

void main() {
    int a, b;
    scan(a, b);
    string s;
    scan(s);

    bool ok = s[0 .. a].isNumeric && s[a] == '-' &&  s[a + 1 .. $].isNumeric;

    writeln(ok ? "Yes" : "No");
}


void scan(T...)(ref T args) {
    string[] line = readln.split;
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}


void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}

Measured memory_bytes: 256
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Deque;
import java.util.Queue;
import java.util.Scanner;
 


public class Main {
	private static Scanner sc = new Scanner(System.in);
	//StringBuffer S = new StringBuffer(sc.next());
	//String hoge2 = str.reverse().toString();
	//map.containsKey(A)
	//Map<Integer, Integer> map = new HashMap<Integer, Integer>(N);
	/*for ( キーのデータ型 key : マップの名前.keySet() ) {
		データのデータ型 data = マップの名前.get( key );
		
		// keyやdataを使った処理;
	}*/
	//int i = Integer.parseInt(s);
	//Queue<String> qq=new ArrayDeque<>(); //add,poll,peek
	//Deque<String> dd=new ArrayDeque<>();//push後ろに入れる,poll(pop)後ろからとる,peek addは先頭に入るからバグ注意
	//ArrayList<Integer> cc = new ArrayList<>(N);
	//cc.contains(tmp)
	//Arrays.asList(c).contains("a")
	//list.set(1,"walk");//1 1 2 3 5
	static long mod =1000000007;
	static long longINF=1000000000000000007L;
	static int INF=1000000007;

	
	public static void main(String[] args) {
		//StringBuffer str = new StringBuffer(sc.nextInt());
		//for(int i=0;i<N;i++) {}
		
			
		
	
		
		
		long a=sc.nextLong();
		String B=sc.next();
		
		long t1=Integer.parseInt(B.charAt(0)+"");
		long t2=Integer.parseInt(B.charAt(2)+"");
		long t3=Integer.parseInt(B.charAt(3)+"");
		
		
		long ans=a*t1+a/10*t2+a/100*t3;
		
		
		long f1=a%10;
		long f2=a%100;
		long t=f1*t2*10+f2*t3;
		ans+=t/100;
		p(ans);
		
		
	}
		
		
		
		
		
	
	
	
	static long bi(int i) {
		long t=1;
		for(int a=1;a<=i;a++) {
			t*=a;
			t%=mod;
		}
		return t;
	}
	public static long modPow(long g,long N) {
		long T=1;
		for(int i=0;i<N;i++) {
			T*=g;
			T%=mod;
		}
		return T;
	}
	static void bit() {
		int n=3;
		String[] ar = {"a","b","c"};
		for(int i =0;i<(1<<n);i++) {
			String S="";
			for(int j=0;j<n;j++) {
				if((1&i>>j)==1) {
					S+=ar[j];
				}
			}
			p("S="+S);
		}
	}
	public static long lcm(long a, long b) {
        return a / gcd(a, b) * b;
	}
	
	public static long gcd(long a, long b) {
        return b == 0 ? a: gcd(b, a % b);
	}
	static String nextPermutation(String s) {
		ArrayList<Character> list=new ArrayList<>();
		for(int i=0;i<s.length();i++) {
			list.add(s.charAt(i));
		}
		int pivotPos=-1;
		char pivot=0;
		for(int i=list.size()-2;i>=0;i--) {
			if(list.get(i)<list.get(i+1)) {
				pivotPos=i;
				pivot=list.get(i);
				break;
			}
		}
		if(pivotPos==-1&&pivot==0) {
			return "Final";
		}
		int L=pivotPos+1,R=list.size()-1;
		
		
		
		int minPos=-1;
		char min =Character.MAX_VALUE;
		
		for(int i=R;i>=L;i--) {
			if(pivot<list.get(i)) {
				if(list.get(i)<min) {
					min=list.get(i);
					minPos=i;
				}
			}
		}
		
		Collections.swap(list, pivotPos, minPos);
		Collections.sort(list.subList(L, R+1));
		
		
		StringBuilder sb=new StringBuilder();
		for(int i=0;i<list.size();i++) {
			sb.append(list.get(i));
		}
		return sb.toString();
	}
	


	
	static void p(String ans) {System.out.println(ans);};
	static void p(int ans) {System.out.println(ans);};
	static void p() {System.out.println();};
	static void p(long ans) {System.out.println(ans);};
	static void p(double ans) {System.out.println(ans);};
	
}
	


Measured memory_bytes: 38836
#include <bits/stdc++.h>
using namespace std;
// using ll = long long;
// using p = pair<int, int>;

#define rep(i, n) for(int i=0;i<(n);i++) 
#define rep1e(i, n) for(int i=1;i<=(n);i++) 

void solve(long long N){
    vector<int> ans(N+1);
    int sz = 100;
    rep1e(x, sz) {
        rep1e(y, sz) {
            rep1e(z, sz){
                int su = x*x + y*y + z*z;
                su += x*y + y*z + z*x;
                if (su > N) continue;
                ans[su]++;
            }
        }
    }

    rep1e(i, N) {
        cout << ans[i] << endl;
    }
}

// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    solve(N);
    return 0;
}


Measured memory_bytes: 3704
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll,ll>;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
const ll INF = 1LL<<60;
const ll MOD = 1e9+7;


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n; cin>>n;
    vector<ll> arr(n+1,1);
    for(int i=2; i<=n; i++){
        for(int now = i; now <= n; now += i)arr[now]++;
    }
    ll ans = 0;
    rep(i,n){
        ans += (i+1)*arr[i+1];
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 81336
#include <stdio.h>

int main(void)
{
	int a,b,c,d[7];
	for(c=0;c<7;c++){
		scanf("%d %d",&a,&b);
		d[c]=a-b;
	}
	for(c=0;c<7;c++){
		printf("%d\n",d[c]);
	}
	return 0;
}


Measured memory_bytes: 2052
//
//  Created by Ruslan Jankurazov.
//  Copyright © 2018 Ruslan Jankurazov. All rights reserved.
//

#pragma GCC optimize("Ofast")

#include "bits/stdc++.h"

#define pb push_back
#define mp make_pair
#define ll long long
#define ull unsigned long long
#define f first
#define s second
#define uint unsigned int
#define pii pair <int, int>
#define pll pair <ll, ll>

using namespace std;

int main() {
#define FILE_INPUT 0
#define FILE ""
#ifndef DEBUG
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
#if FILE_INPUT == 1
#warning "FREOPEN is on"
    freopen(FILE".in", "r", stdin);
    freopen(FILE".out", "w", stdout);
#endif
#endif
    int n, x;
    cin >> n >> x;
    if (x == 1 || x == 2*n - 1) {
        cout << "No";
        return 0;
    } else if (x >= n) {
        cout << "Yes\n";
        for (int i = 1; i < n; ++i) {
            cout << i << '\n';
        }
        cout << x << '\n';
        for (int i = n*2 - 1; i >= n; --i) {
            if (i != x) {
                cout << i << '\n';
            }
        }
    } else {
        cout << "Yes\n";
        for (int i = n; i >= 1; --i) {
            if (i != x) {
                cout << i << '\n';
            }
        }
        cout << x << '\n';
        for (int i = n + 1; i <= 2*n - 1; ++i) {
            if (i != x) {
                cout << i << '\n';
            }
        }
    }
    return 0;
}


Measured memory_bytes: 1536
#include <bits/stdc++.h>
#define pb push_back
#define fi first
#define se second
using namespace std;
typedef long long LL;
typedef vector<int> vi;
typedef pair<int,int> pii;

LL r, d, x;
int main(){
	cin >> r >> d;
	cin >> x;
	for (int i = 1; i <= 10; i++){
		cout << (x = r * x - d) << " \n"[i==10];
	}
	return 0;
}


Measured memory_bytes: 256
N, M, Q = list(map(int, input().strip().split()))
A = []
for i in range(Q):
  a, b, c, d = list(map(int, input().strip().split()))
  A.append((a, b, c, d))

A_list = [1] * N
ans = 0

def calc_score():
  score = 0
  for i in range(Q):
    a, b, c, d = A[i][0], A[i][1], A[i][2], A[i][3]
    if A_list[b-1] - A_list[a-1] == c:
      score += d
  return score
      
def dfs(position, minimum):
  global ans
  if position == N:
    score = calc_score()
    ans = max(ans, score)
    return
  
  for i in range(minimum, M+1):
    A_list[position] = i
    dfs(position+1, i)
    
dfs(1, 1)
print(ans)

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

int gcd(int a, int b) {
  if (a < b) swap(a, b);
  return b == 0 ? a : gcd(b, a % b);
}

int main()
{ 
  int N, K;
  cin >> N >> K;
  int x, M = -1;
  vector<int> a;

  for (int i = 0; i < N; ++ i) {
    cin >> x;
    if (x > M) M = x;
    a.push_back(x);
  }
  
  bool ok = true;
  if (K > M) ok = false;
  else {
    int g = a[0];
    for (int i = 1; i < N; ++ i) {
      g = gcd(g, a[i]);
    }
    if (K % g) ok = false;
  }
                           
  if (ok) cout << "POSSIBLE" << endl;
  else cout << "IMPOSSIBLE" << endl;

  return 0;
}

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

int idx, one, zero, a[30], b[30], c[60], q[30];

inline void plus(int src1, int src2, int dst) {
	printf("+ %d %d %d\n", src1, src2, dst);
}
inline void less(int src1, int src2, int dst) {
	printf("< %d %d %d\n", src1, src2, dst);
}
void prepare() {
	idx = 5;
	for (int i = 0; i < 30; i++) {
		a[i] = ++idx;
	}
	for (int i = 0; i < 30; i++) {
		b[i] = ++idx;
	}
	for (int i = 0; i < 59; i++) {
		c[i] = ++idx;
	}
	for (int i = 0; i < 30; i++) {
		q[i] = ++idx;
	}
	zero = q[0];
	one = q[1];
	plus(0, 1, 3);
	less(0, 3, 4);
	less(1, 3, 5);
	plus(4, 5, one);
	less(zero, one, one);
	for (int i = 2; i < 30; i++) {
		plus(q[i - 1], q[i - 1], q[i]);
		plus(q[i], one, q[i]);
	}
}
inline void getBit(int *bit, int src) {
	int num = ++idx, pow = ++idx;
	for (int i = 29; i >= 0; i--) {
		plus(num, q[i], bit[i]);
		less(bit[i], src, bit[i]);
		plus(bit[i], zero, pow);
		for (int j = 0; j < i; j++) {
			plus(pow, pow, pow);
		}
		plus(num, pow, num);
	}
}
inline void calc() {
	int num = ++idx;
	for (int i = 0; i < 30; i++) {
		for (int j = 0; j < 30; j++) {
			plus(a[i], b[j], num);
			less(one, num, num);
			plus(num, c[i + j], c[i + j]);
		}
	}
	for (int i = 0; i < 59; i++) {
		for (int j = 0; j < i; j++) {
			plus(c[i], c[i], c[i]);
		}
		plus(2, c[i], 2);
	}
}
int main() {
	printf("5641\n");
	prepare();
	getBit(a, 0);
	getBit(b, 1);
	calc();
	return 0;
}

Measured memory_bytes: 3724
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
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; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧  
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     
　　　　／　　　＼　 　  |　|     
　　　 /　　 /￣￣￣￣/　　|  
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿  
　 　　　＼/＿＿＿＿/　（u　⊃  
---------------------------------------------------------------------------------------------------*/






int a, b, c, d;
//---------------------------------------------------------------------------------------------------
#define yes "Yes"
#define no "No"
string solve() {
    int ab = abs(a - b);
    int ac = abs(a - c);
    int bc = abs(b - c);

    if (ab <= d and bc <= d) return yes;
    if (ac <= d) return yes;
    return no;
}
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> a >> b >> c >> d;
    cout << solve() << endl;
}

Measured memory_bytes: 256
import fractions
A, B, C, D = map(int, str(input()).split())

total_num = B - A + 1

if A % C == 0:
    can_C_divided = B // C - A // C + 1
else:
    can_C_divided = B // C - A // C
if A % D == 0:
    can_D_divided = B // D - A // D + 1
else:
    can_D_divided = B // D - A // D
lcm = C * D // fractions.gcd(C, D)
if A % lcm == 0:
    can_CD_divided = B // lcm - A // lcm + 1
else:
    can_CD_divided = B // lcm - A // lcm

print(total_num - can_C_divided - can_D_divided + can_CD_divided)


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

typedef long long lint;
typedef long double louble;

template<typename T1,typename T2> inline T1 max(T1 a,T2 b){return a<b?a:b;}
template<typename T1,typename T2> inline T1 min(T1 a,T2 b){return a<b?b:a;}

namespace ae86
{
	const int bufl = 1<<15;

	char buf[bufl],*s=buf,*t=buf;

	inline int fetch()
	{
		if(s==t){t=(s=buf)+fread(buf,1,bufl,stdin);if(s==t)return EOF;}
		return *s++;
	}

	inline int ty()
	{
		int a=0,b=1,c=fetch();
		while(!isdigit(c))b^=c=='-',c=fetch();
		while(isdigit(c))a=a*10+c-48,c=fetch();
		return b?a:-a;
	}

	inline int ts(char *s)
	{
		int a=0,c=fetch();
		while(c<=32 && c!=EOF)c=fetch();
		while(c>32 && c!=EOF)s[a++]=c,c=fetch();
		s[a]=0;
		return a;
	}
}
using ae86::ty;
using ae86::ts;

const int _ = 100007;

inline lint gcd(lint a,lint b){while(b)a%=b,swap(a,b);return a;}
inline lint lcm(lint a,lint b){return a/gcd(a,b)*b;}

int n,m;char s[_],t[_];
unordered_map<lint,char> tar;

int main()
{
	n=ty(),m=ty(),ts(s+1),ts(t+1);
	lint len=lcm(n,m);
	for(int i=1;i<=n;i++)tar[len/n*(i-1)+1]=s[i];
	for(int i=1;i<=m;i++)
	{
		lint loc=len/m*(i-1)+1;
		if(tar.count(loc) && tar[loc]!=t[i]){puts("-1");return 0;}
	}
	printf("%lld\n",len);

	return 0;
}


Measured memory_bytes: 4260
#include <stdio.h>

int main(){
  int a,b,c,d[30],i,w,n;
  scanf("%d",&w);
  scanf("%d",&n);
  for(i=0;i<w;i++)d[i]=i+1;
  for(i=0;i<n;i++){
    scanf("%d,%d",&a,&b);
    c=d[a-1];d[a-1]=d[b-1];d[b-1]=c;
  }
  for(i=0;i<w;i++) printf("%d\n",d[i]);
  return 0;
}

Measured memory_bytes: 0
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <utility>
#include <numeric>

using namespace std;

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

const ll inf = (ll)1e9;
const ll mod = (ll)1e9 + 7;

#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

#define print(s) cout << s;
#define println(s) cout << s << endl;
#define printd(s, f) cout << fixed << setprecision(f) << s << endl;


template<typename T> T gcd(T a, T b)
{
	return b > 0 ? gcd(b, a % b) : a;
}

int main()
{
	ll x, y;
	cin >> x >> y;

	println(gcd(x, y));
}



Measured memory_bytes: 3104
import math
a,b,c=map(int,input().split())
Sin=math.sin(math.radians(c))
Cos=math.cos(math.radians(c))
S=a*b*Sin*0.5
L=(a**2+b**2-2*a*b*Cos)**0.5+a+b
h=S*2/a
print(S,L,h)


Measured memory_bytes: 5724
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <cstdio>
#include <queue>
#include <deque>
#include <map>
#include <stack>
#include <set>
#include <utility>
#include <functional>
using namespace std;
typedef pair<int, int> pii;
typedef pair<string, int> P;
typedef long long ll;
int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
const int MAXN = 100000;
const int MAXE = 100000;
const int MAXV = 10000;
const ll INF = 1e18;
const ll MOD = 1e9 + 7;
struct UnionFind{
    vector<int> par,rank;
    UnionFind(int n):par(n),rank(n){
        for(int i=0;i<n;++i) par[i]=i;
    }
    int root(int x){
        if(par[x]==x) return x;
        return par[x]=root(par[x]);
    }
    void unite(int x,int y){
        int rx=root(x),ry=root(y);
        if(rx==ry) return ;
        if(rank[ry]>rank[rx]) par[rx]=ry;
        else par[ry]=rx;
        if(rank[rx]==rank[ry]) rank[rx]++;
    }
    bool same(int x,int y){
        return root(x)==root(y);
    }
};
vector<ll> fac(1e6),inv(1e6),finv(1e6);
void initcom(){
    fac[0]=fac[1]=1;
    inv[1]=1;
    finv[0]=finv[1]=1;
    for(int i=2;i<1e6;++i){
        fac[i]=fac[i-1]*i%MOD;
        inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;
        finv[i]=finv[i-1]*inv[i]%MOD;
    }
}
ll com(int n,int k){
    if(n<0||k<0) return 0;
    if(n<k) return 0;
    return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD;
}
int compress(vector<int> &x,int w){
    vector<int> sx;
    for(int i=0;i<(int)x.size();++i){
        for(int d=-2;d<=2;++d){
            int t=x[i]+d;
            if(t>=0&&t<w) sx.push_back(t);
        }
    }
    sort(sx.begin(),sx.end());
    sx.erase(unique(sx.begin(),sx.end()),sx.end());
    for(int i=0;i<(int)x.size();++i){
        x[i]=lower_bound(x.begin(),x.end(),x[i])-x.begin();
    }
    return (int)sx.size();
}
int main(){
    int x;cin>>x;
    cout<<8-(x-400)/200<<endl;
    return 0;
}

Measured memory_bytes: 26564
N, M = map(int, input().split())
MOD = 1000000007

broken = [0] * N
for i in range(M):
    broken[int(input())] = 1


dp = [0] * (N + 2)
dp[N] = 1
for i in reversed(range(N)):
    if broken[i]:
        dp[i] = 0
        continue
    dp[i] = dp[i+1] + dp[i+2]

print(dp[0] % MOD)


Measured memory_bytes: 460788
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//namespace mp = boost::multiprecision;

using namespace std;

const double PI = 3.14159265358979323846;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
typedef pair<ll, ll> P;
const ll INF = 10e17;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

double equal(double a, double b) {
    return fabs(a - b) < DBL_EPSILON;
}

std::istream &operator>>(std::istream &in, set<int> &o) {
    int a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);
//const ll mod = 1e10;

typedef priority_queue<ll, vector<ll>, greater<ll> > PQ_ASK;

class UnionFind {
public:
    // 親の番号を格納する。親だった場合-size
    vector<int> parents;

    UnionFind(int n) {
        parents = vector<int>(n, -1);
    }

    // aがどのグループに属しているか
    int root(int a) {
        if (parents[a] < 0) {
            return a;
        }
        return parents[a] = root(parents[a]);
    }

    int size(int a) {
        return -parents[root(a)];
    }

    // aとbをくっつける
    bool connect(int a, int b) {
        int ra = root(a);
        int rb = root(b);
        if (ra == rb) {
            return false;
        }
        // 大きいほうにA
        if (size(ra) < size(rb)) {
            swap(ra, rb);
        }
        parents[ra] += parents[rb];
        parents[rb] = ra;
        return true;
    }

    bool is_union(int a, int b) {
        int ra = root(a);
        int rb = root(b);
        return ra == rb;
    }
};

int main() {
    int n, m;
    cin >> n >> m;
    vector<P> v(m);
    for (P &p:v)cin >> p.first >> p.second, p.first--, p.second--;

    UnionFind uf(n);
    for (P p : v) uf.connect(p.first, p.second);

    int ma = 0;
    rep(i, n) cmax(ma, uf.size(i));
    cout << ma << endl;


}


Measured memory_bytes: 7216
while True:
    n, x = [int(i) for i in input().strip().split()]
    if not n and not x:
        break
    ans = 0
    for i in range(1, n - 1):
        for j in range(i + 1, n):
            if j < x - (i + j) and x - (i + j) <= n:
                ans += 1
    print(ans)



Measured memory_bytes: 5604
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
using namespace std;

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

int main()
{
	int k;
	int i = 9;

	cin >> k;

	if (k < 10) {
		cout << k << endl;
	}

	queue<ll> que;

	for (ll n = 1; n <= 9; n++)
		que.push(n);

	while (i < k)
	{
		ll n = que.front(); que.pop();
		ll d = n % 10;

		n = 10 * n + d;

		if (d != 0) {
			que.push(n - 1);
			i++;

			if (i == k) {
				cout << n - 1 << endl;
				break;
			}
		}		

		que.push(n);
		i++;

		if (i == k) {
			cout << n << endl;
			break;
		}

		if (d != 9) {
			que.push(n + 1);
			i++;

			if (i == k) {
				cout << n + 1 << endl;
				break;
			}
		}

	}

	return 0;
}

Measured memory_bytes: 768
import sys
input=sys.stdin.readline
n,c,k=map(int,input().split())
t=[int(input()) for _ in range(n)]
t.sort()
p=1
dt=t[0]+k
ans=0
for i in range(1,n):
    if p==c:
        p=1
        ans+=1
        dt=t[i]+k
    elif dt<t[i]:
        p=1
        ans+=1
        dt=t[i]+k
    else:
        p+=1
print(ans+1)

Measured memory_bytes: 7392
#include <stdio.h>
int main()
{   int n,s[101],i,ans=0,min=122;
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%d",&s[i]);
        ans+=s[i];
        if(min>s[i]&&s[i]%10!=0){
            min=s[i];
        }
    }
    if(ans%10==0&&min!=122){
        ans-=min;
    }
    else if(min==122)ans=0;
    printf("%d",ans);
    

    return 0;
}


Measured memory_bytes: 128
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <vector>
using namespace std;

const int kMaxn = 3e5 + 5;
int N, M, K;
vector<int> V[kMaxn];
int p[kMaxn], buck[kMaxn];
struct ST {
  int left, right;
  int max;
} st[kMaxn << 2];
void build(int pos, int l, int r);
void update(int pos, int l, int key);

int main() {
  //
  scanf("%d%d%d", &N, &M, &K);
  bool flag = false;
  if (N > M) {
    swap(N, M);
    flag = true;
  }
  for (int i = 1; i <= K; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    if (flag) swap(x, y);
    V[y].push_back(x);
    p[x]++;
    buck[y]++;
  }
  build(1, 1, N);
  int ans = 0;
  for (int i = 1; i <= M; i++) {
    for (int pos : V[i]) update(1, pos, -1);
    ans = max(ans, buck[i] + st[1].max);
    for (int pos : V[i]) update(1, pos, 1);
  }
  printf("%d\n", ans);
  return 0;
}

void build(int pos, int l, int r) {
  st[pos].left = l, st[pos].right = r;
  if (l == r) {
    st[pos].max = p[l];
    return;
  }
  int mid = (l + r) >> 1;
  int lc = pos << 1, rc = lc + 1;
  build(lc, l, mid);
  build(rc, mid + 1, r);
  st[pos].max = max(st[lc].max, st[rc].max);
}

void update(int pos, int l, int key) {
  if (st[pos].left == l && st[pos].right == l) {
    st[pos].max += key;
    return;
  }
  int mid = (st[pos].left + st[pos].right) >> 1;
  int lc = pos << 1, rc = lc + 1;
  if (l <= mid)
    update(lc, l, key);
  else
    update(rc, l, key);
  st[pos].max = max(st[lc].max, st[rc].max);
}

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

def f(x,y):
  return sum(i*j for i,j in zip(x,y))

count = 0
for i in range(N):
  ary1 = list(map(int,input().split()))
  if f(ary1,b) +C >0:
    count +=1

print(count)

Measured memory_bytes: 3064
"use strict";

const main = arg => {
  const inputList = arg.trim().split("\n");
  // 回答を記述
  const A = BigInt(inputList[0].split(" ")[0]);
  const B = BigInt(inputList[0].split(" ")[1]);
  const C = BigInt(inputList[0].split(" ")[2]);
  const K = BigInt(inputList[0].split(" ")[3]);

  if (K <= A) {
    console.log(BigInt.asIntN(64, K).toString())
  } else if (K <= (A + B)) {
    console.log(BigInt.asIntN(64, A).toString())
  } else {
    // A + B <= K <= A + B + C
    const minus = K - (A + B);
    console.log(BigInt.asIntN(64,(A - minus)).toString())
  } 
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 29540
#include <bits/stdc++.h>
#define rep(i,a,n) for (int i=a;i<=n;i++)
#define per(i,a,n) for (int i=n;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
using namespace std;
typedef vector<int> vi;
typedef long long ll;
typedef pair<int,int> pii;
const ll mod=1000000007;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
const int maxn=1e5+10;

int main()
{
    int k,s;
    scanf("%d%d",&k,&s);
    int ans=0;
    rep(i,0,k) {
        rep(j,0,k) {
            if(i+j<=s&&(s-i-j)<=k) ans++;
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
a=int(input())
b=int(input())

if a==1 and b==2:
    print(3)
elif a==1 and b==3:
    print(2)
elif a==2 and b==1:
    print(3)
elif a==2 and b==3:
    print(1)
elif a==3 and b==1:
    print(2)
elif a==3 and b==2:
    print(1)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define long long long
const int MAXN = 1e6 + 7;
const long MOD = 1e9 + 7;
const long INF = 1e15;


main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int i, j, k;

    int A, B, C; cin >> A >> B >> C;
    cout << max(0, C - (A - B)) << "\n";
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <numeric>
#include <iterator>

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int,int> PII;
typedef istringstream ISS;
typedef ostringstream OSS;

#define REP( i, m, n ) for ( int i = (int)( m ); i < (int)( n ); ++i )
#define FOR( v, c ) for ( auto &v : c )

#define EACH( it, c ) for ( auto it = c.begin(); it != c.end(); ++it )
#define ALL( c ) (c).begin(), (c).end()
#define DRANGE( c, p ) (c).begin(), (c).begin() + p, (c).end()

#define PB( n ) push_back( n )
#define MP( a, b ) make_pair( ( a ), ( b ) )
#define EXIST( c, e ) ( (c).find( e ) != (c).end() )

#define fst first
#define snd second

#define DUMP( x ) cerr << #x << " = " << ( x ) << endl
#define DEBUG( x ) cerr << __FILE__ << ":" << __LINE__ << ": " << #x << " = " << ( x ) << endl

int solve( int n, int a, int b, int c, int x )
{
	VI ys( n );
	FOR( y, ys )
	{
		cin >> y;
	}

	int res = 0;
	REP( i, 0, n )
	{
		while ( ys[i] != x )
		{
			if ( 10000 < res )
			{
				return -1;
			}
			res++;
			x = ( a * x + b ) % c;
		}

		if ( i + 1 < n )
		{
			res++;
			x = ( a * x + b ) % c;
		}
	}

	return res <= 10000 ? res : -1;
}

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

	while ( true )
	{
		int n, a, b, c, x;
		cin >> n >> a >> b >> c >> x;

		if ( !( n | a | b | c | x ) )
		{
			break;
		}

		cout << solve( n, a, b, c, x ) << endl;
	}

	return 0;
}

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

using namespace std;

#define rep(i, a) for (int i = 0; i < a; i++)
#define reps(i, b, a) for (int i = b; i < a; i++)

int main()
{
  int A, B, K;
  cin >> A >> B >> K;
  reps(i, A, min(A + K, B + 1)) cout << i << endl;
  reps(i, max(B - K + 1, A + K), B + 1) cout << i << endl;
  return 0;
}

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

#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define intll int long long

int main() {
  int a[] = {0,1,3,1,2,1,2,1,1,2,1,2,1,};
  int x , y ;
  cin >> x >> y ;
  
  if(a[x] == a[y] )
    cout << "Yes " ;
  
  else 
    cout << "No" ;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
namespace mp = boost::multiprecision;

int main() {
  int h, w, n;
  cin >> h >> w >> n;
  int a[n], ct=-1;
  int c[h][w];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    ct+=a[i];
    for (int j = 0; j < a[i]; j++)
      c[(ct-j) / w][(ct-j) % w] = i+1;
  }
  for (int i = 0; i < h; i++)
    for (int j = 0; j < w; j++) {
      if (i % 2)
        cout << c[i][j];
      else
        cout << c[i][w - 1 - j];
      if (j != w - 1)
        cout << " ";
      else
        cout << endl;
    }
  return 0;
}

Measured memory_bytes: 3608
S = input()
counter = 0
ans = 0
for i in range(len(S)):
    if S[i]=='A' or S[i]=='T' or S[i]=='C' or S[i]=='G':
        counter+=1
    else:
        if ans<counter:
            ans = counter
            counter = 0

if ans < counter:
    ans = counter

print(ans)


Measured memory_bytes: 2940
// {{{ include
#include <cstdio>
#include <cmath>
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <algorithm>
// }}}

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
inline int in(){int x;scanf("%d",&x);return x;}

int main()
{
  int N, M;
  while (N = in(), M = in(), N || M){
    vector<P> D;
    for (int i = 0; i < N; i++){
      int d = in(), p = in();
      D.push_back(P(-p, -d));
    }
    sort(begin(D), end(D));
    int ans = 0;
    for (const auto& Di : D){
      M += Di.second;
      if (M < 0) {
        ans += M * Di.first;
        M = 0;
      }
    }
    cout << ans << endl;
  }

  return 0;
}

Measured memory_bytes: 1332
#include <bits/stdc++.h>
using namespace std;  
typedef long long ll;
typedef vector<ll> vint;
int main() {
  vector<char> c(4);
  ll ans=0;
 
  for (ll i=0;i<4;i++) {
    cin >> c.at(i);
    if (c.at(i)=='+') {
      ans++;
    }
    else {
      ans--;
    }
  }
  
  cout << ans;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
typedef long long ll;
#define fr(i,n) for(int i=0;i<n;i++)

int main(){
  int a,b;
  cin>>a>>b;
  if(a>0) cout<<"Positive";
  else{
    if(b>=0) cout<<"Zero";
    else{
      if((b-a)%2>0) cout<<"Positive";
      else cout<<"Negative";
    }
  }
  cout<<endl;
}

Measured memory_bytes: 256