akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

using ll = long long int;

const int MAX = (int)(1e5 + 5);
const ll INF = (ll)(1e10 + 5);

string s;

int ans;

int main(void) {
  // Here your code !
  cin >> s;

  int cnt = 0;
  char last = s[0];
  for (int i = 1; i < s.size(); ++i) {
    if (last != s[i]) {
      cnt += 1;
      last = s[i];
    }
  }

  ans = cnt;

  printf("%d\n", ans);

  return 0;
}


Measured memory_bytes: 512
int_w, int_a, int_b = map(int, input().split())

if int_a <= (int_b) <= (int_a + int_w) or int_a <= (int_b + int_w) <= (int_a + int_w):
    print(0)
else:
    print(min([abs(a-b) for a in [int_a, int_a + int_w] for b in [int_b, int_b + int_w]]))



Measured memory_bytes: 2940
N, x = map(int, input().split())
a_arr = list(map(int, input().split()))
ans = 0
if a_arr[0] > x:
    ans += a_arr[0] - x
    a_arr[0] = x
for i in range(1, N):
    over =  a_arr[i-1] + a_arr[i] - x
    if over > 0:
        ans += over
        a_arr[i] -= over
print(ans)

Measured memory_bytes: 14252
#include<stdio.h>
#include<math.h>
#include<string.h>
#include<memory.h>
#include<stdlib.h>
int main(void)
{
	char s[100005];
	scanf("%s", s);
	int l = strlen(s);
	int i, sc = 0;
	for (i = 1; i < l; i++)
	{
		if (s[i] != s[i - 1])
			sc++;
	}
	printf("%d", sc);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define arep(a,i,n) for(ll i=(a);i<(n);i++)
#define rep(i,n) for(ll i=0;i<(n);i++)
#define cinf(x,n) for(ll i=0;i<(n);i++)cin>>x[i];
#define coutf(x,n) for(ll i=0;i<(n);i++)cout<<x[i]<<endl;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

using namespace std;

ll prime[1001];
ll ans=1;
ll cnt,tmp;

int main(){
	int mod = 1e9+7;
	ll n;
	cin >> n;
	prime[0]=1;
	prime[1]=1;
	for(int i=0;i<1001;i++){
		if(prime[i]==0){
			for(int j=2*i;j<1001;j+=i){
				prime[j]++;
			}
		}
	}
	rep(i,n+1){
		cnt=0;
		if(prime[i]==0){
			arep(1,j,n+1){
				//cout << "j:" << j << endl;
				tmp=j;
				while(tmp){
					if(tmp%i==0)
						cnt++;
					else
						break;
					tmp/=i;
				}
			}
		}
		//cout << i << ':' << cnt << endl;
		cnt=(cnt+1)%mod;
		ans*=cnt;
		ans%=mod;
	}
	//rep(i,1001)if(prime[i]==0)cout << i << endl;
	cout << ans%mod << endl;
}

Measured memory_bytes: 3644
#include <iostream>
#include <set>
using namespace std;
char a[100100];
int main(){
	string s;
	cin>>s;
	for(int i = 0 ; i < s.size(); i++){
		if (s[i] == 'R' && (i+1)%2==1 || s[i]== 'L' && (i+1)%2==0 || s[i] == 'U' || s[i] == 'D'){
			continue;
		}else{
			cout<<"No";
			return 0;
		}
	}
	cout<<"Yes";
	return 0;
}


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

using namespace std;

typedef long long ll;
typedef long double ld;

struct info {
    int cnt;
    int add;
};

int n,s;
info v[15];
bool iau[15];

int ans=(1<<30);

void bkt(int strat) {
    if(strat==n) {
        int cate=0,nev=s;
        for(int i=1;i<=n;i++) {
            if(iau[i]) {
                nev-=v[i].add;
                nev-=v[i].cnt*i*100;
                cate+=v[i].cnt;
            }
        }
        if(nev<=0) {
            ans=min(ans,cate);
            return;
        }
        for(int i=n;i>=1;i--) {
            if(iau[i]) {
                continue;
            }
            int ma=v[i].cnt-1;
            int nevoie=(nev+100*i-1)/(100*i);
            int t=min(ma,nevoie);
            cate+=t;
            nev-=t*100*i;
            if(nev<=0) {
                break;
            }
        }
        if(nev<=0) {
            ans=min(ans,cate);
        }
      //  cout<<iau[1]<<" "<<iau[2]<<" : "<<cate<<" , "<<nev<<"\n";
      //  ans=min(ans,cate);
        return;
    }
    iau[strat+1]=0; bkt(strat+1);
    iau[strat+1]=1; bkt(strat+1);
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin>>n>>s;
    for(int i=1;i<=n;i++) {
        cin>>v[i].cnt>>v[i].add;
    }
    bkt(0);
    cout<<ans<<"\n";
    return 0;
}
/**

**/


Measured memory_bytes: 256
import sys
import math
 
N = 1000000
primes = [1] * (N//2)
primes[0] = 0
 
for i in range(3,int(math.sqrt(N)),2):
    if primes[i//2]:
        primes[(i*i)//2::i] = [0] * len(primes[(i*i)//2::i])
 
for i in sys.stdin:
    n = int(i)
    if n < 3:
        print(n-1)
    else:
        print(sum(primes[0:(n+1)//2])+1)

Measured memory_bytes: 16936
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <cstring>
#include <math.h>
#include <bitset>
#include <queue>
#include <set>
#include <iomanip>
#include <math.h>
#include <assert.h>
// #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr long long int INFLL = 1001001001001001LL;
constexpr long long int infll = 1001001001001001LL;
constexpr int INF = 1000000007;
constexpr int inf = 1000000007;
const int mod = 1000000007;

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

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

ll lcm(ll a, ll b)
{
    return a / gcd(a, b) * b;
}

inline double nCr(const int n, int r)
{
    if (n == 0)
    {
        return 0;
    }
    if (r == 0)
    {
        return 1;
    }
    if (r == 1)
    {
        return n;
    }
    if (n == r)
    {
        return 1;
    }

    if (r > n / 2)
    {
        r = n / 2;
    }

    double result = 1;
    for (double i = 1; i <= r; i++)
    {
        result *= (n - i + 1) / i;
    }

    return (result);
}

template <typename T>
T seinomi(T a)
{
    if (a > 0)
    {
        return a;
    }
    else
    {
        return 0;
    }
}

template <typename T>
map<T, T> soinsuubunkai(T n) //連想配列[素因数f.first][個数f.second]
{
    map<T, T> ret;
    for (T i = 2; i * i <= n; i++)
    {
        while (n % i == 0)
        {
            ret[i]++;
            n /= i;
        }
    }
    if (n != 1)
        ret[n] = 1;
    return ret;
}

template <typename T>
T ketasuu(T num)
{
    return std::to_string(num).length();
}

int kaizyou(int k)
{
    int sum = 1;
    for (int i = 1; i <= k; ++i)
    {
        sum *= i;
    }
    return sum;
}

template <class ForwardIt, class T>
void iota(ForwardIt first, ForwardIt last, T value)
{
    while (first != last)
    {
        *first++ = value;
        ++value;
    }
}

//nの階乗を計算
int factorial(int n)
{
    int answer = 1;
    while (n > 1)
    {
        answer *= n;
        n--;
    }
    return answer;
}
int comb(int n, int r)
{
    return factorial(n) / (factorial(r) * factorial(n - r));
}

long long modpow(long long a, long long n, long long mod)
{
    long long res = 1;
    while (n > 0)
    {
        if (n & 1)
            res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

//小数点以下10桁テンプレート（main関数内の最初に貼付け）
//std::cout << std::fixed << std::setprecision(10);

//----------------------------------------------------------------

int main(){
char a,b;
cin>>a>>b;
if(a=='H'){
    if(b=='H'){
        cout<<"H"<<endl;
    }else{
        cout<<"D"<<endl;
    }
}else{
    if(b=='H'){
        cout<<"D"<<endl;
    }else{
        cout<<"H"<<endl;
    }
}

}










Measured memory_bytes: 256
import sys
import itertools
input = sys.stdin.readline
sys.setrecursionlimit(100000)
mod = 10 ** 9 + 7

def read_values(): return map(int, input().split())
def read_index(): return map(lambda x: int(x) - 1, input().split())
def read_list(): return list(read_values())
def read_lists(N): return [read_list() for n in range(N)]


class V:
    def __init__(self, f, v=None):
        self.f = f
        self.v = v
 
    def __str__(self):
        return str(self.v)
 
    def ud(self, n):
        if self.v is None:
            self.v = n
        else:
            self.v = self.f(self.v, n) 


def main():
    N = int(input())
    S = read_list()

    res = V(max, 0)
    for c in range(1, N):
        r = 0
        t1 = 0
        t2 = N - 1
        a = t2 - c
        while True:
            if a < c:
                break
            
            if (N - 1) % c == 0 and 2 * a <= N - 1:
                break

            t1 += c
            t2 -= c
            a -= c
            r += S[t1] + S[t2]
            res.ud(r)

    print(res)


if __name__ == "__main__":
    main()


Measured memory_bytes: 14988
#include<bits/stdc++.h>
using namespace std;
long long a[1005],b[1005];
int main()
{
    long long n;
    scanf("%lld",&n);
    for(long long i=0;i<n;i++)
    {
        scanf("%lld%lld",&a[i],&b[i]);
    }
    for(long long i=1;i<n;i++)
    {
    	long long m1=1,m2=1;
        if(a[i]<a[i-1])
        {
        	m1=a[i-1]/a[i];
        	if(m1*a[i]<a[i-1])
        	m1++;
		}
		if(b[i]<b[i-1])
        {
        	m2=b[i-1]/b[i];
        	if(m2*b[i]<b[i-1])
        	m2++;
		}
        long long m=max(m1,m2);
        a[i]=m*a[i];
        b[i]=m*b[i];
    }
    long long ans=a[n-1]+b[n-1];
    printf("%lld\n",ans);
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstdio>

using namespace std;

int calc(int* v, int i) {
    int x = v[0];
    x+= (i&1)?v[1]:-v[1];
    x+= (i&2)?v[2]:-v[2];
    x+= (i&4)?v[3]:-v[3];
    return x;
}

void output(int* v, int i) {
    cout << v[0]
    << ((i&1)?'+':'-') << v[1]
    << ((i&2)?'+':'-') << v[2]
    << ((i&4)?'+':'-') << v[3]
    << '=' << calc(v,i) << endl;
}

int main(int argc, char const *argv[])
{
    string s;cin >> s;
    int v[4] = {s[0]-'0', s[1]-'0', s[2]-'0', s[3]-'0'};

    for(int i=0;i<8;++i) {
        if(calc(v, i)==7) {
            output(v, i);
            break;
        }
    }
    return 0;
}


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

long double pi = acos(-1);
using namespace std;

int main() {

    long double a, b, h, m;
    cin >> a >> b >> h >> m;
    long double angle=abs((h+m/60)*5-m)*pi/30.0;
    long double c=(a*a+b*b)-(2.0*a*b*cosl(angle));
    cout<<fixed<<setprecision(20)<< sqrt(c);
    return 0;
}


Measured memory_bytes: 4152
import std.stdio, std.array, std.conv, std.typecons, std.algorithm;

T diff(T)(const ref T a, const ref T b) { return a > b ? a - b : b - a; }

void main() {
    immutable i = readln.split.to!(ulong[]);
    immutable a = i[0], b = i[1];
    auto ans = a >= 13 ? b : (a >= 6 ? b/2 : 0);
    writeln(ans);
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast", "unroll-loops")

#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define ld long double

int main() {
	int x, y, z;
	cin >> x >> y >> z;
	swap(x, y);
	swap(x, z);
	cout << x << " " << y << " " << z << endl;
	return 0;
}

Measured memory_bytes: 764
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define inf 2,147,483,647 //int値の最大値
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
int gcd(int a, int b) {
    if (b==0) return a;
    else return gcd(b, a%b);
}
int lcm(int a, int b) {
    return a * b / gcd(a, b);
}
int main() {
    ll n,a,b;cin>>n>>a>>b;
    if(a>b){
        cout<<0<<endl;
    }else if(n==1){
        if(a!=b){
            cout<<0<<endl;
        }else{
            cout<<1<<endl;
        }
        
    }else{
        ll tt=b*(n-2);
        ll ttt=a*(n-2);
        cout<<tt-ttt+1<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
N,x = map(int, input().rstrip().split())
a = list(map(int, input().rstrip().split()))
a.sort()
counter = 0
for i,n in enumerate(a):
    x -= n
    if x >= 0 and i != N-1:
        counter += 1
    elif x == 0:
        counter += 1
        break
    else:
        break
print(counter)

Measured memory_bytes: 3060
import java.util.Scanner;

/**
 * ABC042C
 */
public class Main {

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

        int N = sc.nextInt();
        int K = sc.nextInt();

        boolean[] dislike = new boolean[10];
        for (int i = 0; i < dislike.length; i++) {
            dislike[i] = false;
        }

        for (int i = 0; i < K; i++) {
            dislike[sc.nextInt()] = true;
        }

        int i = N;
        int ans = 0;
        while (true) {
            boolean canPay = false;
            for (int j = 0; j < Integer.toString(i).length(); j++) {
                if (dislike[Integer.toString(i).charAt(j) - '0']) {
                    canPay = false;
                    break;
                }

                canPay = true;
            }

            if (canPay) {
                ans = i;
                break;
            }

            i++;
        }

        System.out.println(ans);
    }
}

Measured memory_bytes: 31700
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0);

using namespace std;

namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};}
template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";}
template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";}
void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);}
typedef long long ll;typedef vector<int> vi;typedef pair<int,int> pi;const int inf = (int)1e9;const double INF = 1e12, EPS = 1e-9;

int main(){
	cin.tie(0); cin.sync_with_stdio(0);
	int n;
	while(cin >> n, n){
		ll sum = 0, ans = 0;
		vi js;
		rep(i, n){ int x; cin >> x; sum += x; }
		rep(i, n - 1){ int x; cin >> x; js.pb(x); }
		sort(all(js), greater<int>());
		ans = sum * n;
		rep(i, n - 1){
			sum += js[i];
			ans = max(ans, (n - i - 1ll) * sum);
		}
		cout << ans << endl;
	}
	return 0;
}


Measured memory_bytes: 3396
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
 
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
 
#define start_routine() int begtime = clock();
#define end_routine() int endtime = clock(); cerr << endl << "Time elapsed: " << (endtime - begtime)*1000/CLOCKS_PER_SEC << " ms"; return 0
#define speed() cin.tie(0), cout.tie(0), ios_base::sync_with_stdio(false)
// #define exit(a, b) return cout << a, b;
 
// debugger
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#define debug(stuff) cout << #stuff << ": " << stuff <<endl
#define debugc(stuff) cout << #stuff << ": "; for(auto x: stuff) cout << x << " "; cout << endl;
// 
 
#define loop(i,a,b) for(ll i=a;i<b;i++)
#define all(v) v.begin(), v.end() 
 
#define print(stuff) cout << stuff << endl
#define printc(stuff) for(auto x: stuff) cout << x << " "; cout << endl;
#define printPrec(stuff) cout << fixed << setprecision(15) << stuff << endl;
#define len length
#define ret0 return 0
#define ret return 
 
 
#define ll long long
#define ld long double
#define fi first
#define endl '\n'
#define se second
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define fill(ar, x) memset(ar, x, sizeof ar)
 
#define vl vector<ll> 
#define sl set<ll>
#define pll pair<ll, ll>
#define mll map<ll, ll> 
#define pq priority_queue<ll>
 
// typedef tree<ll,null_type,less<ll>,rb_tree_tag,
// tree_order_statistics_node_update> indexed_set;
 
#define inf (long long int) 1e18
#define eps 0.000001
#define mod 1000000007
#define mod1 998244353
#define MAXN (ll)2e5+5
#define N (1ll<<10)
#define pi 3.141592653589793238462643

void solve(){
    ll n;
    cin>>n;
    ll r;
    cin>>r;
    if(n >= 10) print(r);
    else print(r+100*(10-n));
}
 
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
  
 
    ll t = 1;
    // cin>>t;
    while(t--){
        solve();
    }
     
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <cmath>
#include <iostream>
using namespace std;
void GridRepainting() {
	int H, W;
	cin >> H >> W;
	char t[50][50];
	for (size_t i = 0; i < H; i++)
	{
		for (size_t j = 0; j < W; j++)
		{
			cin >> t[i][j];
		}
	}
	bool c = true;
	for (size_t i = 0; i < H; i++)
	{
		
		for (size_t j = 0; j < W; j++)
		{
			bool b = false;
			if (t[i][j] != '#') continue;
			if (i - 1 >= 0 && t[i - 1][j] == '#') b = true;
			if (i + 1 < H && t[i + 1][j] == '#') b = true;
			if (j - 1 >= 0 && t[i][j - 1] == '#') b = true;
			if (j + 1 < W && t[i][j + 1] == '#') b = true;
			if (!b) {
				c = false;
				break;
			}
		}
		if (!c) break;
	}
	cout << (c ? "Yes" : "No");
}
int main() {
	GridRepainting();
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define x first
#define y second
#define all(v) v.begin(), v.end()
using namespace std;

typedef long long ll;
typedef pair<ll, ll> p;

string s;

void f(int a, int b){
	reverse(s.begin()+a, s.begin()+b+1);
	for(int i=a; i<=b; i++){
		if(s[i] == 'L') s[i] = 'R';
		else s[i] = 'L';
	}
}

int f(){
	int ret = 0;
	for(int i=0; i<s.size(); i++){
		if(i-1 >= 0 && s[i] == 'L' && s[i-1] == 'L') ret++;
		if(i+1 < s.size() && s[i] == 'R' && s[i+1] == 'R') ret++;
	}
	return ret;
}

int main(){
	ios_base::sync_with_stdio(0); cin.tie(0);
	int n, k; cin >> n >> k;
	cin >> s;
	int st = -1;
	int cnt = 0;
	
	int lr = 0;
	int rl = 0;
	
	for(int i=0; i<s.size(); i++){
		if(cnt == k) break;
		if(st == -1){
			if(i+1 >= s.size()) continue;
			if(s[i] == s[i+1]) continue;
			if(s[i] == 'L' && s[i+1] == 'R') lr = 1;
			else rl = 1;
			st = i;
		}else{
			if(i+1 >= s.size()) continue;
			if(lr && s[i] == 'R' && s[i+1] == 'L'){
				f(st+1, i); st = -1; cnt++;
			}else if(rl && s[i] == 'L' && s[i+1] == 'R'){
				f(st+1, i); st = -1; cnt++;
			}
		}
	}
	if(st != -1 && cnt < k){
		f(st+1, s.size()-1);
	}
	
	cout << f();
}

Measured memory_bytes: 512
#include <iostream> // cout, endl, cin
#include <cmath> //sqrt pow
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // dequef
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower

#define rep(i,n) for(int i = 0; i < n; i++)
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int, int>
#define all(a) (a).begin(), (a).end()
#define mod 1000000007
using ll = long long;
using namespace std;
int main(){
  int x;
  cin >> x;
  cout << (x ^ 1) << endl;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
int main(){
    int A[9]={0};
    int C[9]={0};
    for(int i=0;i<9;i++)cin >> A[i];
    int N;
    cin >> N;
    int b[N];
    for(int j=0;j<N;j++){
        cin >> b[j];
        for(int u=0;u<9;u++)
        if(b[j]==A[u]){
            C[u]=1;
        }
    }
    if((C[0]==1)&&(C[1]==1)&&(C[2]==1)){
        cout << "Yes" <<"\n";
    }else if((C[3]==1)&&(C[4]==1)&&(C[5]==1)){
        cout << "Yes" <<"\n";
    }else if((C[6]==1)&&(C[7]==1)&&(C[8]==1)){
        cout << "Yes" <<"\n";
    }else if((C[0]==1)&&(C[3]==1)&&(C[6]==1)){
        cout << "Yes" <<"\n";
    }else if((C[1]==1)&&(C[4]==1)&&(C[7]==1)){
        cout << "Yes" <<"\n";
    }else if((C[2]==1)&&(C[5]==1)&&(C[8]==1)){
        cout << "Yes" <<"\n";       
    }else if((C[0]==1)&&(C[4]==1)&&(C[8]==1)){
        cout << "Yes" <<"\n";
    }else if((C[2]==1)&&(C[4]==1)&&(C[6]==1)){
        cout << "Yes" <<"\n";
    }else{
        cout << "No" <<"\n";
    }
}

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

int main(){
  int s;
  cin >> s;
  vector<int> A(1000000);
  A.at(0) = s;
  for(int i = 1;;i++){
    if(A.at(i-1)%2==0){
      A.at(i) = A.at(i-1)/2;
    }
    else{
      A.at(i) = 3 * A.at(i-1) + 1;
    }
    for(int j = 0; j < i; j++){
      if(A.at(j) == A.at(i)){
        cout << i+1;
        return 0;
      }
    }
  }
}

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

int main(){
    int r, D, xs;
    int x[10];
    cin >> r >> D >> xs;
    for(int i=0;i<10;i++){
        if(i==0){
            x[i] = r*xs - D;
        }
        else{
            x[i] = r*x[i-1] - D;
        }
    }
    for(int j=0;j<10;j++){
        // 出力
        cout << x[j] << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<bits/stdc++.h>
 
using namespace std;
 
int main(){
  int N,a,b;
  cin >> N;
  long long X[N+1],Y[N+1];
  for(int i=0; i<N; i++){
    cin >> X[i];
    Y[i]=X[i];
  }
  sort(X,X+N);
  a=X[N/2-1];
  b=X[N/2];
 
 for(int j=0; j<N; j++){
   if(Y[j]<=a){
     cout << b << endl;
   }else{
     cout << a << endl;
   }
 }
}


Measured memory_bytes: 5376
import java.util.*;

public class Main {

  public static void main (String[] args) {

    Scanner sc = new Scanner(System.in);

    int N = sc.nextInt();
    int[] H = new int[N];

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

    sc.close();

    int count = 0;

    int max = 0;

    for (int i = 0; i < N; i++) {
      if (max <= H[i]) {
        max = H[i];
        count++;
      }
    }

    System.out.println(count);

  }

}

Measured memory_bytes: 23252
#include "iostream"
#include "math.h"
#include "algorithm"
#include "string"
#include "vector"
using namespace std;

int main() {
	int n;
	cin >> n;
	int r[200005];
	for (int i = 0; i < n; i++) {
		cin >> r[i];
	}
	int min = r[0];
	int maxDis = r[1] - r[0];
	for (int i = 1; i < n - 1; i++) {
		if (r[i] < min)min = r[i];
		if (maxDis < r[i + 1] - min) {
			maxDis = r[i + 1] - min;
		}
	}
	cout << maxDis << endl;
}


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

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define MOD 1000000007LL

#define rep(i, n) for(ll (i) = 0LL;(i) < (ll)(n);(i)++)
#define rep2(i, s, e) for(ll (i) = (ll)(s);(i) < (ll)(e);(i)++)
#define repi(i, n) for(ll (i) = 0LL;(i) <= (ll)(n);(i)++)
#define repi2(i, s, e) for(ll (i) = (ll)(s);(i) <= (ll)(e);(i)++)
#define per(i, n) for(ll (i) = (ll)(n) - 1LL;(i) >= 0LL;(i)--)
#define per2(i, s, e) for(ll (i) = (ll)(s) - 1LL;(i) >= (ll)(e);(i)--)
#define peri(i, n) for(ll (i) = (ll)(n);(i) >= 0LL;(i)--)
#define peri2(i, s, e) for(ll (i) = (ll)(s);(i) >= (ll)(e);(i)--)
#define iter(i, it) for(auto &(i): (it))

template<typename T, typename U> ostream& operator<<(ostream &s, const pair<T, U> m) {
    cout << "(" << m.first << ", " << m.second << ")";
    return s;
}
template<typename T, typename U> ostream& operator<<(ostream &s, const map<T, U> m) {
    ll c = 0;
    cout << "{ ";
    iter(i, m) cout << i << (c++ == m.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const vector<T> &v) {
    cout << "{ ";
    rep(i, v.size()) cout << v[i] << (i == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const list<T> &v) {
    ll c = 0;
    cout << "{ ";
    iter(i, v) cout << i << (c++ == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}

int main(void) {
    ll N, M, X, Y;
    cin >> N >> M >> X >> Y;
    vector<ll> A(N + 1), B(M + 1);
    A[0] = X;
    B[0] = Y;
    rep(i, N) cin >> A[i + 1];
    rep(i, M) cin >> B[i + 1];
    sort(A.begin(), A.end());
    sort(B.begin(), B.end());
    if(A.back() < B.front() || B.front() < A.front()) cout << "No War";
    else cout << "War";
    cout << endl;
    return 0;
}


Measured memory_bytes: 3652
#include<iostream>
using namespace std;
int main(){
	int x, b, cards[4][13];
	char P;
	cin >> x;
	for (int i = 0; i < 4; i++){
		for (int k = 0; k < 13; k++){
			cards[i][k] = 0;
		}
	}
	for (int h = 0; h < x; h++){
		cin >> P >> b;
		if (P == 'S'){
			cards[0][b - 1] = 1;
		}
		if (P == 'H'){
			cards[1][b - 1] = 1;
		}
		if (P == 'C'){
			cards[2][b - 1] = 1;
		}
		if (P == 'D'){
			cards[3][b - 1] = 1;
	}
}
for (int r = 0; r < 4; r++){
	for (int m = 0; m < 13; m++){
		if (cards[r][m] == 0){
			if (r == 0){
				cout << "S" << " " << m + 1 << endl;
			}
			if (r == 1){
				cout << "H" << " " << m + 1 << endl;
			}
			if (r == 2){
				cout << "C " << m + 1 << endl;
			}
			if (r == 3){
				cout << "D " << m + 1 << endl;
			}
		}
	}
	}
	
	return 0;
}

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define int long
using pi=pair<int,int>;
signed main(){
    int n,m;
    cin>>n>>m;
    vector<int> h(n);
    for(auto& i:h)cin>>i;
    vector<bool> l(n, true);
    for (int i = 0; i < m; ++i) {
        int a,b;
        cin>>a>>b;
        --a,--b;
        if (h[a] >= h[b]) l[b] = false;
        if (h[a] <= h[b]) l[a] = false;
    }
    int res=0;
    for(auto i:l)if(i)++res;
    cout << res;
}

Measured memory_bytes: 3976
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.*;


public class Main {

    char[][] c;

    private void solve() {
        c = new char[3][];
        for(int i = 0;i < 3;i++) {
            c[i] = next().toCharArray();
        }

        for(int i = 0;i < 3;i++) {
            out.print(c[i][i]);
        }
        out.println();
    }

    public static void main(String[] args) {
        out.flush();
        new Main().solve();
        out.close();
    }

    /* Input */
    private static final InputStream in = System.in;
    private static final PrintWriter out = new PrintWriter(System.out);
    private final byte[] buffer = new byte[2048];
    private int p = 0;
    private int buflen = 0;

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

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

    private boolean isPrint(int ch) {
        if (ch >= '!' && ch <= '~')
            return true;
        return false;
    }

    private int nextByte() {
        if (!hasNextByte())
            return -1;
        return buffer[p++];
    }

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

    public int nextInt() {
        return Integer.parseInt(next());
    }

    public long nextLong() {
        return Long.parseLong(next());
    }

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

Measured memory_bytes: 21460
a,b=list(map(int, input().split()))
n = [list(str(input())) for _ in range(a)]

y = []
for i, name in enumerate(n):
    if not all([j == "." for j in name]):
        y.append(name)

nc = []
for _ in range(len(y[0])):
    nnc = []
    for _ in range(len(y)):
        nnc.append("#")
    nc.append(nnc)

for i, name in enumerate(y):
    for k, name2 in enumerate(name):
        nc[k][i] = name2

z = []
for i, name in enumerate(nc):
    if not all([j == "." for j in name]):
        z.append(name)

nc = []
for _ in range(len(z[0])):
    nnc = []
    for _ in range(len(z)):
        nnc.append("#")
    nc.append(nnc)

for i, name in enumerate(z):
    for k, name2 in enumerate(name):
        nc[k][i] = name2

for i in nc:
    print("".join(i))

Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll n,ans=0,p=5;
int main(){
   cin>>n;
   if(n%2) cout<<ans;
   else
     {
     	while(n/p)
		 {
		 	ans+=n/p/2;
		 	p=p*5;	
		   }  cout<<ans; 
	 }
	
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define vout(x) rep(i,x.size()) cout << x[i] << " "
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
template<class T> bool chmax(T &a, T b) {if(a<b) {a=b;return 1;}return 0;}
using namespace std;
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<int,int>;
const int inf = 1e9;
const ll inf_l = 1e18;
const int MAX = 1e5;

int main() {
    int k; cin >> k;
    string s; cin >> s;
    if (s.size() <= k) cout << s << endl;
    else {
        string tmp = s.substr(0,k);
        cout << tmp << "..." << endl;
    }
}

Measured memory_bytes: 3628
#define _CRT_SECURE_NO_WARNINGS
#define forn(i, a, n) for(int i = a; i < n; ++i)
#define pb push_back
#define mp make_pair
//#define f first
//#define sex second

#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <stack>
#include <set>
#include <ostream>
#include <queue>
#include <functional>
#include <sstream>
#include <map>

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
#pragma comment(linker, "/STACK:228228000")
const ll mod = 998244353;

ll n, res, en;
pll a[(ll)1e6];
ll ch[(ll)1e6];
ll st[(ll)1e6];

ll f(ll i)
{
	return i & (i + 1);
}

ll f2(ll i)
{
	return i | (i + 1);
}


void grade(ll i, ll q)
{
	if (q == a[i].first || q == a[i].second)
		return;
	if (st[q] > st[a[i].second])
	{
		a[i].second = q;
	}

	if (st[a[i].first] < st[a[i].second])
	{
		swap(a[i].second, a[i].first);
	}
}


ll get(ll i)
{
	pll ret;
	ret.first = st[a[i].first];
	ret.second = st[a[i].second];
	while (i > 0)
	{
		i--;
		if (st[a[i].first] + st[a[i].second] > ret.first + ret.second)
		{
			ret = a[i];
			ret.first = st[a[i].first];
			ret.second = st[a[i].second];
		}
		i = f(i);
	}
	return(ret.first + ret.second);
}


int main()
{
	/*

	#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	#endif
	*/

	cin >> n;
	en = (1 << n);
	forn(i, 0, en)
	{
		cin >> st[i + 1];
	}
	forn(i, 0, en)
	{
		ll j = i + 1;
		ll q = j;
		grade(i, q);
		ll t = 1;
		while (t < en)
		{
			grade(i | t, a[i].first);
			t = t << 1;
		}
		t = 1;
		while (t < en)
		{
			grade(i | t, a[i].second);
			t = t << 1;
		}
	}

	forn(i, 1, en)
	{
		cout << get(i) << endl;
	}

	return 0;
}


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

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

		for (int i = 0; i < N; i++) {
			d[i] = sc.nextInt();
		}
		sc.close();
		Arrays.sort(d);
		if (d[N / 2 - 1] == d[N / 2]) {
			System.out.println(0);
		} else {
			System.out.println(d[N / 2] - d[N / 2 - 1]);
		}
	}
}



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

using namespace std;

#define int long long
#define LL long long
#define ULL unsigned long long

const int LL_INF = ~(ULL)0 >> 1;

int n, res[1002], mem[1002][8];

int cal(int d, int join) {
    if (mem[d][join] != LL_INF) return mem[d][join];
    if (d == n - 1) {
        return 1;
    }

    int nextres = 1 << res[d + 1], ans = 0;
    for (int i = 0; i < 8; ++i) {
        int a = i & nextres, b = i & join;
        if (!(i & nextres) || !(i & join)) continue;

        ans += cal(d + 1, i);
        ans %= 10007;
    }

    mem[d][join] = ans;
    return ans;
}

signed main() {
    for (int i = 0; i < 1002; ++i) {
        fill(mem[i], mem[i] + 8, LL_INF);
    }

    string temp;
    cin >> n >> temp;
    for (int i = 0; i < n; ++i) {
        switch (temp[i]) {
            case 'J':
                res[i] = 0;
                break;
            case 'O':
                res[i] = 1;
                break;
            case 'I':
                res[i] = 2;
        }
    }

    int nextres = (1 << res[0]) | 1, ans = 0;
    for (int i = 0; i < 8; ++i) {
        int a = i & nextres;
        if ((i & nextres) != nextres) continue;

        ans += cal(0, i);
        ans %= 10007;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1344
//itp1_topic2_a
#include <bits/stdc++.h>
using namespace std;
int main(){
  int a,b;
  cin>>a>>b;
  if( a < b ) cout<<"a < b"<<endl;
  if( a > b ) cout<<"a > b"<<endl;
  if( a == b ) cout<<"a == b"<<endl;
  return 0;
}



Measured memory_bytes: 3088
n = int(input())
t,x,y = 0,0,0
for i in range(n):
    a,b,c = t,x,y
    t,x,y = map(int,input().split())
    if t-a < (x-b)+(y-c):
        print("No")
        exit()
    if (t-a)%2 != ((x-b)+(y-c))%2:
        print("No")
        exit()
print("Yes")

Measured memory_bytes: 3064
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
vector<int> fibonacci;
int main(void){
    int n;
    cin >> n;
    int b = 1;
    int c = 1;
    fibonacci.push_back(b);
    fibonacci.push_back(c);
    for(int i=2;i<n;i++){
        int a = b + c;
        fibonacci.push_back(a);
        c = b;
        b = a;
    }
    cout << fibonacci[n-1] + fibonacci[n-2] << endl;
    return 0;
}


Measured memory_bytes: 3136
using System;
using System.Collections.Generic;
using System.Linq;
class Program
{
    static void Main(string[] args)
    {
        string[] input = Console.ReadLine().Split();
        long a = long.Parse(input[0]);
        long b = long.Parse(input[1]);
        Console.WriteLine(Lcm(a, b));
    }
    // 最小公倍数
    public static long Lcm(long a, long b)
    {
        return a * b / Gcd(a, b);
    }

    // ユークリッドの互除法 
    public static long Gcd(long a, long b)
    {
        if (a < b)
            // 引数を入替えて自分を呼び出す
            return Gcd(b, a);
        while (b != 0)
        {
            var remainder = a % b;
            a = b;
            b = remainder;
        }
        return a;
    }
}


Measured memory_bytes: 13140
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 1001001001;
const int MOD = 1000000007;

template <typename T>
void print(const T &v);

ll g(ll n)
{
    return (n * (n + 1)) / 2;
}

int main()
{
    ll n;
    cin >> n;
    ll ans = 0;
    for (ll i = 1; i <= n; i++)
    {
        ans += i * g(n / i);
    }
    cout << ans << endl;
    return 0;
}

// Use For Debug
template <typename T>
void print(T const &v)
{
    for (int i = 0; i < v.size(); i++)
    {
        if (i)
            cout << " ";
        cout << v[i];
    }
    cout << endl;
}

Measured memory_bytes: 3616
S = input('')
num = 0
num_rev = [0,0,0]
for i in range(3):
    if S[i] == 'R':
        num += 1
    elif S[i] == 'S':
        num_rev[i] = num
        num = 0
        

print(max(num,num_rev[0],num_rev[1],num_rev[2]))


Measured memory_bytes: 9040
#include<bits/stdc++.h>
#define fo(i,a,b) for(int i= a ; i < b ; ++i)
#define rep(i,n) fo(i,0,n)
#define pln(n) printf("%lld\n",n)
#define sll(n) scanf("%lld",&n)
#define ss(n) scanf("%s",n)
#define vi vector < int >
#define pii pair < int , int >
#define pb push_back
#define mp make_pair
#define ll long long
#define ull unsigned long long
#define INF 0x3f3f3f3f
#define dbg(x) { cout<< #x << ": " << (x) << endl; }
#define dbg2(x,y) { cout<< #x << ": " << (x) << " , " << #y << ": " << (y) << endl; }
#define dbg3(x,y,z) { cout<< #x << ": " << (x) << " , " << #y << ": " << (y) <<" , "<< #z <<": "<<(z)<<endl; }
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
#define vll vector<long long>
#define vvi vector<vector<int>>
#define si set<int>
#define tr(c, it) \
for(decltype(c.begin()) it = c.begin(); it!= c.end(); it++)
#define pis pair<int,string>
#define present(c, x) (c.find(x) != c.end())
#define cpresent(c, x) (find(all(c),x) != c.end())
#define mod (int)(1e9 + 7) 

using namespace std;
long long dp[105][100005];

int main(){
	int n, k;
	cin >> n >> k;
	vector<int> a(n);
	for(int i = 0; i < n; i++){
		cin >> a[i];
	}
	for(int i = 0; i <= n; i++){
		dp[i][0] = 1;
	}
	vector<long long> prefix_sum(k+1);
	for(int j = 0; j <= k; j++){
		if(j <= a[n-1])dp[n-1][j] = 1;
		else dp[n-1][j] = 0;
		if(j > 0)prefix_sum[j] = prefix_sum[j-1] + dp[n-1][j];
		else prefix_sum[j] = dp[n-1][j];
		if(prefix_sum[j] > mod){
			prefix_sum[j] -= mod;
		}
	}

	for(int i = n-2; i >= 0; i--){
		vector<long long> new_prefix_sum(k+1);
		for(int j = 0; j <= k; j++){
			dp[i][j] = 0;
			if(j >= a[i] + 1)dp[i][j] += (prefix_sum[j] - prefix_sum[j - a[i] - 1] + mod)%mod;
			else dp[i][j] = prefix_sum[j];
			if(dp[i][j] > mod) dp[i][j] -= mod;
			if(j > 0)new_prefix_sum[j] = new_prefix_sum[j-1] + dp[i][j];
			else new_prefix_sum[j] = dp[i][j];
			if(new_prefix_sum[j] > mod){
				new_prefix_sum[j] -= mod;
			}
		}
		prefix_sum = new_prefix_sum;
	}
	cout << dp[0][k]%mod <<endl;
}

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

using namespace std;

void fastscan(int &number) { 
  register int c; 
  number = 0; 
  c = getchar_unlocked(); 
  while (c == ' ')
    c = getchar_unlocked();
  for (; (c > 47 && c < 58); c = getchar_unlocked()) 
    number = number * 10 + c - 48; 
} 

void fastprint(int number) { 
  if (number == 0){
    putchar(48);
    return;
  }
  int length = 0;
  char num[20];
  while(number > 0){
    num[length] = number % 10 + 48;
    length++;
    number /= 10;
  }
  register int i;
  for(i = length - 1; i >= 0; i--)
    putchar_unlocked(num[i]);
}

void input(int& N, int& M, int& K,
	   vector<int>& deskA, vector<int>& deskB)
{
  int a, b;
  fastscan(N);
  fastscan(M);
  fastscan(K);
  deskA.resize(N + 1, 0);
  deskB.resize(M + 1, 0);
  for (int i = 1; i <= N; i++){
    fastscan(a);
    deskA[i] = deskA[i - 1] + a;
  }
  for (int i = 1; i <= M; i++){
    fastscan(b);
    deskB[i] = deskB[i - 1] + b;
  }
}

void findans(int& N, int& M, int& K,
	     vector<int>& deskA, vector<int>& deskB, 
	     int& maximum)
{
  for (int i = 0; i <= N; i++)
    if (K - deskA[i] >= 0)
      for (int j = max(maximum - i, 0); j <= M; j++)
	if (K - deskA[i] - deskB[j] >= 0){
	  if (i + j > maximum)
	    maximum = i + j;
	}
	else
	  break;
    else
      break;
}

int main(void)
{
  int N, M, K, maximum = 0;
  vector<int> deskA, deskB;
  input(N, M, K, deskA, deskB);
  findans(N, M, K, deskA, deskB, maximum);
  fastprint(maximum);
  return 0;
}


Measured memory_bytes: 4708
#include <iostream>
#include <vector>
#include <cctype>
#include <cstdlib>
using namespace std;

int main(){
    int N;
    cin >> N;
    vector<vector<string>> S(N+1);
    for(int i=0;i<=N;i++){
        string s;
        cin >> s;
        string t = "";
        for(int j=0;j<(int)s.size();j++){
            if(isdigit(s[j])) t += s[j];
            else{
                if(t!="") S[i].push_back(t);
                t = "";
                S[i].push_back({s[j]});
            }
        }
        if(t!="") S[i].push_back(t);
    }
    auto comp = [&](vector<string> s,vector<string> t){
        int n = s.size(),m = t.size();
        for(int i=0;i<min(n,m);i++){
//            cerr << s[i] << " " << t[i] << endl;
            if(s[i]==t[i]) continue;
            if(isdigit(s[i][0]) && !isdigit(t[i][0])) return true;
            else if(!isdigit(s[i][0]) && isdigit(t[i][0])) return false;
            else if(!isdigit(s[i][0]) && !isdigit(t[i][0])) return s[i]<=t[i];
            else{
                return stoi(s[i])<=stoi(t[i]);
            }
        }
        return n<=m;
    };
    for(int i=1;i<=N;i++){
        cout << (comp(S[0],S[i])? '+':'-') << endl;
    }
}


Measured memory_bytes: 3592
#include <iostream>
#include <iomanip>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <array>
#include <tuple>
#include <string>
#include <algorithm>
#include <functional> // greater など
#include <cmath>      // abs など
#include <numeric>    // accumulate, gcd など
#include <cassert>    // assert
#include <stdexcept>
#include <bitset>
using namespace std;

// #include <boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision;

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

// GCC, 配列のアクセスなど
#define _GLIBCXX_DEBUG
// Clang, 配列のアクセスなど
#define _LIBCPP_DEBUG 0

#define NDEBUG 1
// debug用出力 https://trap.jp/post/998/
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T)
{
    cerr << H << " ";
    debug_out(T...);
}
#ifdef NDEBUG
#define debug(...)
#else
#define debug(...) debug_out(__VA_ARGS__)
#endif

//////////////// //////////////// //////////////// //////////////// ////////////////
//////////////// //////////////// //////////////// //////////////// ////////////////

constexpr int max_n = 500 + 5;

int n,m,q;
vector<vector<int>> sums(max_n, vector<int>(max_n));

int main()
{
    // 高速な入出力
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << setprecision(15); // 浮動小数の表示の精度

    cin>>n>>m>>q;
    rep(i, m) {
        int l, r; cin>>l>>r;
        sums[l][r] += 1;
    }
    // 累積和
    rep(i, n) {
        rep(j, n) {
            sums[i+1][j+1] += sums[i][j+1] + sums[i+1][j] - sums[i][j];
        }
    }
    #ifndef NDEBUG
    rep(i, n+1) {
        rep(j, n+1) {
            cerr << sums[i][j] << ' ';
        }
        cerr << '\n';
    }
    #endif

    rep(i, q) {
        int a,b; cin>>a>>b;
        int res = sums[b][b] - sums[a-1][b] - sums[b][a-1] + sums[a-1][a-1];
        cout << res << '\n';
    }

    return 0;
}


Measured memory_bytes: 4612
/*		author:: ajeet  */
/*			*/

	#include<bits/stdc++.h>
	using namespace std;
	#define int long long int
	#define pb push_back
	const int mod=1e9+7;
	#define all(x) x.begin(),x.end()
	#define endl '\n'
	#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
	int32_t main(){
		IOS;
		int n;
		cin>>n;
		map<string,int>mp;
		for(int i=0;i<n;i++){
			string s;
			cin>>s;
			mp[s]++;
		}
		cout<<mp.size()<<endl;
		return 0;
	}


Measured memory_bytes: 19288
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
const ld eps = 1e-9;


vector<int>primes;
void hurui(const int amax) {
	static bool flag = false;
	if (flag)return;
	vector<int>sos;
	sos = vector<int>(amax + 1, true);
	sos[0] = false; sos[1] = false;
	for (int i = 2; i <= amax; ++i) {
		if (sos[i]) {
			for (int j = 2 * i; j <= amax; j += i)sos[j] = false;
		}
	}
	for (int i = 0; i <= amax; ++i) {
		if (sos[i]) {
			primes.push_back(i);
		}
	}
	flag = true;
}

int main() {
	hurui(3e4);
	while (true) {
		int T;cin>>T;
		if(!T)break;
		int ans=0;
		for (int i = 0; i < primes.size(); ++i) {
			for (int j = i; j < primes.size(); ++j) {
				int a=primes[i];
				int b=primes[j];
				int c=T-a-b;
				if(b>c)continue;
				if(a+b<=c)continue;
				if (binary_search(primes.begin(), primes.end(), c)) {
					ans++;
				}
			}
		}
		cout<<ans<<endl;
	}


	return 0;
}


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

int main(void) {
    long long x, y, ans;
    cin >> x >> y;
    ans = x * y - x;
    if (!(ans % x) && ans % y) {
        cout << ans << endl;
        return 0;
    }
    cout << -1 << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
    int n = 0, a[105] = {0}, m = 0, b[105] = {0}, x = 0, y = 0, i = 0, j = 0, z = 0, most = -101, least = 101;
    cin >> n >> m >> x >> y;
    for(i = 0; i < n; i++)
    {
        cin >> a[i];
        if(a[i] >= most)
        {
            most = a[i];
        }
    }
    for(i = 0; i < m; i++)
    {
        cin >> b[i];
        if(b[i] <= least)
        {
            least = b[i];
        }
    }

    if(most < least && least > x && least <= y)
    {
        cout << "No War";
    }
    else
    {
        cout << "War";
    }
return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
int n,i,j,k,r=0,a[200001];
scanf("%d",&n);

for(i=0;i<n;i++)
scanf("%d",&a[i]);
for(j=0;j<n-1;j++)
  for(k=j+1;k<n;k++)
     r=r+a[j]*a[k];    
     printf("%d",r);
return 0;
}


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

int main()
{
  int N;
  cin >> N;
  vector<int> A(N);
  for (int i = 0; i < N; i++)
  {
    cin >> A.at(i);
  }

  // 奇数が出るまで繰り返す
  int count = 0;
  bool isOdd = false;
  for (int i = 0;; i++)
  {
    for (int i = 0; i < N; i++)
    {
      if (A.at(i) % 2 == 1)
      {
        isOdd = true;
        break;
      }
      A.at(i) /= 2;
      count++;
    }
    if (isOdd)
    {
      break;
    }
  }

  // 出力する
  int canDo = count / N;
  cout << canDo << endl;
}

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

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)n; ++i)
#define FOR(i, a, b) for(ll i = a; i < (ll)b; ++i)
#define rrep(i, n) for(int i = ((int)n - 1); i >= 0; --i)

typedef long long ll;

const ll Inf = 1e17;
const double EPS = 1e-9;
const int MOD = 1e9 + 7;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    ll n;
    cin >> n;
    ll ans = Inf;
    FOR (i, 1, sqrt(n) + 1) {
        if (n % i == 0) {
            ll t = n / i;
            ans = min(ans, (t - 1 + i - 1));
        }
    }
    cout << ans << endl;
    
    return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<map>
#include<vector>
#include<cmath>
#include<string>
#include <algorithm> 
using namespace std;

# define p(s) std::cout << s << endl;
# define printIf(j,s1,s2) cout << (j ? s1 : s2) << endl;
# define YES(j) cout << (j ? "YES" : "NO") << endl;
# define Yes(j) std::cout << (j ? "Yes" : "No") << endl;

int main()
{
    int n;cin >> n;
    int a1[101];
    int a2[101];
    int a2_tmp[101];


    int sum =0;
    for(int i=1;i<=n;i++){
        int tmp;cin >> tmp;
        sum += tmp;
        a1[i]=sum;
    }

    for(int i=1;i<=n;i++){
        cin >> a2_tmp[i];
    }

    sum =0;
    for(int i=n;i>=1;i--){
        sum += a2_tmp[i];
        a2[i] = sum;
    }

    int res=a1[1]+a2[1];
    for(int i=2;i<=n;i++){
        res=max(a1[i]+a2[i],res);
    }
    p(res)
} 

Measured memory_bytes: 256
import math
import itertools
n, m = map(int, input().split())
e = [set(map(int, input().split())) for _ in range(m)]

n_list = []
for i in range(1, n+1):
    n_list.append(i)
n_array = sorted(list(itertools.permutations(n_list)))

count = 0

for i in range(math.factorial(n-1)):
    for j in range(n-1):
        if not (set(n_array[i][j:j + 2]) in e):
            break
    else:
        count += 1
print(count)

Measured memory_bytes: 46700