akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(s) s.begin(), s.end()
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
const int MX = 100005, INF = 1001001001;
const ll LINF = 1e18;
const double eps = 1e-10;
const ll mod = 1e9+7;

int n;

int main()
{
    cin >> n;
    vl t,a;
    t.resize(n); a.resize(n);
    rep(i,n) cin >> t[i] >> a[i];

    ll l = 1;
    ll r = 1;
    rep(i,n){
        ll kl,kr;
        kl = l/t[i]; kr = r/a[i];
        if(l%t[i] != 0) kl++;
        if(r%a[i] != 0) kr++;
        ll k = max(kl, kr);
        l = t[i]*k; r = a[i]*k;
    }
    cout << (ll)r+l << endl;
}


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

int main()
{
    ios::sync_with_stdio(0);

    int k,x;
    cin>>k>>x;
    int st = x-k+1;
    int ed = x+k-1;

//    cout<<st<<' '<<ed<<endl;
//    return 0;

    for(int i=st; i<=ed; i++){
        cout<<i<<' ';
    }
    cout<<endl;







}


Measured memory_bytes: 256
N,K=gets.split.map(&:to_i)
as=gets.split.map(&:to_i)
ss=Array.new(N)
ss[0]=as[0]
for i in 1..N-1
    ss[i]=ss[i-1]+as[i]
end
ss.map!{|e|e%K}
h=Hash.new
ss.each do |e|
    if h[e].nil?
        h[e]=0
    else
        h[e]+=1
    end
end
h[0]+=1 if !h[0].nil?
p h.values.map{|e|e*(e+1)/2}.inject(:+)


Measured memory_bytes: 13964
#include<bits/stdc++.h>
using namespace std;
int main(void)
{
  int a[32] ={ 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  int n;
  cin >> n;
  cout << a[n-1];
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
int n,h[111],flag1=1,flag2,ans=0,i,j,k,min;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",&h[i]);
if(h[i]!=0)
flag1=0;
}
while(flag1==0){
k=-1;
flag2=1;
min=111;
for(i=0;i<n;i++){
if(h[i]==0){
for(j=k+1;j<i;j++)
h[j]-=min;
if(min<111)
ans+=min;
k=i;
min=111;
}
else if(h[i]<min){
min=h[i];
flag2=0;
}
}
for(j=k+1;j<i;j++)
h[j]-=min;
if(min<111)
ans+=min;
if(flag2==1)
flag1=1;
}
printf("%d\n",ans);
return 0;
}


Measured memory_bytes: 128
#include <iostream>

using namespace std;

int main()
{
    int a,b,sum,diff,product;
    cin >> a >> b;
    sum=a+b;
    diff=a-b;
    product=a*b;
    if ((sum>diff || sum==diff) && (sum>product || sum==product)){
        cout << sum;
    }else if ((diff>sum || diff==sum) && diff>product){
        cout << diff;
    }else{
        cout << product;
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int         long long
#define mod         1000000007
#define FAST        ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define f(i,n)      for(int i=0;i<n;i++)
#define fp(i,k,n)   for(int i=k;i<=n;i++)
#define fr(i,k,n)   for(int i=k;i>=n;i--)
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define dbg(x)      cout << (#x) << " is " << (x) << '\n' 
#define F           first
#define S           second
#define sz(x)       (int)(x).size()
#define lb          lower_bound
#define ub          upper_bound
#define mems(x)     memset(x,0,sizeof(x))
#define all(a)      a.begin(),a.end()
typedef tree<int,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
/*---------------------------------------------------------------------------------------------------*/

void solve()
{
  int n;
  cin >> n;
  int ans[n+1]={0};
  fp(x,1,sqrt(n))
  {
    fp(y,1,sqrt(n))
    {
      fp(z,1,sqrt(n))
      {
        int val=x*x + y*y + z*z + x*y + y*z +x*z;
        if(val>n)
          break;
        else
          ans[val]++;
      }
    }
  }
    fp(i,1,n)
        cout << ans[i] << '\n';
    // cout << '\n';
  return;
} 

signed main()
{
  FAST
  int T=1;
//   cin >> T;
  while(T--)
  {
    solve();
  }
  return 0;
}


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

#define HEAP priority_queue
#define rep(i, n) for(int i = 0, _end_ = (n); i < _end_; ++i)
#define per(i, n) for(int i = (n) - 1; i >= 0 ; --i)
#define forn(i, l, r) for(int i = (l), _end_ = (r); i <= _end_; ++i)
#define nrof(i, r, l) for(int i = (r), _end_ = (l); i >= _end_; --i)
#define FOR(a, b) for(auto (a): (b))
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define X first
#define Y second
#define eps 1e-6
#define pi 3.1415926535897932384626433832795
#define SZ(x) (int)x.size()
#define ALL(x) x.begin(), x.end()
#define FILL(a, b) memset((a), (b), sizeof((a)))
#define MCPY(a, b) memcpy((a), (b), sizeof((b)))

using namespace std;

typedef long long LL;
typedef double flt;
typedef vector<int> vi;
typedef vector<LL> vl;
typedef pair<int,int> pii;
typedef pair<int,LL> pil;
typedef pair<LL,int> pli;
typedef pair<LL,LL> pll;
typedef vector<pil> vil;
typedef vector<pii> vii;
typedef vector<pli> vli;
typedef vector<pll> vll;

const int iinf = 1e9 + 7;
const int oo = 0x3f3f3f3f;
const LL linf = 1ll << 60;
const flt dinf = 1e60;

template <typename T>
inline void scf(T &x)
{
	bool f = 0; x = 0; char c = getchar();
	while((c < '0' || c > '9') && c != '-') c = getchar();
	if(c == '-') { f = 1; c = getchar(); }
	while(c >= '0' && c <= '9') { x = x * 10 + c - '0'; c = getchar(); }
	if(f) x = -x; return;
}
template <typename T1, typename T2>
void scf(T1 &x, T2 &y) { scf(x); return scf(y); }
template <typename T1, typename T2, typename T3>
void scf(T1 &x, T2 &y, T3 &z) { scf(x); scf(y); return scf(z); }
template <typename T1, typename T2, typename T3, typename T4>
void scf(T1 &x, T2 &y, T3 &z, T4 &w) { scf(x); scf(y); scf(z); return scf(w); }

inline char mygetchar(){ char c = getchar(); while(c == ' ' || c == '\n') c = getchar(); return c; }

template <typename T> inline bool chkmax(T &x, const T &y){ return y > x ? x = y, 1 : 0; }
template <typename T> inline bool chkmin(T &x, const T &y){ return y < x ? x = y, 1 : 0; }

#ifdef ONLINE_JUDGE
#define debug(...) ;
#else
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define DEBUG
#endif

//---------------------------------------------------------head----------------------------------------------------

int n;
LL a[200010];
LL sum[200010];

int main()
{
	scf(n);
	forn(i, 1, n) scf(a[i]), sum[i] = sum[i - 1] + a[i];
	LL ans = linf;
	forn(i, 1, n - 1) chkmin(ans, abs(sum[i] - (sum[n] - sum[i])));
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 3328
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <algorithm>
#include <unordered_map>

#define rep(i, a, b) for (ll i = a; i < b; i++)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> pll;
typedef unordered_map<string, ll> u_map;

// input
void input() {}
template <class Head, class... Tail>
void input(Head &&a, Tail &&... b)
{
    cin >> a;
    input(forward<Tail>(b)...);
}

template <class V>
void input(vector<V> &v)
{
    for_each(v.begin(), v.end(), [](auto &i) { input(i); });
}

// output
template <class V>
void output(vector<V> &v)
{
    for_each(v.begin(), v.end(), [](auto &x) { cout << x << " "; });
    cout << endl;
}

// math functions
ll mpow(ll a, ll n, ll p)
{
    ll x = 1;
    while (n > 0)
    {
        if (n & 1)
        {
            x = a * x % p;
        }
        a = a * a % p;
        n >>= 1;
    }

    return x;
}

ll mfact(ll n, ll p)
{
    ll res = 1;
    for (ll i = 2; i <= n; i++)
    {
        res = res * i % p;
    }
    return res;
}

ll mcomb(ll n, ll r, ll p)
{
    if (n == 0 && r == 0)
    {
        return 1;
    }
    if (n < r || n < 0 || r < 0)
    {
        return 0;
    }

    ll a = mfact(n, p);
    ll b = mfact(n - r, p);
    ll c = mfact(r, p);
    return (((a * mpow(b, p - 2, p)) % p) * mpow(c, p - 2, p)) % p;
}

ll gcd(ll a, ll b)
{
    if (a < b)
    {
        a ^= b;
        b ^= a;
        a ^= b;
    }
    return b ? gcd(b, a % b) : a;
}

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

int main()
{
    ll N;
    input(N);
    string S, T;
    input(S);
    input(T);

    string res;
    rep(i, 0, N)
    {
        res.push_back(S[i]);
        res.push_back(T[i]);
    }

    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
import collections

n = int(input())

a = list(map(int,input().split()))

q = collections.deque(a)

retu = sum(a)
ans = 0

for i in range(n):
    nowA = q.popleft()
    retu -= nowA
    ans += (nowA * retu)

ans = ans % (10**9 + 7)
print(ans)

Measured memory_bytes: 96676
#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>
/*
//#if __cplusplus >= 201103L
#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>
/*
//#if __cplusplus >= 201103L
#include <array>
#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>
*/
using namespace std;
#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl

#define uni(x) x.erase(unique(all(x)),x.end())
template<class T,class U>inline void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>inline void chmax(T &t,U f){if(t<f)t=f;}
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) > (b) ? (b) : (a))

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

#define INF INT_MAX/3
#define MAX_N 1000
#define M_INF 1000000000
#define MOD (ll)(1e9 + 7)

int n,m,v,i;
void solve(){
   cin.tie(0);
  ios::sync_with_stdio(false);
  cin>>n;
  string s1,s2;
  cin>>s1>>s2;
  ll ans = 1,kind = -1;
  while(i < n) {
        if (i < n - 1 && s1[i] == s1[i + 1]) {
            if (kind == -1) ans = (ans * 6) % MOD;
            else if (kind == 0) ans = (ans * 2) % MOD;
            else ans = (ans * 3) % MOD;
            kind = 1;
            i++;
        } else {
            if (kind == -1) ans = (ans * 3) % MOD;
            else if (kind == 0) ans = (ans * 2) % MOD;
            else ans = (ans * 1) % MOD;
            kind = 0;
        }
        i++;
    }
    cout << ans << endl;
}

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


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

using ll = long long;

int main() {
	ll A, B, N;
	cin >> A >> B >> N;
	ll x = B - 1;
	if (N < B - 1) x = N;
	ll ans = A * x / B - A * (x / B);
	cout << ans << endl;
}

Measured memory_bytes: 3604
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
#include<stdio.h>
#include<string.h>
#include <bitset>

using namespace std;
#define int  long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000
#define DEBUG_OUT true
#define ALL(x) (x).begin(),(x).end()

// int DP[MEM_SIZE][MEM_SIZE] = {0};
// int GMEM[MEM_SIZE][MEM_SIZE] = {0};
template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return; std::cout << e <<" ";}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){std::cout<< e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T,class... Ts> void DEBUG(T d, Ts... e){if(DEBUG_OUT == false)return;DEBUG(d);DEBUG(e...);};
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

//FUNCTION
void solve(void)
{
  int N;
  cin>>N;
  int ANS = 0;
  for (int i = 1; i <= N; i++)
  {
    if(i%3 == 0 || i%5 == 0)
    {

    }
    else
    {
      ANS += i;
    }
    
  }
  cout<<ANS<<endl;
  
  
  return;
}

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

  std::cout << std::fixed;
  std::cout << std::setprecision(15);
  solve();

  return 0;
}


Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  string s; cin >> s;
  const int n = s.size();
  for(int i = n - 1; i >= 0; i--) {
    if(s[i] == '?') {
      if(i == n - 1 || s[i + 1] == 'P') {
        s[i] = 'D';
      } else if(i != 0 && s[i - 1] == 'P') {
        s[i] = 'D';
      } else {
        s[i] = 'P';
      }
    }
  }
  cout << s << '\n';
}

Measured memory_bytes: 3780
#include<iostream>
#include<cstring>
using namespace std;
int cnt[28] = {0};
int main()
{
	string s;
	int cnt1 = 0;
	bool flag = 0;
	cin >> s;
	for(int i = 0; i <= s.size()-1; i++)
	{
		int a = s[i] - 'A';
		if(cnt[a] == 0)
		{
			cnt1++;
		}
		cnt[a]++; 
	}
	if(cnt1 != 2)
	{
		cout << "No" << endl;
		return 0;
	}
	for(int i = 0; i < 26; i++)
	{
		if(cnt[i] != 0 && cnt[i] != 2)
		{
			cout << "No" << endl;
			return 0;
		} 
	}
	cout << "Yes" << endl;
	return 0;
 } 

Measured memory_bytes: 256
/*   _/                _/                 _/_/_/   _/
  _/_/_/_/   _/_/   _/_/_/_/   _/_/    _/       _/_/
   _/     _/    _/   _/     _/    _/  _/_/_/     _/
  _/     _/    _/   _/     _/    _/  _/    _/   _/
   _/_/   _/_/       _/_/   _/_/      _/_/     _/ */
#include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<set>
#include<map>
#include<queue>
#include<vector>
using namespace std;
using ll=long long;
const int MOD=1e9+7;
const double pi=3.14159265358979323846;
const int inf=1e9+5;
const ll INF=1e18+5;
using P=pair<int,int>;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
int main() {
  cin.tie(0),cout.tie(0);
  ios::sync_with_stdio(false);
  int a,b,c,k,ans=0;
  cin >> a >> b >> c >> k;
  ans+=min(a,k);
  k=max(0,k-a);
  k=max(0,k-b);
  ans-=min(k,c);
  cout << ans << endl;
}

Measured memory_bytes: 3636
import java.util.Scanner;

public class Main {
	  
	public static void main(String args[]) {
		    Scanner scanner = new Scanner(System.in);
		    
		   int A = scanner.nextInt();
		   int B = scanner.nextInt();
		   int C = scanner.nextInt();
		   
		   if( A <= C && C <= B) 
		   {
			   System.out.println("Yes");
		   }
		   else 
		   {
			   System.out.println("No");
		   }
		    
		    scanner.close(); }
		  }

Measured memory_bytes: 21844
#include <iostream>
#include <numeric>
#include <stdio.h>
#include <iomanip>
#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> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
using ll = long long;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
 

int main(){
  ll N;
 string S;
  
  cin>>N>>S;
 
	for (int i =1; i < S.size(); i++) {
  		if(S.at(i)==S.at(i-1)){
          N--;
        }
	}
  
cout<<N<<endl;
  
}

Measured memory_bytes: 512
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		int[] score = {0, 0};
		for(int i = 0;i < n;i++){
			String[] words = br.readLine().split(" ");
			if(words[0].compareTo(words[1]) > 0){
				score[0] += 3;
			}else if(words[0].compareTo(words[1]) == 0){
				score[0]++;
				score[1]++;
			}else{
				score[1] += 3;
			}
		}
		System.out.printf("%d %d%n", score[0], score[1]);
	}

}

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

int main() {
	string s;
	cin >> s;
	bool isA = false, isB = false;
	for (char c : s) {
		if (c == 'A') isA = true;
		else if (c == 'B') isB = true;
	}
	if (isA && isB) {
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = long long;
const int INF = 1 << 25;
int dy[] = {0, 0, 1, -1};
int dx[] = {1, -1, 0, 0};

int main() {
  int H, W;
  while (cin >> H >> W) {
    vector<string> G(H);
    for (int i = 0; i < H; i++) {
      cin >> G[i];
    }
    int B = 0;
    for (int i = 0; i < H; i++) {
      for (int j = 0; j < W; j++) {
        if (G[i][j] == '#') {
          ++B;
        }
      }
    }
    vector<vector<int>> dist(H, vector<int>(W, INF));
    dist[0][0] = 1;
    queue<pair<int, int>> q;
    q.emplace(0, 0);
    while (!q.empty()) {
      auto p = q.front();
      q.pop();
      int y = p.first, x = p.second;
      for (int i = 0; i < 4; i++) {
        int ny = y + dy[i];
        int nx = x + dx[i];
        if (ny < 0 || ny >= H || nx < 0 || nx >= W || G[ny][nx] == '#' ||
            dist[ny][nx] <= dist[y][x] + 1) {
          continue;
        }
        dist[ny][nx] = dist[y][x] + 1;
        q.emplace(ny, nx);
      }
    }
    int res = dist[H - 1][W - 1] < INF ? H * W - dist[H - 1][W - 1] - B : -1;
    cout << res << endl;
  }
  return 0;
}


Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
x = []
y = []
for i, v in enumerate(sorted(a, reverse=True)):
    if (i + 1) % 2 != 0:
        x.append(v)
    else:
        y.append(v)
print(sum(x) - sum(y))

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define erep(i,a,b) for(int i=a;i<=(int)(b);++i)
#define per(i,a,b) for(int i=(b);i>(a);--i)
#define eper(i,a,b) for(int i=((int)(a));i>=b;--i)
#define pb push_back
#define mp make_pair
#define INF (1<<30)-1
#define MOD 1000000007
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
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; }
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a/gcd(a, b)*b;}

int c[3][3], a[3], b[3];
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
    rep(i, 0, 3) rep(j, 0, 3) cin >> c[i][j];
    a[0] = 0, b[0] = c[0][0] - a[0];
    rep(i, 0, 3) 
        b[i] = c[0][i] - a[0];
    rep(i, 0, 3)
        a[i] = c[i][0] - b[0];
    
    bool flag = true;
    rep(i, 0, 3) {
        rep(j, 0, 3) {
            if (c[i][j] != a[i] + b[j]) flag = false;
        }
    }
    if (flag) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <iomanip>
#include <stack>
#include <queue>
#include <numeric>
#include <map>
#include <unordered_map>
#include <set>
#include <fstream>
#include <chrono>
#include <random>
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define sz(x) ((int)(x).size())
#define pb push_back
#define mod 1000000007
using ll = long long;
using namespace std;

int main(){
  string s; cin >> s;
  int X, Y; cin >> X >> Y;
  int x=0,y=0;
  vector<int> xmove;
  vector<int> ymove;
  int cnt = 0;
  bool tox = true;
  rep(i,sz(s)){
    if(s[i]=='F') x++;
    else break;
  }
  //cout << x << " " << y << endl;
  bool yet = true;
  rep(i,sz(s)){
    if(s[i]=='T'){
      yet = false;
      if(tox) xmove.pb(cnt);
      else ymove.pb(cnt);
      tox = !tox;
      cnt = 0;
    }
    else{
      if(yet) continue;
      cnt++;
    }
  }
  if(s.back()=='F'){
    if(tox) xmove.pb(cnt);
    else ymove.pb(cnt);
  }
  /*
  for(auto a:xmove) cout << a << " ";
  cout << endl;
  for(auto a:ymove) cout << a << " ";
  cout << endl;
  //*/

  //x
  vector<bool> cangox(20000, false);
  cangox[10000+x] = true;
  for(auto p:xmove){
    vector<int> okx;
    rep(i,sz(cangox)){
      if(cangox[i]){
        okx.pb(i+p);
        okx.pb(i-p);
      }
    }
    rep(i,sz(cangox)) cangox[i] = false;
    for(auto ox:okx){
      cangox[ox] = true;
    }
  }
  //y
  vector<bool> cangoy(20000, false);
  cangoy[10000+0] = true;
  for(auto p:ymove){
    vector<int> oky;
    rep(i,sz(cangoy)){
      if(cangoy[i]) {
        oky.pb(i+p);
        oky.pb(i-p);
      }
    }
    rep(i,sz(cangoy)) cangoy[i] = false;
    for(auto oy:oky){
      cangoy[oy] = true;
    }
  }

  if(cangox[X+10000] && cangoy[Y+10000]) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 512
using System;

namespace AtCoderKeyence
{
	class Program
	{
		static void Main(string[] args)
		{
			var height = decimal.Parse(Console.ReadLine());
			var wight = decimal.Parse(Console.ReadLine());
			var number = decimal.Parse(Console.ReadLine());

			var big = height >= wight ? height : wight;

			Console.WriteLine(Math.Ceiling(number / big));
		}
	}
}


Measured memory_bytes: 13268
import sys
sys.setrecursionlimit(10000000)
MOD = 10 ** 9 + 7
INF = 10 ** 15

def main():
    A,B = map(int,input().split())
    if A <= 8 and B <= 8:
        print('Yay!')
    else:
        print(':(')
if __name__ == '__main__':
    main()

Measured memory_bytes: 9160
#include <iostream>
#include <string>
#include <map> //map<string, int> cnt; key とvalue
#include <set>//  set<int> s;
#include <cstdlib>  // abs() for integer
#include <vector>
#define rep(i,n) for(int i = 0 ; i < (n); ++i)
using namespace std;
using ll = long long;
/*
g++ -std=c++11
*/
int main(){
  string S,T;
  cin >> S >> T;
  if(S.size()+1 == T.size()){
    rep(i,S.size()){
      if(S[i]!=T[i]){
        cout << "No";
        return 0;
      }
    }
  }
  cout << "Yes" << endl;
  return 0;
}

Measured memory_bytes: 3164
import sys
readline = sys.stdin.readline
write = sys.stdout.write
def check(N, A, B, S):
    K = min(A, B)
    g = 0
    for s in S:
        g ^= s % (K+1)

    if A == B:
        return g != 0
    if A > B:
        if g != 0:
            return 1
        for s in S:
            if s > B:
                return 1
        return 0

    cnt = 0; m = 1
    r = 0
    for s in S:
        if s > A:
            cnt += 1
            r = s
            g0 = g ^ (s % (K+1))
    if cnt > 1:
        return 0
    if cnt == 0:
        return g != 0
    return g0 <= A and 1 <= r - g0 <= A

def solve():
    N, A, B = map(int, readline().split())
    S = [int(readline()) for i in range(N)]
    if check(N, A, B, S):
        write("Hanako\n")
    else:
        write("Jiro\n")
solve()


Measured memory_bytes: 9664
#include<iostream>
#include<algorithm>
#include<cmath>
#include<string>
#include<array>
#include<vector>
#include<functional>
#include<unordered_map>
#include<map>
#include<numeric>
#include<limits>
#include<utility>
#include<queue>
#include<random>
#include<math.h>
using namespace std;

int main() {
	int num;
	long long power = 1;
	cin >> num;
	for (int i = 1; i <= num; i++)
	{
		power *= i;
		power %= 1000000007;
	}
	cout << power << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<math.h>
#include<iomanip>
#include<vector>
#include<algorithm>
#include<queue>
#include<string>
#include<stdlib.h>
#include<stack>
using namespace std;
#define PI 3.14159265358979
typedef  long long ll;
#define rep(i,n) for(int i=0;i<n;i++)
#include<set>
int main(void)
{
    ll n,p;
    cin>>n>>p;

    vector<pair<ll,ll> > yaku;
    ll k=2;
    ll pnow = p;
    ll now=0;
    while(k*k<p)
    {
        if(pnow%k==0)
        {
            now ++;
            pnow/=k;
        }
        else
        {
            if(now!=0) yaku.push_back(pair<ll,ll> (k,now));
            now = 0;
            k ++;
        }
    }
    if(k!=1) yaku.push_back(pair<ll,ll> (pnow,1));
    ll ans =1;
    for(int i=0;i<yaku.size();i++)
    {
        ll b = yaku[i].second/n;
        ll t=pow(yaku[i].first,b);
        ans *=max(ll(1),t);
    }

    cout<<ans<<endl;
}

Measured memory_bytes: 3568
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define ALL(a) (a).begin(), (a).end()
const ll mod = 1e9 + 7;

int main()
{
    ll k, a, b, now = 1, count = 0;
    cin >> k >> a >> b;
    if (a >= b - 2)
    {
        cout << k + 1 << endl;
    }
    else
    {
        while (now < a)
        {
            count++;
            now++;
        }
        while (k - count >= 2)
        {
            count += 2;
            now = now + b - a;
        }
        if (k - count == 1)
            now++;
        cout << now << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x)  cerr << #x << " = " << (x) << endl;
#define int long long
using namespace std;

template <typename X, typename T>
auto vectors(X x, T a) {
	return vector<T>(x, a);
}

template <typename X, typename Y, typename Z, typename... Zs>
auto vectors(X x, Y y, Z z, Zs... zs) {
	auto cont = vectors(y, z, zs...);
	return vector<decltype(cont)>(x, cont);
}

template<typename T>
ostream& operator << (ostream& os, vector<T>& v){
	rep(i,v.size()){ os << v[i] << (i == v.size() - 1 ? "" : " "); } return os;
}
template<typename T>
istream& operator >> (istream& is, vector<T>& v){
	for(T& x: v){ is >> x; } return is;
}

string make(string a){
	return "." + a + "P" + a + ".";
}

int x;
vector<int> size, p;

void make(){
	size.emplace_back(1);
	p.emplace_back(1);
	rep(i,50){
		size.emplace_back(size.back() * 2 + 3);
		p.emplace_back(p.back() * 2 + 1);
	}
	//cout << size << endl;
	//cout << p << endl;
}

int dfs(int left, int level){
	int right = left + size[level];
	if(right <= x){ // x contain left-right range
		return p[level];
	}else if(left < x and x < right){
		return dfs(left + 1, level - 1) +
			dfs(left + size[level - 1] + 1, 0) +
			dfs(left + size[level - 1] + 2, level - 1);
	}else{
		return 0;
	}
}

signed main(){
	make();

	int n;
	cin >> n >> x;
	cout << dfs(0, n) << endl;
}


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

typedef long long ll;

int N;
ll L;
int cnt = 1;
int T[200010][2];

ll unit(int v,int d)
{
    ll x = L - d + 1;
    if(v == 0 && d != 0)return x & -x;
    return unit(T[v][0],d + 1) ^ unit(T[v][1],d + 1);
}

int main()
{
    scanf("%d%lld",&N,&L);
    for(int i = 0; i < N; i++)
    {
        string s;
        cin >> s;
        int nxt = 0;
        for(int j = 0; j < s.size(); j++)
        {
            int w = s[j] - '0';
            if(T[nxt][w] == 0)T[nxt][w] = cnt++;
            nxt = T[nxt][w];
        }
    }
    if(unit(0,0))printf("Alice\n");
    else printf("Bob\n");
    return 0;
}


Measured memory_bytes: 4252
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstring>
#include <sstream>
#include <cassert>
using namespace std;
static const double EPS = 1e-5;
typedef long long ll;
typedef pair<int,int> PI;
typedef vector<int> vi;
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define mp make_pair
#define pb push_back
#define f first
#define s second

const int B=10;

main(){
  int n;
  cin>>n;
  while(n--){
    vector< vector<int> > ans(B),tans,ban(B);
    rep(i,B){
      ans[i].resize(B);
      ban[i].resize(B);
    }
    rep(i,B)rep(j,B)cin>>ban[i][j];
    int mina=B*B;
    rep(k,1<<B){
      int tmin=0;
      rep(i,B){
        rep(j,B){
          if(!i)ans[i][j]=!!(1<<j&k);
          else{
            int t=ban[i-1][j]+ans[i-1][j];
            if(j)t+=ans[i-1][j-1];
            if(j+1<B)t+=ans[i-1][j+1];
            if(i>1)t+=ans[i-2][j];
            ans[i][j]=t%2;
          }
          tmin+=ans[i][j];
        }
      }
      rep(i,B){
        rep(j,B){
          int t=ans[i][j]+ban[i][j];
          if(j)t+=ans[i][j-1];
          if(i)t+=ans[i-1][j];
          if(j+1<B)t+=ans[i][j+1];
          if(i+1<B)t+=ans[i+1][j];
        }
      }

      int odd=0;
      rep(j,B){
        int t=ban[B-1][j]+ans[B-1][j]+ans[B-2][j];
        if(j)t+=ans[B-1][j-1];
        if(j+1<B)t+=ans[B-1][j+1];
        odd+=t%2;
      }
      if(!odd && tmin<mina){
        mina=tmin;
        tans=ans;
      }
    }
    rep(i,B){
      rep(j,B){
        if(j)cout<<" ";
        cout<<tans[i][j];
      }
      cout<<endl;
    }
  }
}

Measured memory_bytes: 0
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>

int main()
{
	int n;
	int ans = 0;
	std::cin >> n;
	std::vector<int> A(n);
	for (int i = 0; i < n; i++)
	{
		std::cin >> A[i];
	}
	for (int i = 0; i < n; i++)
	{
		if ((i + 1) % 2 != 0 && A[i] % 2 != 0)
			++ans;
	}
	std::cout << ans << '\n';
	return 0;
}

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

#define rep(i, s, n) for(int i = s; i < n; ++i)
#define rrep(i, n) for(int i = n - 1; i > -1; --i)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
using namespace std;
const long long INF = 1000000000;
const int MOD = 1000000007;
typedef long long ll;
typedef pair<int, int> P;

int main() {
    int n;
    cin >> n;
    vector<int> p(n), q(n);
    rep(i, 0, n){cin >> p[i];}
    rep(i, 0, n){cin >> q[i];}
    int cntp, cntq;
    vector<int> nums(n);
    iota(all(nums), 1);
//    rep(i, 0, nums.size()){
//        cout << nums[i] << endl;
//    }
    int pp, qq, cnt;
    do {
        cnt++;
        cntp = 0;
        cntq = 0;
        rep(i, 0, n){
            if(nums[i] == p[i]) cntp++;
            if(nums[i] == q[i]) cntq++;
        }
        if(cntp == n) pp = cnt;
        if(cntq == n) qq = cnt;
    } while (next_permutation(all(nums)));
    cout << abs(pp - qq) << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <bitset>
#include <map>
#include <deque>
#include <vector>
#include <algorithm>
#include <set>
#include <math.h>
#include <cmath>
#include <queue>
#include <stack>
#include <unordered_set>
#include <unordered_map>

using namespace std;
using ll = long long;

#define pb push_back
#define in insert
#define endl '\n'

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

    string s;
    cin >> s;
    if(s == "ABC") {
        cout << "ARC";
    } else {
        cout << "ABC";
    }
}


Measured memory_bytes: 3608
/*
dsflihsd
sdhjdspo
psdkohpk
sdhljish
*/
#include<bits/stdc++.h>
using namespace std;
long long f(int n)
{
	if(n==0) return 2;
	return f(n-1)*2+2;
}
/*
dsflihsd
sdhjdspo
psdkohpk
sdhljish
*/
int main()
{
    ios::sync_with_stdio(false);
    int n;
    cin>>n;
	cout<<f(n)<<endl;
    return 0;
}
/*
dsflihsd
sdhjdspo
psdkohpk
sdhljish
*/

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<string>
#include<map>
#include<tuple>
#include<cmath>


#define MOD 1000000007
#define rep(i,k,N) for(int i=k;i<N;i++)
#define MP make_pair
#define MT make_tuple //tie,make_tuple は別物
#define PB push_back

typedef long long ll;

using namespace std;

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

ll PowMod(ll N,ll P,ll M){
    ll ans = 1;
    while(P >= 1){
        if(P%2)ans = ans * N % M;
        N = N*N %M;
        P /= 2;
    }
    ans %= M;
    return ans;
}

int main(){
    ll N,P;
    string S;
    cin>>N>>P;
    cin >> S;
    map <ll,ll> M;
    ll ans = 0;
    if(P==2){
        rep(i,0,N){
            if(ll(S[N-i-1]-'0')%2 == 0){
                ans += (N-i);
            }
        }
    }
    else if(P==5){
        rep(i,0,N){
            if(ll(S[N-i-1] -'0')%5 == 0){
                ans += (N-i);
            }
        }
    }
    else{
        ll nowmod = ll(S[N-1]-'0') % P;
        M[nowmod]++;
        rep(i,1,N){
            nowmod += PowMod(10,i,P)*(ll(S[N-i-1]-'0'));
            nowmod %= P;
            M[nowmod]++;
        }
        ans += M[0] + M[0]*(M[0]-1)/2;
        rep(i,1,P){
            ans += M[i]*(M[i]-1)/2;
        }
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 1028
#include <bits/stdc++.h>
using namespace std;
int main(){
    char s[3];
    int cnt=0;
    cin >> s;
    for(int i=0;i<3;i++){
        if(s[i]=='1'){
            cnt++;
        }
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNext()) {
            char[] s = sc.next().toCharArray();
            for (int i = 0; i < s.length; i += 2) {
                System.out.print(s[i]);
            }
            System.out.println();
        }
    }
}


Measured memory_bytes: 29692
#include <bits/stdc++.h>
#ifdef DEMETRIO
#define deb(...) fprintf(stderr,__VA_ARGS__)
#define deb1(x) cerr << #x << " = " << x << endl
#else
#define deb(...) 0
#define deb1(x) 0
#endif
#define pb push_back
#define mp make_pair
#define fst first
#define snd second
#define fore(i,a,b) for(int i=a,ThxDem=b;i<ThxDem;++i)
#define SZ(x) ((int)(x).size())
#define mset(a,v) memset(a,v,sizeof(a))
#define mcpy(a,b) memcpy(a,b,sizeof(a))
using namespace std;
typedef long long ll;

double f[3005],f2[3005];
int n;

int main(){
	f[0]=1;
	scanf("%d",&n);
	fore(i,0,n){
		double p;
		scanf("%lf",&p);
		mset(f2,0);
		fore(i,0,3004){
			f2[i]+=(1-p)*f[i];
			f2[i+1]+=p*f[i];
		}
		mcpy(f,f2);
	}
	double r=0;
	fore(j,0,n+1)if(j>n-j)r+=f[j];
	printf("%.12lf\n",r);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <string>
#include <sstream>
#include <algorithm>
#include <random>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>
#include <cassert>
#include <climits>
#include <bitset>
#include <functional>
#include <iomanip>
#include <random>

#define FOR_LT(i, beg, end) for (int i = (int)(beg); i < (int)(end); i++)
#define FOR_LE(i, beg, end) for (int i = (int)(beg); i <= (int)(end); i++)
#define FOR_DW(i, beg, end) for (int i = (int)(beg); (int)(end) <= i; i--)
#define REP(n)              for (int repeat_index = 0; repeat_index < (int)n; repeat_index++)


using namespace std;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout << fixed << setprecision(20);

	int64_t v; cin >> v; v--;

	string s;
	while (v >= 0) {
		s.push_back('a' + (v % 26));
		v /= 26;
		v--;
	}

	string t;
	FOR_LT(i, 0, s.size()) {
		t.push_back(s[s.size() - 1 - i]);
	}
	cout << t << endl;

	return 0;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<vector<int>> a(3,vector<int>(3));
  for(int i=0; i<3; i++){
    for(int j=0; j<3; j++){
      cin >> a[i][j];
    }
  }
  int n; cin >> n;
  vector<int> b(n);
  for(int i=0; i<n; i++){
    cin >> b[i];
  }
  vector<vector<bool>> c(3,vector<bool>(3,false));
  for(int i=0; i<n; i++){
    for(int j=0; j<3; j++){
      for(int k=0; k<3; k++){
        if(b[i] == a[k][j]) c[k][j] = true;
      }
    }
  }
  bool ans = false;
  
    for(int i=0; i<3; i++){
      if(c[i][0] && c[i][1] && c[i][2]){
        ans = true;
        break;
      }
      if(c[0][i] && c[1][i] && c[2][i]){
        ans = true;
        break;
      }
    }
  
  if(!ans){
    if(c[0][0] && c[1][1] && c[2][2]) ans = true;
    if(c[0][2] && c[1][1] && c[2][0]) ans = true;
  }
  if(ans) cout << "Yes" << endl;
  else cout << "No" << endl;
}
    
        

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
using namespace std;

class Data
{
public:
    string str;
    Data* next;
    Data(){
        next = NULL;
    }
};

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

    int n, q;
    cin >> n >> q;
    vector<Data*> v(n+1, NULL);
    for(int i=1; i<=n; ++i){
        string s;
        cin >> s;
        Data **p = &v[i];
        for(unsigned j=0; j<s.size(); j+=1000){
            Data* d = new Data;
            d->str = s.substr(j, 1000);
            *p = d;
            p = &d->next;
        }
    }

    while(--q >= 0){
        int type;
        cin >> type;

        if(type == 1){
            int a, b, c, d;
            cin >> a >> b >> c >> d;

            Data* p1 = v[a];
            Data* p2 = v[c];
            while((int)p1->str.size() < b){
                b -= p1->str.size();
                p1 = p1->next;
            }
            while((int)p2->str.size() < d){
                d -= p2->str.size();
                p2 = p2->next;
            }

            string s = p1->str.substr(0, b-1) + p2->str.substr(d-1);
            string t = p2->str.substr(0, d-1) + p1->str.substr(b-1);
            p1->str = s;
            p2->str = t;

            swap(p1->next, p2->next);
        }
        else{
            int a, b;
            char c;
            cin >> a >> b >> c;

            Data* p = v[a];
            while((int)p->str.size() < b){
                b -= p->str.size();
                p = p->next;
            }
            p->str[b-1] = c;
        }
    }

    for(int i=1; i<=n; ++i){
        for(Data* p=v[i]; p!=NULL; p=p->next)
            cout << p->str;
        cout << endl;
    }

    return 0;
}

Measured memory_bytes: 6388
w = str(input())
data1 = []
for i in range(len(w)):
    data1.append(w[i])
    
data2 = []
for i in range(len(w)):
    if not w[i] in data2:
        data2.append(w[i])

error = 0
for x in data2:
    if data1.count(x) % 2 != 0:
        error += 1
        break

if error == 0:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 9132
#include <stdio.h>
 
int main(void) {
		int n,m,x,y,i,j,count;
		int xn[102];
		int yn[102];
		scanf("%d %d %d %d",&n,&m,&x,&y);
		xn[0]=x;
		yn[0]=y;
		count=0;
		for(i=1;i<(n+1);i++){
			scanf("%d",&xn[i]);
		}
		for(i=1;i<(m+1);i++){
			scanf("%d",&yn[i]);
		}
		for(i=0;i<(n+1);i++){
			for(j=0;j<(m+1);j++){
				if(xn[i]>=yn[j]) count++;
			}
		}
		if(count!=0){
			printf("War");
		}else{
			printf("No War");
		}
	return 0;
}

Measured memory_bytes: 128
# -*- coding:utf-8 -*-

import copy

def bubble_sort(num_list):
    for i in range(len(num_list)):
        for j in range(len(num_list)-1, i , -1):
            if num_list[j][1] < num_list[j-1][1]:
                num_list[j], num_list[j-1] = num_list[j-1], num_list[j]
    return num_list

def selection_sort(num_list):
    for i in range(len(num_list)):
        mini = i
        for j in range(i, len(num_list)):
            if num_list[j][1] < num_list[mini][1]:
                mini = j
        num_list[i], num_list[mini] = num_list[mini], num_list[i]
    return num_list

def is_stable(before_sort, after_sort):
    current_num = 0
    same_number_card = list()
    for num in after_sort:
        if current_num == int(num[1]):
            for same_card in same_number_card:
                if before_sort.index(same_card) > before_sort.index(num):
                    return False
            same_number_card.append(num)
        else:
            current_num = int(num[1])
            same_number_card = [num,]
    return True

def show_list(list):
    i = 0;
    while(i < len(list)-1):
        print(list[i], end=" ")
        i = i + 1
    print(list[i])

def show_stable(flag):
    if flag:
        print('Stable')
    else:
        print('Not stable')

num = int(input())
input_card = [x for i, x in enumerate(input().split()) if i < num]
bubble_sort_card = bubble_sort(copy.deepcopy(input_card))
show_list(bubble_sort_card)
show_stable(is_stable(input_card, bubble_sort_card))
selection_sort_card = selection_sort(copy.deepcopy(input_card))
show_list(selection_sort_card)
show_stable(is_stable(input_card, selection_sort_card))

Measured memory_bytes: 8224
#include "bits/stdc++.h"
#define rep(i, j) for (int i = 0; i < j; i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
using ull = unsigned long long;

int gcd(int x, int y);
int fac(ll n, vector<int> num);

const int INF = 1001001001;

//mint�p�̕ϐ� (10��9��)
const int mod = 1000000007;

struct mint {
    ll x; // typedef long long ll;
    mint(ll x = 0) :x((x% mod + mod) % mod) {}
    mint operator-() const { return mint(-x); }
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod - a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this; }
    mint operator+(const mint a) const { return mint(*this) += a; }
    mint operator-(const mint a) const { return mint(*this) -= a; }
    mint operator*(const mint a) const { return mint(*this) *= a; }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const { return pow(mod - 2); }
    mint& operator/=(const mint a) { return *this *= a.inv(); }
    mint operator/(const mint a) const { return mint(*this) /= a; }
};
istream& operator>>(istream & is, const mint & a) { return is >> a.x; }
ostream& operator<<(ostream & os, const mint & a) { return os << a.x; }

string f(ll n) {
    if (n == 0) return "";
    n--; //1�`26��0�`25�ɂł���悤�ɂ���(����������)
    return f(n / 26) + string(1, 'a' + n % 26);
}

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

    cout << f(n) << endl;
    return 0;
}

/*���C�u�����ő����*/
//���[�O���b�h�̌ݏ��@
int gcd(int x, int y) {
    int num[3];
    num[0] = (x > y) ? x : y;
    num[1] = (x <= y) ? x : y;
    num[2] = num[0] % num[1];

    while (num[2]) {
        num[0] = num[1];
        num[1] = num[2];
        num[2] = num[0] % num[1];
    }

    return num[1];
}

/*�f��������*/
//���색�C�u����
int fac(ll n, vector<int> num) {
    ll kazu = n;
    for (int i = 2; i <= sqrt(n); i++) {
        while (1) {
            if (kazu % i != 0) break;

            kazu /= i;
            num[i]++;
        }
    }
    if (kazu == n && n != 1) return 1;
    int ans = 0;
    if (kazu != 1) ans++;
    for (int i = 2; i <= sqrt(n); i++) {
        for (int j = 1; j <= num[i]; j++) {
            num[i] -= j;
            ans++;
        }
    }
    return ans;
}

Measured memory_bytes: 3716
#include<bits/stdc++.h>
//typedef long long int ll;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
using namespace std;
#define ll long double
ll dp[3005][3005];
ll p[3005];

void solve(int n)
{
	memset(dp, 0.0, sizeof(dp));
	dp[0][0] = 1.0;
	for (int i = 1; i <= n; i++)
	{
		for (int j = 0; j <= i; j++)
		{
			if (j == 0)
				dp[i][j] = dp[i - 1][j]
				           * (1.0 - p[i]);
			else
				dp[i][j] = dp[i - 1][j]
				           * (1.0 - p[i])
				           + dp[i - 1][j - 1] * p[i];
		}
	}

}
int main()
{


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

	long double sum = 0.0;
	for (int i = (n + 1) / 2; i <= n; i++)
	{
		sum += dp[n][i];
	}
	cout << fixed << setprecision(11) << sum << endl;
}

Measured memory_bytes: 141568
#include <iostream>
#include <iomanip>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;
template <class T>
inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}

typedef long long ll;
ll MOD = 1000000007;

// a^p
// 2^3 = 2 * 2^2
// 2^2 = 2 * (2^1)
// 2^1 = 2
ll modpow(ll a, ll p, ll mod) {
  if (p == 0) return 1;

  if (p % 2 == 0) {
    ll half = modpow(a, p / 2, mod) % mod;
    return half * half % mod;
  } else {
    return a * modpow(a, p - 1, mod) % mod;
  }
}

// nCa を求める
ll modCombination(ll n, ll a, ll mod) {
  if (n - a < a) {
    return modCombination(n, n - a, mod);
  }

  ll denominator = 1;  // 分母
  ll numerator = 1;    // 分子

  for (ll i = 0; i < a; i++) {
    denominator *= a - i;
    numerator *= n - i;
    denominator %= mod;
    numerator %= mod;
  }

  return numerator * modpow(denominator, mod - 2, mod) % mod;
}

int main() {
  ll N, M;
  cin >> N >> M;

  vector<ll> P;
  vector<ll> Y;
  map<ll, vector<ll>> cities;
  for (ll i = 0; i < M; i++) {
    ll p, y;
    cin >> p >> y;
    cities[p].push_back(y);
    P.push_back(p);
    Y.push_back(y);
  };
  // vals.erase(unique(vals.begin(), vals.end()), vals.end());
  auto begin = cities.begin();
  auto end = cities.end();

  for (auto it = begin; it != end; it++) {
    auto c = it->second;
    sort(c.begin(), c.end());
    cities[it->first] = c;
  }

  for (ll i = 0; i < M; i++) {
    auto ans = lower_bound(cities[P[i]].begin(), cities[P[i]].end(), Y[i]) - cities[P[i]].begin() + 1;
    cout << setfill('0') << right << setw(6) << P[i] << setfill('0') << right << setw(6) << ans << endl;;
  }

  return 0;
}


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

int main(){
    long long n;cin>>n;
    long long set_val = 2 * (n / 11);
    if (n % 11 == 0){
        cout << set_val << endl;
    } else if (n % 11 <= 6){
        cout << set_val + 1 << endl;
    } else {
        cout << set_val + 2 << endl;
    }
    return 0;
}

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

const int mod = 1e9 + 7;
bool flag[110000];
int n, x, ans;

int main(){
	scanf("%d", &n);
	for (int i = 1; i <= n; ++i){
		scanf("%d", &x);
		if (!flag[x]){ ans++; flag[x] = 1; }
	}
	cout << ((n -ans) & 1 ? ans - 1 : ans) << endl;

}

Measured memory_bytes: 384