akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <stdio.h>
#include <list>
#include <numeric>
#include <stack>
#include <queue>
#include <tuple>
#include <bitset>
#include <map>
#include <math.h>
//　ceil(a/b)   (a + (b - 1))/ b
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
typedef long long ll;
typedef pair<int,int> P;
const int inf=1000000007;
const ll mod=1000000007;
const double PI=3.14159265358979323846;
int dx[] = {1,-1,0,0};
int dy[] = {0,0,1,-1};

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

int cans(bool f){
  if(f) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}



int main(){
  int A,B;
  int ans = 0;
  cin >> A >> B;
  for(int i = 1; i <= 10000; i++){
    if(i*8/100 == A && i/10 == B){
      ans = i;
      break;
    }
    if(i==10000){
      cout << -1 << endl;
      return 0;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
using System;

    class Program
    {
        static void Main(string[] args)
        {
            int h, w;

            while (true)
            {
                string[] num = Console.ReadLine().Split(' ');
                h = int.Parse(num[0]);
                w = int.Parse(num[1]);

                if (h == 0 && w == 0)
                {
                    break;
                }

                for (int i = 0; i < h; i++)
                {
                    for (int j = 0; j < w; j++)
                    {
                        Console.Write("#");
                    }
                    Console.WriteLine("");
                }
                Console.WriteLine("");
            }
        }
    }



Measured memory_bytes: 8908
using System;
using System.Linq;
using System.Collections.Generic;

namespace ConsoleApp2
{


    public class Program
    {

        static long mod = (long)Math.Pow(10, 9) + 7;

        public static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            string[] nString = Console.ReadLine().Split(' ');
            long[] As = new long[N];

            for (int i = 0; i < N; i++)
            {
                As[i] = long.Parse(nString[i]);
            }

            long ans = 0;
            for (int d = 0; d < 60; d++)
            {
                long n0 = 0;
                long n1 = 0;
                for (int i = 0; i < N; i++)
                {
                    long n = As[i]>>d &1;
                    if (n == 0) n0++;
                    if (n == 1) n1++;
                }

                long preAns = (n0 * n1) % mod;
                for (int i = 1; i <= d; i++)
                {
                    preAns *= 2;
                    preAns %= mod;
                }
                ans += preAns;
                ans %= mod;
            }

            Console.WriteLine(ans);
            Console.ReadLine();

        }


        private static int[] Read(string input)
        {
            string[] strings = input.Split(' ');
            int num = strings.Length;
            int[] ints = new int[num];
            for (int i = 0; i < num; i++)
            {
                ints[i] = int.Parse(strings[i]);
            }
            
            return ints;
        }


    }


}


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

using ll = long long;

#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 ddrep(i, n) for (int i = n; i > 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define ssrep(i, s, t) for (int i = s; i <= t; ++i)

#define rng(a) a.begin(), a.end()
#define rrng(a) a.rbegin(), a.rend()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))

using pi = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "{";
  rep(i, (int)v.size()) {
    if (i)
      os << ",";
    os << v[i];
  }
  os << "}";
  return os;
}

template <typename T, size_t S> void printArray(const T (&array)[S]) {
  for (auto val : array)
    std::cout << val << ", ";
  std::cout << "\n";
}

const int mod = 1e9 + 7;
const int inf = 1e9 + 5;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << std::setprecision(10);

  int n, t; std::cin >> n >> t;
  int cur = 0, ans = 0;
  rep(i, n) {
    int ti; std::cin >> ti;
    ans += t;
    if (cur > ti) ans -= cur - ti;
    cur = ti + t;
  }
  std::cout << ans << "\n";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, M;
  cin >> N >> M;

  int s[N] = {0};
  int d[M][N] = {0};
  int p[M];
  int k;
  int ins;
  int count = 0;
  int sum;
  int tmp;
  int flug;
  int max;

  for(int i=0;i<M;i++){
    cin >> k;
    for(int j=0;j<k;j++){
      cin >> ins;
      d[i][ins-1] = 1;
    }
  }

  for(int i=0;i<M;i++){
    cin >> p[i];
  }
  max = pow(2,N);

  for(int i=0;i<max;i++){
    tmp = i;
    flug = 1;
    for(int j=0;j<N;j++){
      s[j] = tmp % 2;
      tmp /= 2;

    }

    for(int j=0;j<M;j++){
      sum = 0;
      for(int k=0;k<N;k++){
        if(d[j][k] == 1){
          sum += s[k];
        }
      }
      if(sum%2 != p[j]) {
        flug = 0;
        break;
      }

    }

    if(flug == 1) count++;
  }

  cout << count << endl;

}


/*
2 2
2 1 2
2 1 2
0 0

*/

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,x,y) for (int i=(x);i<=(y);i++)
#define ll long long
using namespace std;
#define N 4005
#define mod 998244353
int n,k,C[N][N],pw[N],ans;
void init(int n){
	rep (i,0,n) C[i][0]=1;
	rep (i,1,n) rep (j,1,i) C[i][j]=(C[i-1][j]+C[i-1][j-1])%mod;
	pw[0]=1;rep (i,1,n) pw[i]=2ll*pw[i-1]%mod;
}
int cal(int x,int y){return C[x+y-1][x-1];}
int solve(int i,int tot){
	int k2=min(k-i/2,(i-1)/2),k1=k-2*k2-(i%2==0);
	int op=1,res=0;
	for (int j=k2;j>=0;j--,op=-op) res=(res+mod+(ll)op*cal(j+k1,tot)*pw[j]%mod*C[k2][j]%mod)%mod;
	return res;
}
int main(){
	scanf("%d%d",&k,&n);init(4000);
	rep (i,2,2*k){
		if (i&1) ans=solve(i,n);
		else ans=(solve(i,n)+solve(i,n-1))%mod;
		printf("%d\n",ans);
	}
	return 0;
}

Measured memory_bytes: 61440
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0,i##_max=(N);i<i##_max;++i)
#define repp(i,l,r) for(int i=(l),i##_max=(r);i<i##_max;++i)
#define per(i,N) for(int i=(N)-1;i>=0;--i)
#define perr(i,l,r) for(int i=r-1,i##_min(l);i>=i##_min;--i)
#define all(arr) (arr).begin(), (arr).end()
#define SP << " " <<
#define SPF << " "
#define SPEEDUP cin.tie(0);ios::sync_with_stdio(false);
#define MAX_I INT_MAX //1e9
#define MIN_I INT_MIN //-1e9
#define MAX_UI UINT_MAX //1e9
#define MAX_LL LLONG_MAX //1e18
#define MIN_LL LLONG_MIN //-1e18
#define MAX_ULL ULLONG_MAX //1e19
  typedef long long ll;
  typedef pair<int,int> PII;
  typedef pair<char,char> PCC;
  typedef pair<ll,ll> PLL;
  typedef pair<char,int> PCI;
  typedef pair<int,char> PIC;
  typedef pair<ll,int> PLI;
  typedef pair<int,ll> PIL; 
  typedef pair<ll,char> PLC; 
  typedef pair<char,ll> PCL; 

inline void YesNo(bool b){ cout << (b?"Yes" : "No") << endl;}
inline void YESNO(bool b){ cout << (b?"YES" : "NO") << endl;}
inline void Yay(bool b){ cout << (b?"Yay!" : ":(") << endl;}

const int HMAX=10,WMAX=10;
int H,W;
vector<vector<char> > maze(WMAX,vector<char> (HMAX));
vector<vector<bool> > checked(WMAX,vector<bool> (HMAX,false));


bool solve(){
  cin >> H >> W;
  rep(y,H)rep(x,W)cin >> maze[x][y];
  int s = 0;
  rep(y,H){
    rep(x,s) if(maze[x][y]=='#')return false;;
    if(maze[s][y] != '#')return false;;
    int ns = s;
    repp(x,s,W){
      if(x-ns>1 && maze[x][y] == '#') return false;
      if(maze[x][y] == '#' && maze[ns][y] == '#') ns = x;
    }
    s = ns;
  }
  if(s != W-1)return false;
  return true;
}

int main(void){
  SPEEDUP
  cout << setprecision(15);
  cout << (solve()?"Possible":"Impossible") << endl;
  return 0;
}


Measured memory_bytes: 256
import sys
import bisect


while True:
    N, T, L, B = map(int, sys.stdin.readline().split())
    
    if N == 0:
        break
    
    state = [[0 for i in xrange(T + 2)] for j in xrange(N + 1)]
    
    lose = set()
    for i in xrange(L):
        lose.add(int(raw_input()))
    back = set()
    for i in xrange(B):
        back.add(int(raw_input()))
    
    state[0][0] = 1.0
    
    for i in xrange(T):
        for j in xrange(N):
            for k in xrange(1, 7):
                next = j + k
                if next > N:
                    next = N - (next - N)
                if next in lose:
                    state[next][i + 2] += state[j][i] / 6.0
                elif next in back:
                    state[0][i + 1] += state[j][i] / 6.0
                else:
                    state[next][i + 1] += state[j][i] / 6.0
        state[N][i + 1] += state[N][i]
    print '{:6f}'.format(state[N][T])

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

int f[45] = {};

int fib(int n);

int main() {
	int n;
	cin >> n;
	cout << fib(n) << endl;
	return 0;
}

int fib(int n) {
	if (n == 0 || n == 1)return 1;
	else if (f[n] != 0)return f[n];
	else return f[n] = fib(n - 1) + fib(n - 2);
}

Measured memory_bytes: 3084
import sys

sys.setrecursionlimit(10 ** 8)
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N, K = map(int, readline().split())
A = list(map(int, input().split()))
A.sort()
amin, amax = A[0], A[-1]


def solve():
    dp = [None] * (K + 1)
    for i in range(amin):
        dp[i] = False
    for i in range(amin, K + 1):
        winnable = False
        for a in A:
            j = i - a
            if j < 0:
                break
            assert dp[j] is not None
            if not dp[j]:
                dp[i] = True
                winnable = True
                break
        if not winnable:
            dp[i] = False
    return dp[K]


if __name__ == "__main__":
    print("First" if solve() else "Second")


Measured memory_bytes: 41452
X, K, D = map(int, input().split())

if abs(X) - D*K >= 0:
  print(abs(X) - D*K)
else:
  i = abs(X)//D
  if (K - i) % 2 == 0:
    print(abs(X)%D)
  else:
    print(abs(abs(X)%D-D))

Measured memory_bytes: 61804
#pragma target("avx")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef unordered_map<ll, ll> U_MAP;
typedef priority_queue<ll> pq;
typedef priority_queue<ll, vector<ll>, greater<ll>> rpq;
constexpr ll INF = 1e9, MOD = 1e9 + 7, ohara = 1e6 + 10;
constexpr ll LINF = 1e18;

#define rep(i, n) for (ll(i) = 0; (i) < (int)(n); (i)++)
#define rrep(i, a, b) for (ll i = (a); i < (b); i++)
#define rrrep(i, a, b) for (ll i = (a); i >= (b); i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout << (x) << endl
#define doublecout(a) cout << fixed << setprecision(15) << a << endl;
#define fi first
#define se second
#define m_p make_pair
#define p_b push_back
string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string)s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto& x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

//------ Believe yourself as a genius!!!!!! ------

int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
// int dy[]={-1,0,1,-1,1,-1,0,1};int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"), s;
ll n, cnt, ans, a, b, c, d, tmp, m, h, w, x, y, sum, k, q;

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

  cin >> s;
  if (s[Size(s) - 1] == '3')
    Cout("bon");
  else if (s[Size(s) - 1] == '0' || s[Size(s) - 1] == '1' ||
           s[Size(s) - 1] == '6' || s[Size(s) - 1] == '8')
    Cout("pon");
  else
    Cout("hon");
  return 0;
}

Measured memory_bytes: 3592
#include <iostream>
#include <algorithm>
using namespace std;
int n;
int s[102];
int main()
{
    cin >> n; int sum = 0;
    for(int i=1;i<=n;i++) {
        cin >> s[i]; sum += s[i];
    }
    sort(s+1, s+1+n);

    if(sum % 10 == 0) {
        bool fg = 0;
        for(int i=1;i<=n;i++) {
            if((sum - s[i]) % 10) {
                sum -= s[i];
                fg = 1;
                break;
            }
        }
        if(!fg) sum = 0;
    }


    cout << sum << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <numeric>
#include <string>
#include <map>
#include <stack>
using namespace std;
typedef long long int lli;
int main(void)
{
    lli a;
    long double b;
    cin >> a >> b;
    cout << (lli)(a * b) << endl;
    return 0;
}

Measured memory_bytes: 3728
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
#define INF 1145141919810893364
typedef pair<int,int> PP;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
#define int ll
#define setdouble setprecision
#define REP(i,n) for(int i=0;i<(n);++i)
#define OREP(i,n) for(int i=1;i<=(n);++i)
#define RREP(i,n) for(int i=(n)-1;i>=0;--i)
#define GOODBYE cout << -1 << endl;return 0
#define MM <<" "<<
#define Endl endl

signed main(void){
    int N;
    cin >> N;
    if((1ll<<(int)log2(N))==N){
        cout << "No" << endl;
        return 0;
    }
    
    vector<int> G[214514];
    
    G[1].push_back(2);
    G[2].push_back(3);
    G[3].push_back(N+1);
    G[N+1].push_back(N+2);
    G[N+2].push_back(N+3);
    
    for(int i=4;i<=N;i++){
        if(i%2==0)continue;
        
        G[i-1].push_back(i);
        G[i].push_back(1);
        
        G[i-1+N].push_back(i+N);
        G[1+N].push_back(i-1+N);
        
    }
    
    if(N%2==0){
        int n=(1ll<<(int)log2(N));
        
        G[N].push_back(n+1);
        G[2*N-n].push_back(2*N);
    }
    
    cout << "Yes" << endl;
    int e=0;
    REP(i,2*N){
        REP(j,G[i].size()){
            e++;
            cout << i << " " << G[i][j] << endl;
        }
    }
    
    return 0;
}



Measured memory_bytes: 12664
#include <bits/stdc++.h>
#ifdef HIRO
#define d(f_, ...) printf((f_), ##__VA_ARGS__)
#else
#define d(f_, ...)
#endif

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<long long, long long> pllll;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector< pair<int, int> > vii;
typedef vector< pair<long long, long long> > vllll;
typedef map<int, int> mii;
typedef map<long long, long long> mllll;
typedef queue<int> qi;
typedef queue< pair<int, int> > qp;
#define mp make_pair
#define pi 3.14159265358979323846
#define MAX max_element
#define MIN min_element
#define all(v) v.begin(), v.end()
#define gt(T) greater<T>()
#define sum(v) accumulate(v.begin(), v.end(), 0ll)
#define uni(v) do{ \
  sort(v.begin(), v.end()); \
  decltype(v)::iterator result = unique(v.begin(), v.end()); \
  v.erase(result, v.end()); \
}while(0)
#define fi(init, n) for(int i = init; i < n; ++i)
#define fj(init, n) for(int j = init; j < n; ++j)
#define fk(init, n) for(int k = init; k < n; ++k)
#define zero(x) memset(x, 0, sizeof(x))
#define negative(x) memset(x, ~0, sizeof(x))
#define bitsum(x) __builtin_popcount(x)
const ll MOD = 1e9 + 7;
const int INF = 1e9;
const int di[] = { 0, 1, 0, -1 };
const int dj[] = { 1, 0, -1, 0 };

template<typename T>
T gcd(T a, T b) {
	return b ? gcd(b, a % b) : a;
}
template<typename T>
T lcm(T a, T b) {
	return a / gcd(a, b) * b;
}
template<typename T>
int finder(vector<T> vec, T number) {
	auto itr = find(vec.begin(), vec.end(), number);
	size_t index = distance(vec.begin(), itr);
	if (index != vec.size()) return 1;
	else return 0;
}
ll frac(ll n){
	if (n == 0) return 1;
	return (n * frac(n - 1)) % MOD;
}
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 main(int argc, char** argv) {
#ifdef HIRO
  string quiz(argv[1]);
  string id(argv[2]);
  string filename("input/" + quiz + "/" + id + ".txt");
  ifstream fin(filename);
  if (fin.peek() == ifstream::traits_type::eof()) {
    cout << "No input.";
    return 0;
  }
  ifstream cin(filename);
  std::cin.rdbuf(cin.rdbuf());
#endif
  ll ans = 0;
  // ll n;
  // cin >> n;
  ll n, m;
  cin >> n >> m;
  // ll n, m, k;
  // cin >> n >> m >> k;
  if(n<=m)
    printf("unsafe\n");
  else
    printf("safe\n");
  // cout << ans << endl;
  return 0;
}



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

using namespace std;

int main(){
    int X,Y,Z;

    cin >> X >> Y >> Z;

    int A,B,C;
    A = X;
    B=Y;
    C=Z;

    swap(A,B);
    swap(A,C);

    cout << A << " " << B << " " << C << "\n";

}

Measured memory_bytes: 256
#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>
using namespace std;
#define i64  long long
#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

// int DP[MEM_SIZE][MEM_SIZE] = {0};
// int GMEM[MEM_SIZE][MEM_SIZE] = {0};
template<typename T> void DEBUG(T e){std::cout << e << std::endl;}
template<class T> void DEBUG(string str, T e){std::cout <<str << ">>" << e << std::endl;}
template<typename T> void DEBUG(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ DEBUG(v); } }
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); }

void solve(void)
{
  string A,B;
  cin>>A>>B;
  for (int i = 0; i < A.size() + B.size(); i++)
  {
    if(i%2==0)
    {
      cout<<A[i/2];
    }
    else
    {
      cout<<B[i/2];
    }
    
  }
  cout<<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(9);
  solve();

 
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#define N 35
using namespace std;

int n, m, mn =2e9, cnt, b, a[N][N], s[3][N], c[3];
int main()
{
	int i, j, k, w, r;
	cin >> n >> m;
	for (i = 1; i <= m; i++){
		for (j =1; j <= m; j++) {
			scanf ("%d", &a[i][j]);
		}
	}
	for (i = 1; i <= n; i++) {
		for (j = 1; j <= n; j++) {
			scanf ("%d", &b);
			s[(i + j) % 3][b]++;
		}
	}
	for (i = 1; i <= m; i++) {
		c[0] = i;
		for (j = 1;j <= m; j++) {
			c[1] = j;
			if (i == j) continue;
			for (k = 1; k <= m; k++) {
				c[2] = k;
				if (j == k || i == k) continue;
				cnt = 0;
				for (w = 0; w < 3; w++) {
					for (r = 1; r <= m; r++) {
						if (c[w] == r) continue;
						cnt += a[r][c[w]] * s[w][r];
					}
				}
				mn = min(mn, cnt);
			}
		}
	}
	cout << mn;
    return 0;
}


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

#define abs(N) ((N>0)?N:-1*N)
#define min(A,B) ((A>B)?B:A)
#define max(A,B) ((A<B)?B:A)
#define print(S) (cout << S)
#define println(S) (cout << S << endl)

int main() {
	int W,H,x,y,r;

	cin >> W >> H >> x >> y >> r;

	if(x - r < 0 || x + r > W || y - r < 0 || y +r > H){
		println("No");
	}else{
		println("Yes");
	}

	return 0;
}



Measured memory_bytes: 3068
// header file section
#include <iostream>
#include <cstdio>
#include <cfloat>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <functional>
#include <numeric>
#include <algorithm>

using namespace std;
using llong = long long;

// library section
// ===

llong n;
llong ans;

bool check(llong k) {
    if (k == 1) return false;

    llong a = n;

    while (a % k == 0) a /= k;
    
    return a % k == 1;
}

int main() {
    cin >> n;

    llong m = n - 1;
    for (llong i = 2; i * i <= m; i++) {
        if (m % i == 0) {
            if (m / i == i) {
                if (check(i)) ans++;
            }
            else {
                if (check(i)) ans++;
                if (check(m / i)) ans++;
            }
        }
    }

    for (llong i = 2; i * i <= n; i++) {
        if (n % i == 0) {
            if (n / i == i) {
                if (check(i)) ans++;
            }
            else {
                if (check(i)) ans++;
                if (check(n / i)) ans++;
            }
        }
    }

    if (check(m)) ans++;
    if (check(n)) ans++;

    cout << ans << endl;

    return 0;
};



Measured memory_bytes: 256
n = int(input())
a = list(map(int,input().split()))
cnt =0
for i in range(n):
    minj = i
    for j in range(i,n):
        if a[minj]>a[j]:
            minj = j
    if minj != i:
        cnt += 1
    a[minj],a[i] = a[i],a[minj]
print(*a)
print(cnt)


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

int main() {
  int N,i,sum;
  sum=0;
  cin >> N;
  vector<int> length(N);
  for(i=0;i<N;i++){
    cin >> length.at(i);
  }
  sort( length.begin(),length.end() );
  for(i=0;i<N-1;i++){
    sum += length.at(i);
  }
  if(length.at(N-1)<sum){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
  
}


Measured memory_bytes: 256
#include<stdio.h>

int main(){
	double a,b,c,d,e,f;
	double x[200],y[200];
	int cor = 0;
	while(scanf("%lf",&a) != EOF){
		scanf("%lf%lf%lf%lf%lf",&b,&c,&d,&e,&f);
		double det;
		det = a*e-b*d;
		x[cor] = (e*c-b*f)/det;
		y[cor] = (-d*c+a*f)/det;
		cor++;
	}
	for(int i = 0;i < cor;i++){
		if(x[i] <= 0 && x[i] > -0.0005)
			x[i] = 0.0001;
		if(y[i] <= 0 && y[i] > -0.0005)
			y[i] = 0.0001;
		printf("%.3lf %.3lf\n",x[i],y[i]);
	}
	return 0;
}

Measured memory_bytes: 1088
#define _USE_MATH_DEFINES
#include <iostream>
#include <cstdio>
#include <math.h>
using namespace std;

const double Sixty = M_PI*60.0 / 180.0;

struct Point
{
	double x, y;
public:
	Point() { x = y = 0; }
	Point(int x, int y)
	{
		this->x = x;
		this->y = y;
	}
	void print() { printf("%.8f %.8f\n", x, y); }
};

void getPoint_div3(Point &r, Point a, Point b)
{
	r.x = ((a.x * 2.0) + b.x) / 3.0;
	r.y = ((a.y * 2.0) + b.y) / 3.0;
}

void getPoint_top(Point &r, Point a, Point b)
{
	double dx = b.x - a.x;
	double dy = b.y - a.y;

	r.x = cos(Sixty)*dx - sin(Sixty)*dy + a.x;
	r.y = sin(Sixty)*dx + cos(Sixty)*dy + a.y;
}

void koch(int d, Point a, Point b)
{
	if (!d) return;

	Point s, t, u;
	getPoint_div3(s, a, b);
	getPoint_div3(t, b, a);
	getPoint_top(u, s, t);

	koch(d - 1, a, s);
	s.print();
	koch(d - 1, s, u);
	u.print();
	koch(d - 1, u, t);
	t.print();
	koch(d - 1, t, b);
}

int main()
{
	Point p1(0.0, 0.0), p2(100.0, 0.0);
	int n;

	scanf("%d", &n);

	p1.print();
	koch(n, p1, p2);
	p2.print();

	return 0;
}

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

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

const double PI = acos(-1);
const int inf = 2e9;
const ll INF = 2e18;
const ll MOD = 1e9+7;

#define sz(s) (s).size()
#define pb push_back
#define fi first
#define se second
#define REP(i,n) for (int i = 0; i<n; i++)
#define ALL(a) begin(a), end(a)

int main (void) {
    int n,k;
    cin >> n >> k;
    string s;
    cin >> s;
    s[k-1] = char(s[k-1] + 32);
    cout << s << endl;
    return 0;
}

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

void solve(long long N, long long K, long long R, long long S, long long P, std::string T)
{
    long long ans = 0;
    long long flagR, flagS, flagP;
    std::string tmpstr = T;

    for (long long i = 0; i < T.size(); ++i)
    {
        int flagA = true;

        if (K <= i)
        {
            if (T[i] == T[i - K])
            {
                flagA = false;
                T[i] = ' ';
            }
        }
        if (flagA)
        {
            if (T[i] == 'r')
                ans += P;

            else if (T[i] == 's')
                ans += R;

            else if (T[i] == 'p')
                ans += S;
        }
    }

    cout << ans << endl;
}

int main()
{
    long long N;
    scanf("%lld", &N);
    long long K;
    scanf("%lld", &K);
    long long R;
    scanf("%lld", &R);
    long long S;
    scanf("%lld", &S);
    long long P;
    scanf("%lld", &P);
    std::string T;
    std::cin >> T;
    solve(N, K, R, S, P, T);
    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less_equal<int>, rb_tree_tag,tree_order_statistics_node_update>
using namespace std;
#define ll long long
#define pb push_back
#define F first
#define S second
#define all(c)  c.begin(), c.end()
#define llv vector< ll >
#define mp make_pair
#define endl "\n"
const int N = (int)1e5+10 ;
const int M = (int)1000000007;


int main(){
    // #ifndef ONLINE_JUDGE
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    // #endif
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    
    string s , t ;
    cin >> s >> t ;
    ll i , j , n = s.length() , m = t.length() ;
    ll dp[n+1][m+1] ;
    for(i=0 ; i<=n ; i++){
        for(j=0 ; j<=m ; j++){
            if(!i || !j)dp[i][j]=0 ;

            else if(s[i-1]==t[j-1])dp[i][j] = 1 + dp[i-1][j-1] ;
            else dp[i][j] = max(dp[i-1][j] , dp[i][j-1]) ;
        }
    }

    
    string ans ;
    i=n  ; j = m ;
    while(i>0 && j>0){
        if(s[i-1]==t[j-1]){
            ans+=s[i-1] ; 
            i-- ; j-- ; 
        }

        else if(dp[i-1][j]>dp[i][j-1])i-- ;
        else j-- ;
    }
    
    reverse(all(ans)) ;
    cout << ans << endl ;
    
    return 0 ;
}

Measured memory_bytes: 70656
# maspyさんの解答（見た目上の部分一部改変）

import sys
from collections import defaultdict
read = sys.stdin.buffer.read

# 入力値取得
N = int(read())

# Nまでに xで始まってyで終わる数字が何回でるか数え上げる。
counter = defaultdict(int)
for x in map(str, range(1, N + 1)):
    head = x[0]
    tail = x[-1]
    counter[(head, tail)] += 1

answer = 0

# forで回せるようにdefaultdictをlistに変換
items = list(counter.items())

# (X,Y)とその出現回数cntを取りながらループ
for (head, tail), cnt in items:
    # head,tailの出現回数 × headとtailを逆にした出現回数
    answer += cnt * counter[(tail, head)]

print(answer)


Measured memory_bytes: 3316
import java.util.*;
import java.io.*;
public class Main {
	public static void main(String[] args){
	  Scanner sc = new Scanner(System.in);
      String line = sc.nextLine();
      String str[] = line.split(" ");
      int x = Integer.parseInt(str[0]),y = Integer.parseInt(str[2]);;
      String kigo = str[1];
      System.out.println((kigo.equals("+")) ? x+y : x-y);
	}
}

Measured memory_bytes: 21332
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
long long mo = 1e9 + 7;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }

int main(){
    ll H,W,K;
    cin >> H >> W >> K;
    vector<string> s(H);
    vector<vector<ll>> DP(H+1, vector<ll>(W+1,0)), A(H, vector<ll>(W));
    rep(i,H){
        cin >> s[i];
    }
    rep(i,H){
        rep(j,W){
            DP[i+1][j+1] = DP[i][j+1] + DP[i+1][j] - DP[i][j] + ll(s[i][j] == '#');
        }
    }
    /*
    rep(i,H+1){
        rep(j,W+1){
            if(j == W){
                cout << DP[i][j] << endl;
            }else{
                cout << DP[i][j] << " ";
            }
        }
    }*/
    ll cur = K;
    vector<ll> v;
    for(int i=H-1; i>=0;i--){
        if(cur == DP[i][W]){
            v.push_back(i);
            /*rep(j, W){
                A[i][j] = cur;
            }*/
        }else if(cur - 1 == DP[i][W]){
            v.push_back(i);
            rep(j, W){
                for(auto& e:v){
                    A[e][j] = cur;
                }
            }
            v = vector<ll>();
            cur--;
        }else if(cur - 1 > DP[i][W]){
            ll tmp = cur - DP[i][W];
            bool flag = false;
            v.push_back(i);
            rep(j, W){
                if(s[i][j] == '#'){
                    if(!flag){
                        flag = true;
                        for(auto& e:v)A[e][j] = cur;
                        continue;
                    }else{
                        cur--;
                        for(auto& e:v)A[e][j] = cur;
                    }
                }else{
                    for(auto& e:v)A[e][j] = cur;
                }          
            }
            v = vector<ll>();
            cur--;
        }
    }
    for(auto& e:v){
        rep(j,W){
            A[e][j] = A[v[0]+1][j];
        }
    }
    rep(i,H){
        rep(j,W){
            if(j == W-1){
                cout << A[i][j] << endl;
            }else{
                cout << A[i][j] << " ";
            }
        }
    }

}


Measured memory_bytes: 2304
def examD():
    N = I(); A = LI()
    ans = -1; cur = []
    minA = 0; minAlocate = 0
    maxA = 0; maxAlocate = 0
    for i in range(N):
        if minA>A[i]:
            minA = A[i]; minAlocate = i
        if maxA<A[i]:
            maxA = A[i]; maxAlocate = i
    if maxA==minA==0:
        ans = 0
    elif abs(minA)<=abs(maxA):
        flag = True
        for i in range(N):
            if i!=maxAlocate:
                A[i] +=maxA
                cur.append((maxAlocate+1, i+1))
    else:
        flag = False
        for i in range(N):
            if i!=minAlocate:
                A[i] +=minA
                cur.append((minAlocate+1, i+1))
    if ans==-1:
        if flag:
            for i in range(N - 1):
                cur.append((i + 1, i + 2))
        else:
            for i in range(N-2,-1,-1):
                cur.append((i + 2, i + 1))
        print(len(cur))
        for v in cur:
            print(" ".join(map(str, v)))
    else:
        print(ans)


import sys,copy,bisect,itertools,heapq
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

examD()


Measured memory_bytes: 3560
r, c = map(int, input().split())
r_list = []
for i in range(r):
    r_list.append(list(map(int, input().split())))
tmp_list = [0] * (c + 1)
for j in range(r):
    r_list[j].append(sum(r_list[j]))
    for n in range(c + 1):
        tmp_list[n] += r_list[j][n]
r_list.append(tmp_list)
for m in range(r + 1):
    print(" ".join(map(str, r_list[m])))



Measured memory_bytes: 5700
import java.util.*;
public class Main{
    public static void main(String[] args){
	new Main().run();
    }
    Scanner sc = new Scanner(System.in);
    int ans;
    String s;

    void run(){
	while(sc.hasNext()){
	    ans = sc.nextInt();
	    s = sc.next();
	    while(!s.equals("=")){
		calc();
		s = sc.next();
	    }
	    System.out.println(ans);
	}
    }

    void calc(){
	if(s.equals("+"))
	    ans = ans + sc.nextInt();
	else if(s.equals("-"))
	    ans = ans - sc.nextInt();
	else if(s.equals("*"))
	    ans = ans * sc.nextInt();
	else if(s.equals("/"))
	    ans = ans / sc.nextInt();
    }
}
	    

Measured memory_bytes: 19520
#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 long long INF = 1ll << 60;


int main() {
  string s; cin >> s;
  map<char,int> mp;
  rep(i,s.size()){
    char c = s[i];
    mp[c] += 1;
    if (mp[c] >= 2){
      cout << "no" << endl;
      return 0;
    }
  }
  cout << "yes" << endl;

	return 0;
}



Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
typedef long long int lli;
const lli MAX = 1e5 + 9;
vector <lli> graph[MAX];
vector <bool> visited(MAX);
vector <lli> dist(MAX);
vector <lli> inDegree(MAX);
void dfs(int u){
    //cout << u << " ";
    visited[u] = true;
    for(int i =0;i<graph[u].size();i++){
        dist[graph[u][i]] = max(dist[graph[u][i]],dist[u]+1);
        inDegree[graph[u][i]]--;
        if(inDegree[graph[u][i]]==0)dfs(graph[u][i]);
    }
    //cout <<endl;
}
int main(){
    
    lli n,m;
    cin >> n >>m;
    while(m--){
        lli x, y;
        cin >> x >> y;
        graph[x].push_back(y);
        inDegree[y]++;
    }
    for(int i =1;i<=n;i++){
        if(!visited[i]&&inDegree[i]==0)dfs(i);
    }
    lli ans = 0;
    for(int i =1;i<=n;i++)ans = max(ans,dist[i]);
    cout << ans << endl;
}


Measured memory_bytes: 12032
#include<map>
#include<iostream>
#include<deque>
#include<algorithm>
#include<string>
#include<cctype>
#include<iomanip>
#include<vector>
#include<queue>
#include<math.h>
#include<bitset>
#include<random>
 
using namespace std;
#define REP(i,b,e) for(ll i=(ll)b;i<(ll)e;i++)
#define rep0(i,n) REP(i,0ll,n)
#define rep1(i,n) REP(i,1ll,n+1)
 
#define shosu setprecision(17)
 
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<char,P> Q;
//ll longinf=1ll<<60;
int inf=1<<29;
ll longinf=(1ll<<60);

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



int main(){
    ll s;
    cin>>s;
    int ans=inf;
    while(s>=100){
        ans=min(abs(753-(s%1000)),(ll)ans);
        s/=10;
    }
    cout<<ans<<endl;


    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(int i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  string ans;
  string top = "", end = "";
  int q;
  bool r = false;
  cin >> ans >> q;
  rep(i, q) {
    int t;
    cin >> t;
    if(t == 1)
      r = !r;
    else {
      int f;
      char c;
      cin >> f >> c;
      if(r) {
        if(f == 1)
          end += c;
        else
          top += c;
      } else {
        if(f == 1)
          top += c;
        else
          end += c;
      }
    }
  }
  if(r) {
    reverse(ans.begin(), ans.end());
    reverse(end.begin(), end.end());
    cout << end << ans << top << endl;
  } else {
    reverse(top.begin(), top.end());
    cout << top << ans << end << endl;
  }
}

Measured memory_bytes: 1088
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
const ll mod = 998244353;
ll beki[100100];
ll N;
vector<ll> paths[3][100000];
ll Grundy[3][100000];
bool checked[3][100000];
ll M[3];
vector<ll> mex[3][100000];

ll sum[3][500];
ll ans;

void f(int idx, int now) {
    if(checked[idx][now]) return;
    checked[idx][now] = true;
    for(auto to : paths[idx][now]) {
        if(to > now) f(idx, to);
    }
    sort(mex[idx][now].begin(), mex[idx][now].end());
    mex[idx][now].erase(unique(mex[idx][now].begin(), mex[idx][now].end()), mex[idx][now].end());
    mex[idx][now].push_back(1e9);
    for(int i = 0; i < mex[idx][now].size(); i++) {
        if(mex[idx][now][i] != i) {
            Grundy[idx][now] = i;
            break;
        }
    }
    for(auto to : paths[idx][now]) {
        if(to < now) {
            mex[idx][to].push_back(Grundy[idx][now]);
        }
    }
}

int main() {
    beki[0] = 1;
    beki[1] = 1e18;
    beki[1] %= mod;
    for(ll i = 2; i <= 1e5; i++) {
        beki[i] = beki[i-1] * beki[1] % mod;
    }
    cin >> N;
    for(int i = 0; i < 3; i++) {
        cin >> M[i];
        for(int j = 0; j < M[i]; j++) {
            ll a, b;
            cin >> a >> b;
            a--;
            b--;
            paths[i][a].push_back(b);
            paths[i][b].push_back(a);
        }
    }
    for(int t = 0; t < 3; t++) {
        for(int i = 0; i < N; i++) {
            f(t, i);
        }
    }
    /*
    for(int t = 0; t < 3; t++) {
        for(int i = 0; i < N; i++) {
            cerr << t << " " << i << " " << Grundy[t][i] << endl;
        }
    }
    */
    for(int t = 0; t < 3; t++) {
        for(int i = 0; i < N; i++) {
            sum[t][Grundy[t][i]] += beki[i+1];
            sum[t][Grundy[t][i]] %= mod;
        }
    }
    for(int i = 0; i < 500; i++) {
        for(int j = 0; j < 500; j++) {
            for(int k = 0; k < 500; k++) {
                if((i^j^k) != 0) continue;
                ll tmp = sum[0][i] * sum[1][j] % mod;
                tmp = tmp * sum[2][k] % mod;
                ans += tmp;
                ans %= mod;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 38272
// Prime Numbers
#include <iostream>
using namespace std;

bool is_prime(int n) {
  int i;
  for (i = 2; i * i <= n; i++) {
    if (n % i == 0) {
      return false;
    }
  }
  return n != 1;
}

int main(void) {
  int N, num, count = 0;
  cin >> N;
  
  while (N--) {
    cin >> num;
    if (is_prime(num)) {
      count++;
    }
  }

  cout << count << endl;

  return 0;
}

Measured memory_bytes: 1164
#include <algorithm>
#include <cassert>
#include <iomanip>
#include <iostream>
#include <vector>
using namespace std;

namespace IO {
    const int BUFFER_SIZE = 1 << 15;

    char input_buffer[BUFFER_SIZE];
    int input_pos = 0, input_len = 0;

    void _update_input_buffer() {
        input_len = fread(input_buffer, sizeof(char), BUFFER_SIZE, stdin);
        input_pos = 0;

        if (input_len == 0)
            input_buffer[0] = EOF;
    }

    inline char next_char(bool advance = true) {
        if (input_pos >= input_len)
            _update_input_buffer();

        return input_buffer[advance ? input_pos++ : input_pos];
    }

    template<typename T>
    inline void read_int(T &number) {
        bool negative = false;
        number = 0;

        while (!isdigit(next_char(false)))
            if (next_char() == '-')
                negative = true;

        do {
            number = 10 * number + (next_char() - '0');
        } while (isdigit(next_char(false)));

        if (negative)
            number = -number;
    }

    template<typename T, typename... Args>
    inline void read_int(T &number, Args &... args) {
        read_int(number);
        read_int(args...);
    }
}


int N, M;
vector<vector<bool>> adj;
vector<int> out;
vector<double> dp;
vector<double> probability;

double solve_dp() {
    dp.assign(N, 0);

    for (int i = N - 2; i >= 0; i--) {
        double sum = 0;

        for (int j = i + 1; j < N; j++)
            if (adj[i][j])
                sum += dp[j] + 1;

        dp[i] = sum / out[i];
    }

    return dp[0];
}

void solve_probability() {
    probability.assign(N, 0);
    probability[0] = 1;

    for (int i = 0; i < N; i++)
        for (int j = i + 1; j < N; j++)
            if (adj[i][j])
                probability[j] += probability[i] / out[i];
}

int main() {
    cout << fixed << setprecision(12);

    IO::read_int(N, M);
    adj.assign(N, vector<bool>(N, false));
    out.assign(N, 0);

    for (int i = 0; i < M; i++) {
        int s, t;
        IO::read_int(s, t);
        s--; t--;
        adj[s][t] = true;
        out[s]++;
    }

    double base = solve_dp();
    double best = base;
    solve_probability();

    for (int s = 0; s < N; s++) {
        if (out[s] <= 1)
            continue;

        double worst = 0;

        for (int t = s + 1; t < N; t++)
            if (adj[s][t])
                worst = max(worst, dp[t]);

        double save = (worst - (dp[s] - 1)) / (out[s] - 1);
        best = min(best, base - probability[s] * save);
    }

    cout << best << '\n';
}


Measured memory_bytes: 384
#include<iostream>
#include<string>
using namespace std;
int main()
{     string s;
      int n,i;
      cin>>s;
      n=s.length();
        for(i=0;i<n;i++)
           for(int j=0;j<n;j++)
              if(i!=j&&s[i]==s[j]){cout<<"no"<<endl;return 0;}
      cout<<"yes"<<endl;
	  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
const int INF=1145141919,MOD=1e9+7;
const long long LINF=8931145141919364364,LMOD=998244353;
inline long long mod(long long n,long long m){return(n%m+m)%m;}
// const int dx[]={1,0,-1,0,1,1,-1,-1},dy[]={0,-1,0,1,1,-1,-1,1};

int main(){
    vector<pair<int,int>> ans;
    int n; cin>>n;
    if(n%2==0){
        for(int i=1;i<=n;i++){
            for(int j=i+1;j<=n;j++){
                if(i+j!=n+1){
                    ans.push_back({i,j});
                }
            }
        }
    }else{
        for(int i=1;i<=n;i++){
            for(int j=i+1;j<=n;j++){
                if(i+j!=n){
                    ans.push_back({i,j});
                }
            }
        }
    }
    int m=ans.size();
    cout<<m<<endl;
    rep(i,m){
        cout<<ans[i].first<<" "<<ans[i].second<<endl;
    }
    return 0;
}


Measured memory_bytes: 384
#include <vector>
#include <iostream>
#include <cmath>
#include <iomanip>
#include <string>
#include <utility>
#include <stack>
#include <numeric>
#include <random>
#include <algorithm>
#include <queue>
#include <functional>
#include <iterator>
#include <list>
#include <unordered_map>
using namespace std;

#define rep(i, b, e) for(i = b; i < e; ++i)
#define repr(i, b, e) for (i = b; i >= e; --i)
#define ull unsigned long long int
#define ll long long int
#define pint pair<int, int>

#define M_DEBUG 1
#define PI 3.141592653589793

#define E '\n'

#define print(x) cout << (x) << endl;
#define printa(x,n) for(int i = 0; i < n; i++){ cout << (x[i]) << "\n";}
#define INF (1e18)

const ll MAX = 1000000000;
const ll MOD = 1e9 + 7;

ull a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z;

ll aabs(ll a) {
    if (a < 0) return -a;
    return a;
}
vector<ll> facto;

void fact(ll n) {
    ll a = 1;
    for (ll i = 1; i <= n; ++i) {
        a = (a * i) % MOD;
        facto.emplace_back(a);
    }
}

int main(void) {
    cin >> n >> k;
    l = 1;
    while (1) {
        a = pow(k, l);
        if (a > n) {
            cout << l << endl;
            break;
        }
        l++;
    }
    

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<numeric>
#include<algorithm>
#include<vector>
#include<cstring>
#include<string>
using namespace std;
typedef long long ll;
int gcd(int a,int b){
	return b==0?a:gcd(b,a%b);
}
int main(){
	int n;
	cin>>n;
	ll res=0;
	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++){
			for(int k=1;k<=n;k++){
				res+=gcd(gcd(i,j),k);
			}
		}
	}
	cout<<res<<endl;

	return 0;
}

Measured memory_bytes: 3620
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
vector<long long>X, Y, Z;
long long ax[100], ay[100], az[100], bx[100], by[100], bz[100], n, q, r[100][100][100], sum;
int main() {
	cin >> n >> q;
	for (int i = 0; i < n; i++) {
		cin >> ax[i] >> ay[i] >> az[i] >> bx[i] >> by[i] >> bz[i];
		X.push_back(ax[i]); X.push_back(bx[i]);
		Y.push_back(ay[i]); Y.push_back(by[i]);
		Z.push_back(az[i]); Z.push_back(bz[i]);
	}
	sort(X.begin(), X.end()); sort(Y.begin(), Y.end()); sort(Z.begin(), Z.end());
	for (int i = 0; i < n; i++) { for (int j = 0; j < X.size(); j++) { if (ax[i] == X[j])ax[i] = j; if (bx[i] == X[j])bx[i] = j; } }
	for (int i = 0; i < n; i++) { for (int j = 0; j < Y.size(); j++) { if (ay[i] == Y[j])ay[i] = j; if (by[i] == Y[j])by[i] = j; } }
	for (int i = 0; i < n; i++) { for (int j = 0; j < Z.size(); j++) { if (az[i] == Z[j])az[i] = j; if (bz[i] == Z[j])bz[i] = j; } }
	for (int i = 0; i < n; i++) {
		for (int j = ax[i]; j < bx[i]; j++) { for (int k = ay[i]; k < by[i]; k++) { for (int l = az[i]; l < bz[i]; l++)r[j][k][l]++; } }
	}
	for (int i = 0; i < X.size(); i++) {
		for (int j = 0; j < Y.size(); j++) {
			for (int k = 0; k < Z.size(); k++) {
				if (r[i][j][k] >= q) {
					sum += (X[i + 1] - X[i])*(Y[j + 1] - Y[j])*(Z[k + 1] - Z[k]);
				}
			}
		}
	}
	cout << sum << endl;
	return 0;
}

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

/*                    ॐ Shree ॐ                     */
/* ॐ ॐ ॐ
ॐ भूर् भुवः स्वः
तत् सवितुर्वरेण्यं
भर्गो देवस्य धीमहि
धियो यो नः प्रचोदयात्
*/
using namespace std;
typedef long long int ll;
vector<int> ve(3006, 0);
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#else
// online submission
#endif
	int n;
	cin>>n;
	string s;
	cin>>s;
	int ctr=0,ctw=0,mx=INT_MAX,r,w;
	vector<int> v(n,0);
	vector<int> v2(n,0);
	for(int i=0;i<n;i++){
		if(s[i]=='W'){
			ctw++;
		}
		else{
			ctr++;
		}
	}
	int rx=0,ry=0;
	for(int i=0;i<ctr;i++){
		if(s[i]!='R'){
			rx++;
		}
	}
	for(int i=ctr;i<n;i++){
		if(s[i]!='W'){
			ry++;
		}
	}
	cout<<abs(rx-ry)+min(rx,ry);
}

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

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;
}

// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
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 {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=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 {
    mint res(*this);
    return res/=a;
  }
};

mint f(int n){
    if(n == 0) return 1;
    mint x = f(n/2);
    x *= x;
    if(n%2 == 1) x*= 2;
    return x;
}

mint choose(int n, int a){
    mint x = 1, y = 1;
    rep(i, a){
        x *= n - i;
        y *= i + 1;
    }
    return x / y;  
}

int main(){
    int n, a, b; cin >> n >> a >> b;
    mint ans = f(n);
    ans -= 1;
    ans -= choose(n, a);
    ans -= choose(n, b);
    cout << ans.x << endl;
}

Measured memory_bytes: 256