akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(X,N) for(ll X = 0; X < (N); X++)
#define PI (acos(-1.0))
#define pback push_back
#define mpair make_pair
#define divceil(A, B) ((A + (B - 1)) / B)
#define MODN 1000000007
#define ALL(V) (V).begin(),(V).end()
#define CERR if(false) cerr

typedef long long ll;

using namespace std;

int main(){


    int n;
    cin >> n;

    vector<int> a;
    vector<int> b;
    vector<int> c;

    int sum = 0;

    rep(i,n){
        int tmp;
        cin >> tmp;

        a.pback(tmp);
    }

    rep(i,n){
        int tmp;
        cin >> tmp;

        b.pback(tmp);

        sum += tmp;
    }

    rep(i,n - 1){
        int tmp;
        cin >> tmp;

        c.pback(tmp);
    }

    rep(i,n - 1){
        if(a[i + 1] - 1 == a[i]){
            sum += c[a[i] - 1];
        }
    }

    cout << sum << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
const int mod=1e9+7;
using namespace std;

int a[500];
int main()
{
    //freopen("input.txt","r",stdin);
    ios::sync_with_stdio(false);
    string s;cin>>s;
    for(int i=0;i<s.size();i++)
    {
        a[s[i]-'0']++;
    }
    for(int i=0;i<500;i++)
    {
        if(a[i]&1)
        {
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define FASTIO
#define endl "\n"  // Since endl forces a buffer flush which slows down large I/O operations.
#define ff first
#define ss second
#define pb push_back
#define input(c, n) for (int i = 0; i < n; ++i) cin >> c[i];
#define exit_message(s) return 0 * printf(s)
#define show_all(c) for (auto i: c) cout << i << " "; cout << "\n";
#define display(c, a, n) cout << "Displaying array \"" << #c << "\" : \n"; for (int (i) = (a); (i) < (n); ++(i)) cout << (c)[(i)] << " "; cout << "\n";
#define forl(i, a, n) for (int i = (a); (i) < (n); ++(i))
#define dugbe(k) cout << "-\t> " << #k << " = " << k << "\n";

// What follows is a magical ordered set data structure.
// Supports the following functions:
// find_by_order(int k) - returns k'th smallest element (0-indexed)
// order_of_key(int k) - returns number of elements strictly smaller than k.
using namespace __gnu_pbds;
#define ordered_set tree <ll, null_type, greater_equal <ll>, rb_tree_tag, tree_order_statistics_node_update>

/* TIPS FOR DEBUGGING
 * Check if values are not overflowing (use long long where required)
 * Check if ranges are inclusive or not.
 * Check properly if greedy will work or not before using it.
 * Check EDGE CASES!! Seriously, even in 2B, saving 8 points by being
 * 2 minutes faster will bite you in the ass if you don't make sure
 * it works on edge cases.
 * Keep adding to this list.
*/

using namespace std;
typedef long long ll;
typedef pair<int, int> pr;
typedef pair<ll, ll> prll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pr> vpr;
ifstream in("input.txt");
const ll mod = 1e9 + 7;
const long double eps = 1e-7;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

long long true_rand(long long n)
{
	// Returns a random number between 0 and n - 1 inclusive using mt19937.
    uniform_int_distribution<long long> uid(0, n - 1);
    return uid(rng);
}

ll mod_pow(ll a, ll b)
{
	if (b == 0)
		return 1LL;

	ll res = mod_pow(a, b >> 1);
	res = (res * res) % mod;
	if (b & 1LL)
		res = (res * a) % mod;
	
	return res;
}

const int N = 2e5 + 5;
vi g[N], par(N), val(N, 0), vis(N, 0);

void dfs(int x, int par)
{
	vis[x] = 1;
	for (auto e: g[x])
	{
		if (e == par)
			continue;
		val[e] += val[x];
		dfs(e, x);
	}
}

int32_t main()
{
	#ifdef FASTIO
		ios_base::sync_with_stdio(false);
		cin.tie(NULL);
	#endif
	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);

	int n, q;
	cin >> n >> q;

	forl(i, 0, n - 1)
	{
		int a, b;
		cin >> a >> b;
		g[a].pb(b);
		g[b].pb(a);
	}

	forl(i, 0, q)
	{
		int p, x;
		cin >> p >> x;
		val[p] += x;
	}

	forl(i, 1, n + 1)
	{
		if (!vis[i])
			dfs(i, -1);
	}

	forl(i, 1, n + 1)
	{
		cout << val[i] << " ";
	}
	cout << "\n";

	return 0;
}

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

int main(){
  int N;
  cin >> N;
  vector<int> card(N);
  for (int i = 0; i < N; i++){
    cin >> card.at(i);
  }
  for (int i = 0; i < N; i++){
    for (int j = 0; j < N; j++){
      if (card.at(i) > card.at(j)){
        int x;
        x = card.at(i);
        card.at(i) = card.at(j);
        card.at(j) = x;
      }
    }
  }

  
  int point = 0;
  for (int i = 0; i < N; i++){
    if(i % 2 ==0){
      point += card.at(i);
    }
    else {
      point -= card.at(i);
    }
  }
  cout << point << endl ;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		int k = sc.nextInt();
		int []x = new int [n];
		
		for(int i = 0 ; i < n ;i++) {
			x[i] = sc.nextInt();
		}
		
		int ans = 1000000000;
		
		for(int i = 0; i <= n - k ; i++) {
			int a = Math.abs(x[i+k-1] - x[i]) + Math.abs(x[i+k-1]);
			int b = Math.abs(x[i] - x[i+k-1]) + Math.abs(x[i]);
			int temp = Math.min(a, b);
			ans = Math.min(temp, ans);
		}
		System.out.println(ans);
		
	}

	}




Measured memory_bytes: 50708
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
	int K;
	cin >> K;
	vector<bool> visited(K);
	ll x = 0;
	for (int i = 1; ; ++ i) {
		x = (x * 10 + 7) % K;
		if (visited[x]) {
			cout << -1 << endl;
			return 0;
		}
		if (x == 0) {
			cout << i << endl;
			return 0;
		}
		visited[x] = true;
	}
}


Measured memory_bytes: 3668
using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;//for StringBuilder
class c
{
    static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        var a = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
        var ans = 0;
        for (int i = 0; i < n; i++)
        {
            if (a[i] % 2 == 1 && i % 2 == 0) ans++;
        }
        Console.WriteLine(ans);
    }
}

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

const int S=(1<<20)+5;
char buf[S],*H,*T;
inline char Get()
{
	if(H==T) T=(H=buf)+fread(buf,1,S,stdin);
	if(H==T) return -1;return *H++;
}
inline int read()
{
	int x=0;char c=Get();
	while(!isdigit(c)) c=Get();
	while(isdigit(c)) x=x*10+c-'0',c=Get();
	return x;
}

const int N=200010;
struct Type
{
	int l,r;
	friend bool operator < (const Type &a,const Type &b){return a.l<b.l||a.l==b.l&&a.r>b.r;}
} a[N];
int n,m;
int c[N];

int main()
{
	n=read();m=read();
	for(int i=1;i<=n;i++) a[i].l=read(),a[i].r=read();
	sort(a+1,a+1+n);
	int L=0,R=m+1,cnt=0;
	for(int i=1;i<=n;i++)
		if(a[i].l>L&&L<m) L++;
		else c[++cnt]=a[i].r;
	sort(c+1,c+1+cnt);
	for(int i=cnt;i>=1;i--)
	{
		if(R-L==1) break;
		if(c[i]<R) R--;
	}
	printf("%d\n",n-(L+m-R+1));
	return 0;
}

Measured memory_bytes: 3584
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
LL n,k,ans,i,j,l;
int main(){
	cin>>n>>k;
	for(i=k;i<n;i++)
		ans+=(n-i);
	for(i=k+1;i<n;i++){
		j=n/i;
		ans+=((i-k)*(j-1));
		l=n-j*i;
		ans+=max((LL)0,l-k+1);
	}
	if(k==0)cout<<n*n<<endl;
	else cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <set>
using namespace std;
int main() {
  int a, b, c;
  cin >> a >> b >> c;
  int ans = 0;
  vector<int> s(3);
  s[0] = a;
  s[1] = b;
  s[2] = c;
  sort(s.begin(), s.end());
  ans = s[0] + s[1];
  cout << ans << endl;
}

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

int main() {
    int N;
    cin >> N;
    vector<long long> A(N);
    long long sum1 = 0, sum2 = 0;
    for (int i = 0; i < N; i++) {
        cin >> A[i];
        sum1 += A[i];
        if (i % 2 == 1) {
            sum2 += A[i];
        }
    }
    vector<long long> res(N);
    res[0] = sum1 - 2 * sum2;
    for (int i = 1; i < N; i++) {
        res[i] = 2 * A[i - 1] - res[i - 1];
    }

    for (int i = 0; i < N; i++) {
        cout << res[i] << " ";
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 2944
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
//#include<ext/pb_ds/assoc_container.hpp>
//#include<ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
using namespace std;

#define ll long long
#define ull unsigned long long
#define ld long double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vi vector<int>
#define vll vector<ll>
#define vpll vector<pll>
#define vpii vector<pii>
#define pb push_back
#define eb emplace_back
#define mt make_tuple
#define MP make_pair
#define fs first
#define sc second
#define F first
#define S second
#define nl "\n"
#define asche cerr<<"Ekhane asche\n";
#define pf printf
#define sf scanf
#define mem(a,x) memset(a,x,sizeof(a))
#define SZ(v) (int)v.size()
#define all(v) v.begin(),v.end()
#define one(x) __builtin_popcount(x)
#define fout(x) fixed<<setprecision(x)
#define BeatMeScanf ios_base::sync_with_stdio(false)
//int dx[]={1,0,-1,0,1,-1,-1,1};
//int dy[]={0,1,0,-1,1,1,-1,-1};
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define debug(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); deb(_it, args); }
void deb(istream_iterator<string> it) {}
template<typename T, typename... Args>
void deb(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << endl;
    deb(++it, args...);
}
//template <typename T> using o_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
namespace IO
{
    #define in() ( { int a ; scanf("%d",&a); a; } )
    #define LL() ( { ll a ; scanf("%lld",&a); a; } )
    #define ULL() ( { ull a ; scanf("%llu",&a); a; } )
    #define DD() ({ double a; scanf("%lf", &a); a;})
    #define CC() ( { char a ; scanf("%c",&a); a; } )
    #define pf1(a) printf("%d\n",a)
    #define pf1ll(a) printf("%lld\n",a)
}
using namespace IO;

const int mod=1e9+7;
const int N=3e5+9;
const double eps=1e-9;
const double PI=acos(-1.0);
ll qpow(ll n,ll k) {ll ans=1;assert(k>=0);n%=mod;while(k>0){if(k&1) ans=(ans*n)%mod;n=(n*n)%mod;k>>=1;}return ans%mod;}


int32_t main()
{
    ///BeatMeScanf;
    int a=in(),b=in();
    int ans=0,nw=1;
    while(nw<b) nw+=a-1,ans++;
    pf1(ans);
    return 0;
}
///Before submit=>
///    *check for integer overflow,array bounds
///    *check for n=1


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef long double ld;
const ll INF = 1e+14;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second

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

  int N, K; cin >> N >> K;
  ll x[100100]; rep(i, N) {
      cin >> x[i];
  }
  ll ans = INF;

  rep(i, N - K + 1) {
    ll time = min(abs(x[i]) + abs(x[i] - x[i + K - 1]), abs(x[i + K - 1]) + abs(x[i] - x[i + K - 1]));
    ans = min(ans, time);
  }
  cout << ans << "\n";
  
  return 0;
}

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

int main()
{
    int n;
    cin >> n;
    int l[n];
    for(int i=0;i<n;++i){
        cin >> l[i];
    }
    int count=0;
    sort(l,l+n,greater<int>());
    for(int i=0;i<n-2;++i){
        if(l[i]<l[i+1]+l[i+2]){
            for(int j=i+1;j<n-1;++j){
                for(int k=j+1;k<n;++k){
                    if(l[i]<l[j]+l[k] && l[j]<l[k]+l[i] && l[k]<l[j]+l[i])
                        count++;
                }
            }
        }
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 256
str = gets.chomp
opnum = gets.to_i

opnum.times do
    opary = gets.chomp.split
    a, b = opary[1].to_i, opary[2].to_i
    case opary[0]
    when "print"
        puts str[a..b]
    when "reverse"
        str[a..b] = str[a..b].reverse
    when "replace"
        str[a..b] = opary[3]
    end
end

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

using namespace std;

static const int INF = 1e9 + 7;

template<typename T>
using Vec = vector<T>;

template<typename T, typename T2>
using P = pair<T, T2>;

template<typename... Args>
using Tup = tuple<Args...>;

template<typename T>
using qp = priority_queue<T, Vec<T>, greater<T> >;

template<typename T>
using pq = priority_queue<T>;

using llong = long long;
using ullong = unsigned long long;
using uint = unsigned int;

template<typename T>
T gcd(T x, T y)
{
	return y ? gcd(y, x % y) : x;
}

void hawawa()
{
	string str[3];
	for (auto&& i : str) {
		cin >> i;
	}
	int cnt[3] = {};
	int now = 0;
	while (cnt[now] < str[now].size()) {
		int next = str[now][cnt[now]] - 'a';
		cnt[now]++;
		now = next;
	}

	cout << char('A' + now) << "\n";
}

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


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <string>
#include <cmath>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <iostream>
#include <sstream>
#include <climits>
#include <cfloat>

typedef long long ll;

using namespace std;

int main()
{
	char* table = "abcdefghijklmnopqrstuvwxyz.?! ";
	char buf[512];
	while (cin.getline(buf, sizeof(buf)))
	{
		if (strlen(buf) & 1)
		{
			puts("NA");
			continue;
		}

		char decode[256];
		memset(decode, 0, sizeof(decode));
		bool ok = true;
		for (int i = 0; buf[i] != '\0'; i += 2)
		{
			int c = buf[i] - '0' - 1;
			int r = buf[i+1] - '0' - 1;
			if (c < 0 || r < 0 || c > 5 || r > 4)
			{
				ok = false;
				break;
			}

			decode[i/2] = table[c*5 + r];
		}
		if (ok)
			puts(decode);
		else
			puts("NA");
	}

	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <climits>
#include <map>
#include <set>
const int mod = 1e9 + 7;
const int inf = 1 << 20;
const long long INF = 1LL << 60;
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
using namespace std;

int main()
{
    ll a,b,c;
    cin >> a >> b >> c;
    if(a%2==0 || b%2==0 || c%2==0){
        cout << 0 << endl;
    }else{
        cout << min({a*b,b*c,a*c}) << endl;
    }
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
 
import math
import itertools
import sys
import copy
#import numpy as np
from decimal import *
 
# 入力
#A, B, C, D = map(int, input().split())
#L = list(map(int, input().split()))
#S = list(str(input()))
#N = int(input())
#S = str(input())

a, b, c = map(int, input().split())

if (c-a-b)**2 > 4*a*b and (c-a-b) > 0:
  print ("Yes")
else :
  print ("No")









Measured memory_bytes: 5052
#include <algorithm>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;

#define EPS 1e-10
#define INF 1000000000
#define mp make_pair
#define pb push_back

typedef vector<int> vi;
typedef vector<vi> vii;
typedef pair<int,int> pii;
typedef long long ll;

void dropStones(vii &board) {
  for (int w = 0; w < 5; w++) {
    queue<int> que;
    for (int h = board.size() - 1; h > 0; h--){
      if (board[h][w] != 0) {
        que.push(board[h][w]);
        board[h][w] = 0;
      }
    }
    for (int h = board.size() - 1; h > 0; h--){
      if (que.empty()) {
        break;
      }
      board[h][w] = que.front();
      que.pop();
    }
  }
}

int calcPoints(vii &board) {
  int rep = 0;
  for (int h = 1; h < board.size(); h++) {
    int cnt = 1, p = board[h][2];
    vi tmp = board[h];
    tmp[2] = 0;
    if (p == 0) {
      continue;
    }
    for (int w = 3; w < board[0].size(); w++) {
      if (board[h][w] == p) {
        cnt++;
        tmp[w] = 0;
      } else {
        break;
      }
    }
    for (int w = 1; w >= 0; w--) {
      if (board[h][w] == p) {
        cnt++;
        tmp[w] = 0;
      } else {
        break;
      }
    }

    if (cnt >= 3) {
      rep += cnt * p;
      board[h] = tmp;
    }
  }
  if (rep == 0) {
    return 0;
  }
  dropStones(board);
  return rep + calcPoints(board);
}

int main() {
  int H;
  while (1) {
    cin >> H;
    if (H == 0) {
      break;
    }
    vii board(H + 1, vi(5, 0));
    for (int h = 1; h <= H; h++) {
      for (int w = 0; w < 5; w++) {
        cin >> board[h][w];
      }
    }
    cout << calcPoints(board) << endl;
  }
}

Measured memory_bytes: 1220
#include <iostream>
#include <iomanip>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <stack>
#include <queue>
#include <bitset>

#define FOR(i, b, e) for(ll i = (ll)(b); i < (ll)(e); ++i)
#define RFOR(i, b, e) for(ll i = (ll)(e-1); i >= (ll)(b); --i)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, 0, n)
#define REPC(x,c) for(const auto& x:(c))
#define VS vector<string>
#define VL vector<long long>
#define VI vector<int>
#define VVI vector<vector<int>>
#define VVL vector<vector<ll>>
#define ALL(x) (x).begin(),(x).end()
#define SORT(x) sort(ALL(x))
#define RSORT(x) sort((x).rbegin(),(x).rend())
#define PAIR pair<ll,ll>
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

using  ll = long long;
constexpr ll MOD = 1000000007;
//constexpr ll MOD = 998244353;
using std::cout;
using std::endl;
using std::cin;
using std::sort;
using std::pair;
using std::string;
using std::stack;
using std::queue;
using std::vector;
using std::list;
using std::map;
using std::unordered_map;
using std::multimap;
using std::unordered_multimap;
using std::set;
using std::unordered_set;
using std::multiset;


// ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
// ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
// ll pow(ll a, ll b) { ll ans = 1; while (b > 0) { if (b % 2 == 1) { ans *= a; ans %= MOD; }b /= 2; a *= a; a %= MOD; }return ans; }
// ll comb(ll a, ll b) { static constexpr ll size = 1e6; static VL fac(size); static VL finv(size); static VL inv(size); static ll n = 0; if (n > a) { return fac[a] * (finv[b] * finv[a - b] % MOD) % MOD; }fac[0] = fac[1] = 1; finv[0] = finv[1] = 1; inv[1] = 1; FOR(i, 2, a + 1) { inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD; fac[i] = fac[i - 1] * (ll)i%MOD; finv[i] = finv[i - 1] * inv[i] % MOD; }n = a + 1; return comb(a, b); }
// multiset<ll> prime_decomposition(ll n) { ll i = 2; multiset<ll> table{}; while (i * i <= n) { while (n % i == 0) { n /= i;	table.emplace(i); }++i; }if (n > 1) { table.emplace(n); return table; }return table; }
//-- bit -- REP(i, (1 << n)) {REP(j, n) {cout << (1 & (i >> j));}cout << endl;}

//==============================================================================================

int main() {

	ll n, m, k;
	cin >> n >> m >> k;

	ll tmp = n + m;
	cout << m + std::min(tmp + 1, k) << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
    int K,i,j,n,x,a=0;
    cin>>K;
    for(i=1;i<=K;i++)
    {
        for(j=1;j<=K;j++)
        {
            for(n=1;n<=K;n++)
            {
                x=__gcd(i,__gcd(j,n));
                a=a+x;
            }
        }
    }
    cout<<a<<endl;
    return 0;
}


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

const int MAXN = 500005;

int n, q, c[MAXN], li, ri, res[MAXN];
vector < pair <int, int> > qur[MAXN];
vector <int> v[MAXN], add[MAXN];

int tree[MAXN];
void tadd(int u, int val){
	u++;
	while(u < MAXN){
		tree[u] += val;
		u += u & (-u);
	}
}
int sum(int u){
	u++;
	int ret = 0;
	while(u > 0){
		ret += tree[u];
		u -= u & (-u);
	}
	return ret;
}

int main(){
	scanf("%d %d", &n, &q);
	for(int i = 0; i < n; i++){
		scanf("%d", &c[i]);
		v[c[i]].push_back(i);
	}
	
	for(int i = 1; i <= n; i++){
		for(int j = 0; j + 1 < (int)v[i].size(); j++){
			add[v[i][j + 1]].push_back(v[i][j]);
		}
	}
	
	for(int i = 0; i < q; i++){
		scanf("%d %d", &li, &ri);
		li--, ri--;
		
		qur[ri].push_back(make_pair(li, i));
	}
	
	for(int i = 0; i < n; i++){
		for(int j : add[i]){
			tadd(j, 1);
		}
		for(pair <int, int> qi : qur[i]){
			res[qi.second] = i - qi.first + 1 - (sum(i) - sum(qi.first - 1));
		}
	}
	
	for(int i = 0; i < q; i++)
		printf("%d\n", res[i]);
	
	return 0;
}


Measured memory_bytes: 72836
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int lowbit(int x){
    return x&(-x);
}
int main()
{
    int n;
    cin>>n;
    if(lowbit(n)==n) return 0*puts("No");
    puts("Yes");
    printf("1 2\n2 3\n%d %d\n%d %d\n%d %d\n",3,n+1,n+1,n+2,n+2,n+3);
    if(n%2==0){
        printf("%d %d\n",n+lowbit(n),n);
        printf("%d %d\n",n-lowbit(n)+1,n+n);
    }

    for(int i=4;i<n;i+=2){
        printf("%d %d\n",i,i+1);
        printf("%d %d\n",i+n,i+1+n);
        printf("%d %d\n",i+n,n+1);
        printf("%d %d\n",i+1,n+1);
    }

    return 0;
}


Measured memory_bytes: 2816
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <math.h>
#include <list>
#include <stack>
#include <queue>
#include <utility>

using namespace std;

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


int main()
{
    int n,k;
    cin >> n>> k;
    string s;
    cin >> s;
    int counter = 0;
    int edge = 0;

    if (s[0]== 'L')
    {
        counter++;
        edge++;
    }else
    {
        if (s[1] =='L')
        {
            counter++;
        }
        
    }
    
    
    for (int i = 1; i < n-1; i++)
    {
        if (s[i] == 'R')
        {
            if (s[i+1] == 'L')
            {
                counter++;
                i++;
            }
            
        }/*else
        {
            if (s[i+1] == 'L')
            {
                counter++;
            }  
        }*/
    }
    if (s[n-1] == 'R')
    {
        counter++;
        edge++;
    }
    
    

    //cout << counter << endl;
    int sum = 0;

    if (counter-k<=0)
    {
        cout << n-1 << endl;
    }else
    {
        int* temp;
        temp = new int[counter];
        for (int i = 0; i < counter-edge; i++)
        {
            temp[i] = 2;
        }
        for (int i = counter-edge; i < counter; i++)
        {
            temp[i]=1;
        }
        for (int i = 0; i < k; i++)
        {
            temp[i] = 0;
        }
        for (int i = 0; i < counter; i++)
        {
            sum += temp[i];
        }
        
        cout << n-sum << endl;
    }
    
    
    
    
}

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

int main() {
  long long A,B,M;
  cin >> A >> B >> M;
  vector<int> a(A);
  vector<int> b(B);
  for(int i=0;i<A;i++)
    cin >> a.at(i);
  for(int i=0;i<B;i++)
    cin >> b.at(i);
  vector<int> x(M);
  vector<int> y(M);
  vector<int> c(M);
  for(int i=0;i<M;i++)
    cin >> x.at(i) >> y.at(i) >> c.at(i);
  int k=1000000;
  for(int i=0;i<M;i++){
    k=min(k,a.at(x.at(i)-1)+b.at(y.at(i)-1)-c.at(i));
  }
  sort(a.begin(),a.end());
  sort(b.begin(),b.end());
  
  k=min(k,a.at(0)+b.at(0));
          
    cout << k << endl;
}

Measured memory_bytes: 2176
import sys

def solve(a, b):
    # Uncomment the following if you want to check the input.
    # print('a =', a)
    # print('b =', b)
    s=int(a)-1
    r=int(b)-1
    return s*r


def readQuestion():
    ws = sys.stdin.readline().strip().split()
    a = int(ws[0])
    b = int(ws[1])
    return (a, b)

def main():
    print(solve(*readQuestion()))

# Uncomment before submission
main()

Measured memory_bytes: 2940
using System;
using System.Collections.Generic;
using System.Linq;
class Program
{
    static void Main()
    {
        string[] s = Console.ReadLine().Split(' ');
        long a, b, c, k;
        a = long.Parse(s[0]);
        b = long.Parse(s[1]);
        c = long.Parse(s[2]);
        k = long.Parse(s[3]);
        if (k % 2 == 0)
            Console.WriteLine(a - b);
        else
            Console.WriteLine(b - a);
    }
}

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

typedef long long ll;

int main() {
    string s, t;
    cin >> s;
    cin >> t;
    int n = s.size();
    int m = t.size();
    map<char, vector<int>> nxt;
    for (int i = 0; i < n; i++) {
        nxt[s[i]].push_back(i);
    }
    ll ans = 0;
    int i = 0;
    bool fucked = 0;
    while (i < m) {
        int j = -1;
        while (j < n && i < m) {
            ans -= j + 1;
            if (nxt[t[i]].empty()) {
                fucked = 1;
                break;
            } else {
                auto it = upper_bound(nxt[t[i]].begin(), nxt[t[i]].end(), j);
                if (it == nxt[t[i]].end()) {
                    break;
                } else {
                    j = *it;
                    ans += j + 1;
                }
                ++i;
            }
        }
        if (i == m || fucked) {
            break;
        } else {
            ans += n;
        }
    }
    if (fucked) {
        ans = -1;
    }
    cout << ans << endl;
}


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

using namespace std;


int main()
{
	int n,k;
	cin>>n>>k;
	int fru[n];
	for(int i=0;i<n;i++){cin>>fru[i];}
	sort(fru,fru+n);
	int sum=0;
	for(int i=0;i<k;i++)
	{	
		sum+=fru[i];
	}
	cout<<sum<<endl;
	return 0;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mk make_pair
#define ft first
#define sc second
#define ppb pop_back
#define sz size
#define forn(i,a,n) for(i=a;i<n;i++)
#define M 1000000007
#define inf 2e18

int main() {

ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
    
      
 ll n;
 string a,b;
 cin>>n>>a>>b;
 for(ll i=0;i<n;i++)cout<<a[i]<<b[i];
 
return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
#define f first
#define s second

using namespace std;
typedef long long ll;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	string s;
	cin >> s;
	int rr = 0;
	for(auto c : s){
		rr += c-'0';
	}
	cout << (rr % 9 == 0 ? "Yes\n" : "No\n");
	
	return 0;
}

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

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
typedef long double ld;
#define mp make_pair
#define pb push_back
const ll mod = 1000000007;

void sayNo() {
	cout << "No" << endl;
}

void sayYes() {
	cout << "Yes" << endl;
}

int main() {
	 int N;
	 cin >> N;
	 unordered_map<int, int> map;

	 for (int i = 0; i < N; i++) {
		 int a;
		 cin >> a;
		 map[a]++;
	 }

	 ll count = 0;
	 ll A[3] = { -1, -1, -1 };
	 ll num[3];

	 for (auto itr = map.begin(); itr != map.end(); ++itr)
	 {
		 ll key = itr->first;
		 ll val = itr->second;
		 // cout << key << ", " << val << endl;
		 count++;

		 if (count > 3) {
			 sayNo();
			 return 0;
		 }

		 A[count-1] = key;
		 num[count-1] = val;
	 }

	 if (count == 1) {
		 if (A[0] == 0) {
			 sayYes();
		 }
		 else {
			 sayNo();
		 }
		 return 0;
	 }

	 if (count == 2) {
		 if (N % 3 == 0) {
			 if ((A[0] == 0 && num[0] == N / 3) || (A[1] == 0 && num[1] == N / 3)) {
				 sayYes();
				 return 0;
			 }
		 }
		 sayNo();
		 return 0;
	 }

	 ll a01 = A[0] ^ A[1];
	 if (a01 == A[2]) {
		 if (num[0] == num[1] && num[1] == num[2]) {
			 sayYes();
			 return 0;
		 }
	 }
	 sayNo();

	return 0;
}

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

#define FOR(i,n)    for(lli i=0;i<(lli)(n);++i)
#define FORU(i,j,k) for(lli i=(j);i<=(lli)(k);++i)
#define FORD(i,j,k) for(lli i=(j);i>=(lli)(k);--i)

#define pb push_back
#define mt make_tuple

using namespace std;

using lli = long long int;
using pll = pair<lli, lli>;

using vi = vector<lli>;
using vvi = vector<vi>;
using pii = tuple<lli, lli>;
using vii = vector<pii>;
using vvii = vector<vii>;

#define X(a) get<0>(a)
#define Y(a) get<1>(a)
#define Z(a) get<2>(a)

string TYPE(const int*)          { return "%d";   }
string TYPE(const lli*)          { return "%lld"; }
string TYPE(const char*)         { return "%c";   }
string TYPE(const char**)        { return "%s";   }
string TYPE(const unsigned int*) { return "%u";   }

const int MAX_BUF = 100*1000+42;
char buf[MAX_BUF];

void RD() {}
template<typename T, typename... Args> 
void RD(T* v, Args... args)
{
    scanf((" " + TYPE(v)).c_str(), v);
    RD(args...);
}
template<typename... Args> 
void RD(string* v, Args... args)
{
    scanf(" %s", buf);
    (*v) = buf;
    RD(args...);
}

void PR(bool nl = true)
{ if(nl) printf("\n"); }
template<typename T, typename... Args> 
void PR(bool nl, T v, Args... args)
{
    printf((TYPE(&v) + " ").c_str(), v);
    PR(nl, args...);
}
template<typename... Args> 
void PR(bool nl, string& v, Args... args)
{
    printf("%s", v.c_str());
    PR(nl, args...);
}
template<typename... Args> 
void PR(Args... args)
{ PR(true, args...); }

const long long int oo = 1000*1000*1000;

struct Coord {
    int x, y;
    Coord(int x = 0, int y = 0) : x(x), y(y) {}
    Coord operator + (const Coord& droite) const
    { return Coord(x + droite.x, y + droite.y); }
};

struct AB {
    int k; vector<lli> arbre;
    AB(int _k = 20, lli def = 0) { k = _k;
        FOR(i, 1 << k)
            arbre.push_back(i < (1 << (k-1)) ? 0LL : def);
        FORD(i, ((1 << (k-1)) - 1), 1)
            arbre[i] = arbre[i << 1] + arbre[(i << 1) ^ 1];
    }
    void set(int i, lli x) { int feuille = i + (1 << (k-1));
        arbre[feuille] = x;
        iset(feuille >> 1);
    }
    void iset(int noeud) {
        if(noeud) {
            arbre[noeud] = arbre[noeud << 1] + arbre[(noeud << 1)  ^ 1];
            iset(noeud >> 1);
    }   }
    lli sum(int deb, int fin, int noeud = 1, int p = 0, int q = -1) {
        if(q < p) q = 1 << (k-1);
        if(deb <= p && q <= fin) return arbre[noeud];
        if(deb >= q || fin <= p) return 0LL;
        int mil = (p + q) / 2;
        return sum(deb, fin, noeud << 1, p, mil) + sum(deb, fin, (noeud << 1) ^ 1, mil, q);
    }
};

const lli MOD = 1E9+7;

lli x[100*1000+42];
lli v[100*1000+42];
lli r = 1;
lli nb = 0;
lli s;

int main()
{
    int n;
    RD(&n);
    FOR(i, n)
    {
        RD(x+i);
        ++v[i-nb];
        --v[i+1];
        nb += (nb+1) <= (x[i]+1)/2;
    }
    lli s = 0;
    FOR(i, n)
    {
        s += v[i];
        r = (r * s) % MOD;
    }
    PR(r);
    return 0;
}


Measured memory_bytes: 1792
#include<iostream>
using namespace std;
int main()
{
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	if(c<=a)
	{
		if(d<=a)
		cout<<0;
		else if(d>a&&d<=b)
		cout<<d-a;
		else if(d>b)
		cout<<b-a;
	}
	else if(c>a&&c<b)
	{
		if(d<=b&&d>a)
		cout<<d-c;
		else if(d>b)
		cout<<b-c;
	}
	else if(c>=b)
	cout<<0;
	return 0;
}

Measured memory_bytes: 256
#import numpy as np
#import math
#from decimal import *
#from numba import njit

#@njit
def main():
    N = int(input())
    A = list(map(int, input().split()))

    C = [0]*N
    for a in A:
        C[a-1] += 1

    for c in C:
        print(c)

main()


Measured memory_bytes: 32180
// AtCoder165 C

#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <math.h>
#include <assert.h>
#include <string.h>
#include <memory.h>
#include <malloc.h>
#include <stdlib.h>

// qsortで用いる比較用関数．*a<*bならaが先になる．
int compare(const void* a, const void* b) {
    return *(int*)a - *(int*)b;
}

int revcompare(const void* a, const void* b) {
    return *(int*)b- *(int*)a;
}


int main() {
    int i,j;
    int n;
    int m,x;
    int a,left = 0, right = 0;

    scanf("%d %d %d", &n, &m, &x);

    for(i=0;i<m;i++){
        scanf("%d",  &a);
        if(a < x)left++;
        if(a > x)right++;
    }

    if(left < right){
        printf("%d", left);
    }else{
        printf("%d", right);
    }

    return 0;

}

Measured memory_bytes: 128
// clang-format off
#include <bits/stdc++.h>

#define mp make_pair
#define fst first
#define snd second
#define forn(i,n) for (int i = 0; i < int(n); i++)
#define forn1(i,n) for (int i = 1; i <= int(n); i++)
#define popcnt __builtin_popcount
#define ffs __builtin_ffs
#define ctz __builtin_ctz
#define clz __builtin_clz
#define all(a) (a).begin(), (a).end()
 
using namespace std;

using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pli = pair<ll,int>;
using pil = pair<int,ll>;
using pll = pair<ll,ll>;
template <typename T> using vec = vector<T>;
using vi = vec<int>;
using vl = vec<ll>;
template <typename T> using que = queue<T>;
template <typename T> using deq = deque<T>;

template <typename T> T id(T b) {return b;};
template <typename T> void chmax(T &x, T y) {if (x < y) x = y;}
template <typename T> void chmin(T &x, T y) {if (x > y) x = y;}
template <typename S, typename K> bool contains(S &s, K k) { return s.find(k) != s.end(); }
void fastio() { ios_base::sync_with_stdio(false); cin.tie(nullptr); }
constexpr ll TEN(int n) { if (n == 0) return 1LL; else return 10LL*TEN(n-1); }
// clang-format on

int main() {
    fastio();

    int n, m;

    cin >> n >> m;

    cout << n * (n - 1) / 2 + m * (m - 1) / 2 << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
#define ll long long 
using namespace std;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define pii pair<int , int>
#define mpi make_pair
#define F first
#define S second
#define pb push_back
#define fl(i , n) for(int i = 0;i<n;i++)


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

    vector<int> arr(n);
    for(int i = 0 ; i<n;i++)cin>>arr[i];

    int ans =0;
    int curr = 0;

    for(int i =1;i<n;i++)
    {
        if(arr[i] <= arr[i-1])curr++;
        else curr =0;

        ans = max(curr , ans);
    }

    cout<<ans<<endl;



    

	return 0;
}

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

typedef long long ll;

int w[1000001];
int n,k;

bool check(ll p){
    ll cost=0;
    ll cou=0;
    for(int i=0;i<k;i++){
        cost=w[cou];
        while(p-cost>=0){
            cou++;
            if(cou==n){
                return true;
            }
            cost+=w[cou];
        }
    }
    return false;
}

ll solve(){
    ll l=0,r=1000000000LL;
    while(r-l>1){
        ll mid=(r+l)/2;
        if(check(mid)){
            r=mid;
        }else{
            l=mid;
        }
//        cout << r << endl;
    }

    return r;
}

int main(){
    ios::sync_with_stdio(false);
    cin >> n >> k;
    for(int i=0;i<n;i++){
        cin >> w[i];
    }
//    for(int i=0;i<n;i++)cout << w[i] << (i!=n-1?" ":"\n");
    ll ans = solve();
    cout << ans << endl;
}



Measured memory_bytes: 3560
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
ll n, m, ans, cnt;
string s;
int a[100010];
map<int,int> mp;

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

  cin >> n;
  mp[n]++;
  cnt = 1;
  while (1) {
    cnt++;
    if (n & 1) {
      n = 3 * n + 1;
      mp[n]++;
      if (mp[n] == 2) {
        cout << cnt << endl;
        return 0;
      }
    } else {
      n = n / 2;
      mp[n]++;
      if (mp[n] == 2) {
        cout << cnt << endl;
        return 0;
      }
    }
  }

  return 0;
}


Measured memory_bytes: 256
use proconio::{input, fastout};
use proconio::marker::{Chars};
use proconio::marker::Usize1;
use std::cmp::*;

macro_rules! debug {
      ($($a:expr),*) => {
          eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

#[fastout]
fn main() {
    input!{
        x: usize,
        y: usize,
        z: usize,
    }

    let ans = (x-z)/(z+y);
    println!("{}", ans);
}


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

int main(void) {
	int A, B;
	cin >> A >> B;
	int ans = 0;

	for (int i = A; i < B + 1; i++) {
		int tmp = i;
		if (tmp % 10 == (tmp - (tmp % 10000)) / 10000) {
			if (((tmp - tmp % 10) / 10) % 10 == ((tmp - tmp % 1000) / 1000) % 10) {
				ans++;
			}
		}
	}

	cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int maxn=212345;
const int mod=1000000007;
int h,w,a,b,fac[maxn],rev[maxn];
inline int ksm(int x,int n) {
    int ret=1;
    while (n) {
        if (n&1) ret=1ll*ret*x%mod;
        n>>=1;
        x=1ll*x*x%mod;
    }
    return ret;
}
inline int C(int x,int y) {
    if (x<y) return 0;
    return 1ll*fac[x]*rev[y]%mod*rev[x-y]%mod;
}
int main()
{
    fac[0]=rev[0]=1;
    for (int i=1;i<maxn;++i) {
        fac[i]=1ll*fac[i-1]*i%mod;
        rev[i]=ksm(fac[i],mod-2);
    }
    scanf("%d%d%d%d",&h,&w,&a,&b);
    int res=C(h+w-2,w-1);
    int len=h-a+b+1;
    for (int i=1;i<=a;++i) {
        int y=b-i+1,x=len-y;
        if (y<=0) break;
        res=((res-1ll*C(x+y-2,x-1)*C(w-x+h-y,w-y)%mod)%mod+mod)%mod;
    }
    printf("%d\n",res);
    return 0;
}


Measured memory_bytes: 1920
#define __USE_MINGW_ANSI_STDIO 0
#include <bits/stdc++.h>

using namespace std;
using ll = long long;
#define int ll
using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define PB push_back

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const int MOD = 1000000007;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template <typename T> bool IN(T a, T b, T x) { return a<=x&&x<b; }
template<typename T> T ceil(T a, T b) { return a/b + !!(a%b); }
template<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a){
  out<<'('<<a.first<<','<<a.second<<')';
  return out;
}
template<class T>
ostream &operator <<(ostream& out,const vector<T>& a){
  out<<'[';
  REP(i, a.size()) {out<<a[i];if(i!=a.size()-1)out<<',';}
  out<<']';
  return out;
}

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

const int NUM_=1e6+10;
ll fact[NUM_+1]={},factr[NUM_+1]={},inv[NUM_+1]={};

ll combi(ll N_, ll C_, ll mo=MOD) {
  auto binpow = [&](ll x, ll e) -> ll{
    ll a = 1, p = x;
    while(e > 0) {
      if(e%2 == 0) {p = (p*p) % mo; e /= 2;}
      else {a = (a*p) % mo; e--;}
    }
    return a;
  };
  if (fact[0]==0) {
    fact[0] = factr[0] = inv[0] = 1;
    // FOR(i, 1, NUM_+1) fact[i] = fact[i-1] * i % MOD;
    // factr[NUM_] = binpow(fact[NUM_], mo-2);
    // for(int i=NUM_-1; i>=0; --i) factr[i] = factr[i+1] * (i+1) % MOD;
    FOR(i, 1, NUM_) {
      fact[i] = fact[i-1] * i % MOD;
      inv[i] = binpow(i, MOD-2) % MOD;
      factr[i] = factr[i-1] * inv[i] % MOD;
    }
  }
  if(C_<0 || C_>N_) return 0;
  // 前計算 O(max(N,K)) クエリ O(1)
  return factr[C_]*fact[N_]%MOD*factr[N_-C_]%MOD;
  // 前計算 O(max(N,K)log(mod)) クエリ O(K)
  // ll ret = 1;
  // for(;C_>0;N_--,C_--) (ret *= N_%MOD) %= MOD, (ret *= inv[C_]) %= MOD;
  // return ret;
}

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

  int n;
  cin >> n;

  if(n == 2) {
    cout << 1 << endl;
    return 0;
  }
  if(n == 3) {
    cout << 4 << endl;
    return 0;
  }
  if(n == 4) {
    cout << 16 << endl;
    return 0;
  }

  int a = 0, ret = 0;
  REP(i, n) {
    int tmp = combi(i-1, n-i-1) * fact[i] % MOD * fact[n-i-1] % MOD;
    tmp -= a;
    tmp = (tmp%MOD+MOD)%MOD;
    (ret += i*tmp%MOD) %= MOD;
    (a += tmp) %= MOD;
  }
  cout << ret << endl;

  return 0;
}


Measured memory_bytes: 23680
#define _CRT_SECURE_NO_WARNINGS
#define REL

#pragma GCC target ("avx2")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")

#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <deque>
#include <queue>
#include <iomanip>
#include <cstdio>
#include <unordered_map>
#include <unordered_set>
#include <map>
#include <string>
#include <set>
#include <bitset>
#include <cstdint>
#include <cstring>
#include <cassert>
#include <complex>
#include <stack> 
#include <random>

using namespace std;

typedef int64_t i64;
typedef long long LL;
typedef long long ll;
typedef long double LD;
typedef complex <LD> cld;
typedef unsigned int uint;
typedef complex <double> cd;
typedef unsigned long long ULL;

#define endl "\n"
#define dendl "\n\n"
#define mp make_pair
#define mt make_tuple
#define size(v) (int)v.size()
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

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

template <typename T>
T sqr(T a) {
	return a * a;
}

template <typename T>
int sign(T a) {
	if (a == 0)
		return 0;
	return (a > 0 ? 1 : -1);
}

template <typename T>
bool uax(T& a, const T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}

template <typename T>
bool uin(T& a, const T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}

template <typename T1, typename T2>
istream& operator >> (istream& in, pair<T1, T2>& p) {
	in >> p.first >> p.second;
	return in;
}

template <typename T1, typename T2>
ostream& operator << (ostream& out, pair<T1, T2>& p) {
	out << p.first << ' ' << p.second;
	return out;
}

mt19937_64 rnd(0);

const int LOG = 64;
const int N = (int)2e5 + 7;
const int MAXN = (int)3e3 + 7;
const int MOD = (int)998244353;
const int INF = (int)1e9 + 7;
const int CONST = 450;
const LL LINF = (i64)1e17;
const LD PI = 3.1415926535897932384626433832795;
const LD EPS = 1;

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

void solve() {
	string s; cin >> s;
	cout << (s[0] == '7' || s[1] == '7' || s[2] == '7' ? "Yes" : "No");
}

int main() {
	double start = clock();
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	cout << fixed << setprecision(20);
	cerr << fixed << setprecision(20);
#else
	cout << fixed << setprecision(20);
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	rnd.seed(time(0));
#endif

	int t = 1;
	for (int i = 0; i < t; i++) {
		solve();
	}

#ifdef _DEBUG
	cout << endl << "Time is " << (clock() - start) / 1000.0;
#endif
}

Measured memory_bytes: 3680
d = list(input())
a = 0
b = 0
c = 0
for i in range(3):
  if d[i] == "a":
    a = 1
  if d[i] == "b":
    b = 1
  if d[i] == "c":
    c = 1
    
    
if a*b*c == 1:
  print("Yes")
else:
  print("No")


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

int main() {
	string s;
	int g = 0,p = 0,pt = 0;
	cin >> s;
	for(int i = 0;i < s.size();i++){
		if(s[i] == 'g'){
			if(g > p){
				pt++;
				p++;
			}else{
				g++;
			}
		}else{
			if(g > p){
				p++;
			}else{
				pt--;
				g++;
			}
		}
	}
	cout << pt << endl;
	return 0;
}

Measured memory_bytes: 512
#include<cstdio>
#include<iostream>
#include<cstring>
using namespace std;

int main(){
    char num[1001];
    while(1){
        scanf("%s", num);
        int sum = 0;
        if(num[0] == '0') break;
        for(int i = 0; i < strlen(num); i++){
            sum += num[i] - '0';
        }
        cout << sum << endl;
    }
    
    return 0;
}


Measured memory_bytes: 3220
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include <numeric>
#include<map>
 
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<n;i++)
#define all_map(itr,mp) for(auto itr=mp.begin();itr!=mp.end();itr++)
#define ALL(a) (a).begin(),(a).end()

int main(){
    int a, b;
    cin >> a >> b;
    int value;
    if(b == 100)value = a*1000+b;
    else if (b/10 > 0)value = a*100+b;
    else value = a*10+b;

    if(pow(int(sqrt(value)), 2) == value)cout << "Yes";
    else cout << "No";
}

Measured memory_bytes: 256
n,a,b,c=map(int,input().split())
l=[int(input()) for _ in range(n)]
ABC=(a,b,c)

import itertools
kouho=list(itertools.product(range(4), repeat=n))
ans=10**9
for item in kouho:

    if 0 in item and 1 in item and 2 in item:
        cost=0
        abc=[0]*3

        for i,v in enumerate(item):
            if v<3:
                if abc[v]>0:
                    cost+=10
                abc[v]+=l[i]

        for i in range(3):
            cost+=abs(abc[i]-ABC[i])
        #print(item,cost)
        ans=min(ans,cost)

print(ans)


    
    












        


Measured memory_bytes: 53024
package main
 
import (
	"fmt"
)

func main() {
	var a,b,c int
	var o string
	fmt.Scanf("%d %d %d", &a, &b, &c)
	o = "win"
	if a + b + c > 21 {
		o = "bust"
	}
	fmt.Print(o)
}

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

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

int main(){
	ll n , m;
	cin >> n >> m;
	priority_queue<int> q;
	
	rep(i, n){
		int a;
		cin >> a;
		q.push(a);
	}
	
	rep(i, m){
		int a = q.top();
		q.pop();
		q.push(a >> 1);
	}
	
	ll ans = 0;
	while(!q.empty()){
		ans += q.top();
		q.pop();
	}
	
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 892
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

time = 0
answer = 0
i = 0
for i, b in enumerate(B):
    if time + b > K:
        i -= 1
        break
    time += b
    answer += 1

best = answer

for a in A:
    if time + a <= K:
        time += a
        answer += 1
        best = max(best, answer)
    else:
        while time + a > K:
            if i < 0:
                print(best)
                exit(0)
            time -= B[i]
            i -= 1
            answer -= 1
        time += a
        answer += 1
        best = max(best, answer)
print(best)


Measured memory_bytes: 42372
#include <bits/stdc++.h>
#define DUMP(x)  cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define IFOR(i, m, n) for(int i = n - 1; i >= m; i-- )
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define FOREACH(x,a) for(auto& (x) : (a) )
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
const ll INF = LLONG_MAX;
/* テンプレートここまで */

int main() {
  ll N; cin >> N;
  vector<ll> a(N), b(N);
  ll diff = 0;
  ll op = 0;
  REP(i, N){
    cin >> a[i];
  }
  REP(i, N){
    cin >> b[i];
  }
  REP(i, N){
    diff += b[i] - a[i];
    if(b[i] > a[i]){
      op += ((b[i]-a[i]+1)/2);
    }
  }
  if(diff < 0 || op > diff){
    cout << "No" << endl;
  }else{
    cout << "Yes" << endl;
  }
}


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

int main() {
  int A,B;
  cin >> A >> B;
  for(int i=0;i<A+B+1;i++){
    char a;
    cin >> a;
    if((i==A&&a!='-')||(i!=A&&a=='-')){
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
}

Measured memory_bytes: 3628
#include<cmath>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
#define ch() getchar()
#define pc(x) putchar(x)
template<typename T>inline void read(T&x){
	int f;char c;
	for(f=1,c=ch();c<'0'||c>'9';c=ch())if(c=='-')f=-f;
	for(x=0;c<='9'&&c>='0';c=ch())x=x*10+(c&15);x*=f;
}
template<typename T>inline void write(T x){
	static char q[64];int cnt=0;
	if(!x)pc('0');if(x<0)pc('-'),x=-x;
	while(x)q[cnt++]=x%10+'0',x/=10;
	while(cnt--)pc(q[cnt]);
}
const int mod=998244353,maxn=200005;
int mo(const int x){
	return x>=mod?x-mod:x;
}
int dp[maxn],L[15],R[15],sum[maxn];
int main(){
	int n,k;read(n);read(k);
	for(int i=1;i<=k;++i)
		read(L[i]),read(R[i]);
	dp[1]=sum[1]=1;
	for(int i=2;i<=n;++i){
		for(int j=1;j<=k;++j){
			if(i>L[j]){
				int mx=i-L[j],mn=max(1,i-R[j]);
				dp[i]=mo(dp[i]+mo(mod-sum[mn-1]+sum[mx]));
			}
		}
		sum[i]=mo(sum[i-1]+dp[i]);
	}
	write(dp[n]),pc('\n');
	return 0;
}


Measured memory_bytes: 5072