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

#define pb push_back
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n,s) for(int i=(s);i<(n);i++)
#define rrep(i,n) for(int i=(n-1);i>=0;i--)
#define rreps(i,n,s) for(int i=s;i>=n;i--)
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

using ll = long long;
using namespace std;
constexpr long long MAX = 5100000;
constexpr long long INF = 1LL << 60;
constexpr int MOD = 1000000007;
class mint {
  long long x;

 public:
  mint(long long 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;
  }

  friend ostream& operator<<(ostream& os, const mint& m) {
    os << m.x;
    return os;
  }
};
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
int n;
cin>>n;
string s;
cin>>s;
map<char,int>cnt;
rep(i,n){
    cnt[s[i]]++;
}
mint ans=1;
for(auto v:cnt){
    ans*=(v.second+1);
}
cout<<ans-1<<endl;
return 0;
}

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

using namespace std;

#define debug(x) '[' << #x << " is: " << x << "] "
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.precision(10);
	cout << fixed;
	#ifndef ONLINE_JUDGE
//		freopen("input.txt","r",stdin);
	#endif
	string s;
	int x,y;
	cin>>s>>x>>y;
	const int add = 8000;
	x+=add;
	y+=add;
	int n = s.size();
	int at=0;
	while(at < n && s[at] == 'F'){
		at++;
		x--;
	}
	int t=1;
	vector<int> g[2];
	int len = 0;
	for(int i=at+1;i<n;i++){
		if(s[i] == 'T'){
			g[t].push_back(len);
			len = 0;
			t = !t;
		}else len++;
	}
	g[t].push_back(len);
	bool can = 1;
	for(int it=0;it<2;it++){
		vector<vector<int>> dp(2,vector<int>(2*add+10,-1));
		int q = 0;
		dp[0][add] = 1;
		for(int i=0;i<g[it].size();i++){
			for(int j=2*add;j>=0;j--){
				if(dp[q][j] == -1)continue;
				dp[!q][j+g[it][i]] = 1;
				dp[!q][j-g[it][i]] = 1;
			}
			dp[q] = vector<int> (2*add+10,-1);
			q = !q;
		}
		if(it == 0 && dp[q][x] == -1)can = 0;
		if(it == 1 && dp[q][y] == -1)can = 0;
	}
	cout << (can ? "Yes" : "No") << '\n';

}

Measured memory_bytes: 512
N=int(input())
H=list(map(int,input().split()))

ans = 0
counter = 0
for i in range(N-1):
    if H[i+1] - H[i] <= 0:
        counter += 1
    else:
        ans = max(ans,counter)
        counter = 0

print(max(ans,counter))

Measured memory_bytes: 14228
get_ints = lambda: [int(st) for st in input().split()]
H,W=get_ints()
inp=[get_ints() for i in range(H)]

res = []
for i in range(H):
    if not i % 2:
        for j in range(W):
            if inp[i][j] % 2:
                if j + 1 < W:
                    # print(i+1, j+1, i+1, j+2)
                    res.append([i+1, j+1, i+1, j+2])
                    inp[i][j] -= 1
                    inp[i][j+1] += 1
                elif i + 1 < H:
                    res.append([i+1, j+1, i+2, j+1])
                    inp[i][j] -= 1
                    inp[i+1][j] += 1
                # print(inp)
    else:
        for j in reversed(range(W)):
            if inp[i][j] % 2:
                if j - 1 >= 0:
                    res.append([i+1, j+1, i+1, j])
                    inp[i][j] -= 1
                    inp[i][j-1] += 1
                elif i + 1 < H:
                    res.append([i+1, j+1, i+2, j+1])
                    inp[i][j] -= 1
                    inp[i+1][j] += 1
                # print(inp)

print(len(res))
for ar in res:
    print(*ar)


Measured memory_bytes: 30152
#include <bits/stdc++.h>
//#include <atcoder/all>
#define ll long long int
#define MOD 1000000007
#define P pair<ll,ll>
#define INF 1000000000000000000

//using namespace atcoder;
using namespace std;

int main(void){
  ll h, w;
  cin >> h >> w;
  
  for (int i = 0; i < h; i++){
    string s;
    cin >> s;
    
    cout << s << endl << s << endl;
  }

  return 0;
}


Measured memory_bytes: 3600
// :)
// "Khodaya, be man "Tagwaye setiz" biamooz ta
//  dar anbuh masuliat nalaghzam ..." -Shariati
#include <bits/stdc++.h>

using namespace std;
typedef long long int64;
typedef pair<int,int> pii;
typedef pair<int64,int> pii32;
typedef pair<int64,int64> pii64;

#define PB push_back
#define MP make_pair
#define F first
#define S second
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()

const int maxn = 1e3+10;
const int64 MO = 1e9+7;
const int64 IN = 1e9;

vector <int> g[maxn], v;
int cnt[2], col[maxn];
bool A[maxn][maxn], vis[maxn];
bool dp[maxn];
int n, m;

bool dfs (int v) {
	bool res = 0;
	vis[v] = 1;
	cnt[col[v]]++;
	for (auto u : g[v]) {
		if (vis[u] && col[u] == col[v])
			return true;
		if (!vis[u]) {
			col[u] = 1 - col[v];
			res |= dfs(u);
		}
	}
	return res;
}

int main () {
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	cin >> n >> m;
	for (int i = 0; i < m; i++) {
		int v, u;
		cin >> v >> u;
		--v; --u;
		A[v][u] = A[u][v] = 1;
	}
	for (int i = 0; i < n; i++)
		for (int t = i + 1; t < n; t++)
			if (!A[i][t]) {
				g[i].PB( t );
				g[t].PB( i );
			}
	float sum = 0;
	for (int i = 0; i < n; i++)
		if (!vis[i]) {
			cnt[0] = cnt[1] = 0;
			if (dfs(i))
				return cout << "-1\n", 0;
			sum += abs(cnt[0] - cnt[1]);
			v.PB( abs(cnt[0] - cnt[1]) );
		}
	dp[0] = 1;
	for (auto x : v)
		for (int i = maxn - x - 1; i >= 0; i--)
			dp[i + x] |= dp[i];
	int ans = 0;
	for (int i = 1; i < n; i++) {
		if (!dp[i])
			continue;
		if (abs(ans - sum / 2) >= abs(i - sum / 2))
			ans = i;
	}
	ans = (n - abs(2 * ans - sum)) / 2;
	cout << (ans * (ans - 1) / 2) + ((n - ans) * (n - ans - 1) / 2) << "\n";
}






Measured memory_bytes: 3200
function main(){
	while(1){
		var n = scan();
		if(n == 0){
			break;
		}
		var k = scan();
		var a = [];
		rep(n, function(i){
			a[i] = scan();
		});
		var s = 0;
		rep(k, function(i){
			s += a[i];
		});
		var t = s;
		rep(n - k, function(i){
			s -= a[i];
			s += a[k + i];
			t = Math.max(s, t);
		});
		print(t);
	}
}
 
function rep(a, b, c){
	if(c == null){
		c = b;
		b = a;
		a = 0;
	}
	for(var i = a; i < b; ++i){
		if(c(i) === false){
			break;
		}
	}
}
 
process.stdin.resume();
process.stdin.setEncoding('utf8');
 
var input = '';
var input_index = 0;
 
function scan(type){
	if(type === 'string'){
		return input[input_index++];
	}
	else{
		return +input[input_index++];
	}
}
 
function print(val){
	console.log(val);
}
 
process.stdin.on('data', function(chunk){
	input += chunk;
});
process.stdin.on('end', function(){
	input = input.split(/\s+/);
	main();
});

Measured memory_bytes: 28808
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define all(x) x.begin(),x.end()
#define rep(i,j,n) for (int i = j; i < (int)(n); i++)
#define _GLIBCXX_DEBUG
#define MOD 1000000007
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; }
//name[i][j]-> vvl name(i,vl(j))
//map<int,int>mp
//余りを切り上げる =>  (a + b - 1) / b 

signed main(){
	int n; cin>>n;
	set<int> s;
	rep(i,0,n){
		int a; cin>>a;
		s.insert(a);
	}
	cout<<s.size();
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <vector>
#include <numeric>
#include <algorithm>
#include <cmath>
#include <string>
#include <map>
#include <iomanip>
#include <cstdlib>
#include <climits>
#include <set>
using namespace std;

//関数getinputdata宣言
vector<vector<string>> getinputdata();
vector<vector<int>> getinputdata2();
vector<vector<double>> getinputdata3();

void m_solutions2019_a(vector<vector<string>> v) {

    string s = v[0][0];

    int n = s.size();

    int lcnt = 0;
    int wcnt = 0;
    for (int i = 0; i < n; i++) {

        if (s.substr(i, 1) == "x") {
            lcnt += 1;
        } else {
            wcnt += 1;
        }
    }

    if (wcnt + (15 - wcnt - lcnt) >= 8) {
        cout << "YES";

    } else {
        cout << "NO";

    }

    cout << endl;



}

int main() {

    vector<vector < string>> vec_arr_result;
    //    vector<vector<int>> vec_arr_result;
    vec_arr_result = getinputdata();

    m_solutions2019_a(vec_arr_result);

    return 0;
}

//関数getinputdata実装

vector<vector<double>> getinputdata3() {

    string str;
    string ret;
    stringstream ss;
    vector<string> v1;
    vector<vector<double>> vec_arr;

    //標準入力から入力がある間ループ処理でvector配列にデータ格納
    while (getline(cin, str)) {

        v1.push_back(str);

    }

    //stringstreamを利用してvector配列v1をスペースで分解処理
    for (string s : v1) {

        vector<double> array_data;
        ss << s;

        while (!ss.eof()) {

            ss >> ret;

            array_data.push_back(atof(ret.c_str()));
        }

        //vector配列に追加
        vec_arr.push_back(array_data);

        //バッファクリア
        ss.str("");
        //ストリームクリア
        ss.clear(stringstream::goodbit);

    }

    return vec_arr;
}

//関数getinputdata実装

vector<vector<int>> getinputdata2() {

    string str;
    string ret;
    stringstream ss;
    vector<string> v1;
    vector<vector<int>> vec_arr;

    //標準入力から入力がある間ループ処理でvector配列にデータ格納
    while (getline(cin, str)) {

        v1.push_back(str);

    }

    //stringstreamを利用してvector配列v1をスペースで分解処理
    for (string s : v1) {

        vector<int> array_data;
        ss << s;

        while (!ss.eof()) {

            ss >> ret;

            array_data.push_back(atoi(ret.c_str()));
        }

        //vector配列に追加
        vec_arr.push_back(array_data);

        //バッファクリア
        ss.str("");
        //ストリームクリア
        ss.clear(stringstream::goodbit);

    }

    return vec_arr;


}

//関数getinputdata実装

vector<vector < string >> getinputdata() {

    string str;
    string ret;
    stringstream ss;
    vector<string> v1;
    vector<vector < string>> vec_arr;

    //標準入力から入力がある間ループ処理でvector配列にデータ格納
    while (getline(cin, str)) {

        v1.push_back(str);

    }

    //stringstreamを利用してvector配列v1をスペースで分解処理
    for (string s : v1) {

        vector<string> array_data;
        ss << s;

        while (!ss.eof()) {

            ss >> ret;

            array_data.push_back(ret);
        }

        //vector配列に追加
        vec_arr.push_back(array_data);

        //バッファクリア
        ss.str("");
        //ストリームクリア
        ss.clear(stringstream::goodbit);

    }

    return vec_arr;

}


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

int main(){
  int k=0;
  string s,t;
  cin >> s >> t;
  for(int i=0;i<s.size();i++){
    if(s.at(i) != t.at(i)){
      k = -1;
      break;
    }
  }
  
  if(k == -1) cout << "No" << endl;
  else cout << "Yes" << endl;
  
  return 0;
}

Measured memory_bytes: 3536
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <unordered_map>
using namespace std;

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)

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; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }


int N;
long long a[110];

long long solve() {
    long long res = 0;
    while (true) {
        sort(a, a + N, greater<long long>());
        if (a[0] < N) break;
        long long tmp = a[0] / N;
        res += tmp;
        a[0] -= tmp * N;
        for (int i = 1; i < N; ++i) a[i] += tmp;
    }
    return res;
}

int main() {
    while (cin >> N) {
        for (int i = 0; i < N; ++i) {
            cin >> a[i];
        }
        cout << solve() << endl;
    }
}






Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace mondai0032
{
	class Program
	{
		static void Main(string[] args)
		{
			int	rect	= 0;
			int	dia		= 0;
			while( true ) {
				var	s	= Console.ReadLine();
				if( s == null ) {
					break;
				}
				var	n	= Array.ConvertAll( s.Split( ',' ), ss => long.Parse( ss ) ); 
				if( n[ 0 ] * n[ 0 ] + n[ 1 ] * n[ 1 ] == n[ 2 ] * n[ 2 ] ) {
					rect++;
				} else {
					if( n[ 0 ] == n[ 1 ] ) {
						dia++;
					}
				}
			}
			Console.WriteLine( rect );
			Console.WriteLine( dia );
		}
	}
}

Measured memory_bytes: 5612
#include <stdio.h>
#include <iostream>
#include <iomanip>
#include <vector>
#include <cstdlib>
#include <cmath>
#include <numeric>
#include <algorithm>
#include <sstream>
#include <string>
#include <map>
#include <set>
using namespace std;

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


int main() {
	int N, D, X;
	cin >> N >> D >> X;
	int A[110];
	rep(i, N) cin >> A[i];

	int sum = 0;
	rep(i, N) {
		int num = 0;
		rep(j, D) {
			int d = j*A[i] + 1;
			if (d<=D) num++;
		}
		sum += num;
	}
	cout << sum + X << endl;
}

Measured memory_bytes: 256
<?php

fscanf(STDIN, '%d%d', $x, $y);

$group_a = [1,3,5,7,8,10,12];
$group_b = [4,6,9,11];

if(((in_array($x, $group_a))&&(in_array($y, $group_a)))||((in_array($x, $group_b))&&(in_array($y, $group_b)))){
    echo 'Yes';
}else{
    echo 'No';
}


Measured memory_bytes: 4728
#include <algorithm>
#include <iostream>
#include <string>

int main(int argc, char *argv[])
{
  int a, b;
  std::cin >> a >> b;
  int count = 0;

  for (int i = a; i <= b; ++i) {
    std::string str = std::to_string(i);
    std::string reversed = str;
    std::reverse(reversed.begin(), reversed.end());
    if (str == reversed) {
      count++;
    }
  }
  std::cout << count << std::endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define rep(i,n) for(int i=0;i<n;i++)
#define print(a) cout<<a[i];
#define fast ios_base::sync_with_stdio(false),cin.tie(nullptr)
#define pi 3.14159265358979323846264338327950LD
#define modd 1000000007
int main()
{
        fast;
        int t=1;
       // cin>>t;
        while(t--)
        {
               int  n,m;
               ll k;
               cin>>n>>m>>k;
               ll a[n+1]={0},b[m+1]={0};
               rep(i,n){
                       ll x;
                        cin>>x;
                        a[i+1]=a[i]+x;
               }
               rep(i,m){
                        ll x;
                        cin>>x;
                        b[i+1]=b[i]+x;
               }

               int maxi=0;
               for(int i=0;i<=n;i++)
               {
                       if(a[i]>k)
                                break;
                   
                       while((a[i]+b[m])>k  &&  m>0)
                       {

                               --m;
                       }
                      
                                maxi=max(maxi,i+m);
                       
               }
               cout<<maxi<<endl;


        }
}
/*
3 4 240
60 90 120
80 150 80 150


3 4 730
60 90 120
80 150 80 150

*/


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

#define all(x) begin(x), end(x)

using i64 = int_fast64_t;
using u64 = uint_fast64_t;
using f64 = double;
using p64 = pair<i64, i64>;

constexpr i64 INF = INT_FAST64_MAX / 2;

void solve() {
    i64 k;
    cin >> k;

    vector<i64> used(k);
    i64 ans = 1;
    i64 sum = 7 % k;
    while (sum) {
        if (used[sum]) {
            cout << -1 << endl;
            return;
        }
        used[sum] = 1;
        sum = (sum * 10 + 7) % k;
        ans++;
    }
    cout << ans << endl;
}

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


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

#define REP(i, s, n) for(int i = s; i < n; ++i)
#define rep(i, n)		 REP(i, 0, n)
#define SORT(c)			 sort((c).begin(), (c).end())
#define IINF					INT_MAX
#define LLINF					LLONG_MAX
#define DEBUG					false

int main(){
    vector<int> mountain(10);
    rep(i,10){
        cin>>mountain[i];
    }
    sort(mountain.begin(),mountain.end());
    for(int i=9;i>=7;i--){
        cout<<mountain[i]<<endl;
    }       
}

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

int main() {

    cin.tie(0);
    ios_base::sync_with_stdio(false);

    int 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/2);}
    long long ans = 0;
    rep(i,n) {ans += q.top(); q.pop();}
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3780
n=int(input())
a=sorted([list(map(int,input().split())) for i in range(n)])
b=sorted([list(map(int,input().split())) for i in range(n)])
ans=0
for i in range(n):
    flag=0
    res=float("inf")
    for j in range(len(a)): #一番もっともなのを探す
        if b[i][0]>a[j][0]:
            if 0<b[i][1]-a[j][1]<res:
                res=b[i][1]-a[j][1]
                ind=j
                flag=1
    if flag:
        a.pop(ind)
        ans+=1
print(ans)


Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A, B, C, X, Y;
  cin >> A >> B >> C >> X >> Y;
  if(A+B>=2*C) {
    if(X>=Y) cout << C*Y*2 + (X-Y)*min(A,2*C) << "\n";
    else cout << C*X*2 + (Y-X)*min(B,2*C) << "\n";
  }
  else cout << A*X + B*Y << "\n";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define stoi stoll
using pii=pair<int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
#define all(c) begin(c),end(c)
#define rall(c) rbegin(c),rend(c)
#define fore(x,c) for(auto &&x:c)
#define rep(i,a,n) for(int i=a,i##len=(int)(n);i<i##len;++i)
#define rrep(i, a, n) for(int i=(int)(n-1);i>=a;--i)
#define sz(c) ((int)c.size())
#define contains(c,x) (c.find(x)!=end(c))
#define inseg(l,x,r) ((l)<=(x)&&(x)<(r))
#define dump(...)
#define pb push_back
#define _ 0
const signed INF_=1001001001; const long long INF=1001001001001001001LL;
const int DX[9]={0,1,0,-1,1,1,-1,-1,0},DY[9]={-1,0,1,0,-1,1,1,-1,0};
template<class T> ostream& operator<<(ostream &os,const vector<T> &v) {
    for (auto i = begin(v); i != end(v); i++) os<<*i<<(i==end(v)-1?"":" ");return os;}
template<class T> istream& operator>>(istream &is,vector<T> &v) {
    for (auto i = begin(v); i != end(v); i++) is>>*i;return is;}
template<class T,class U> istream& operator>>(istream &is, pair<T,U> &p) {
    is>>p.first>>p.second;return is;}
template<class T, class U> bool chmax(T &a,const U &b){return a<b?a=b,1:0;}
template<class T, class U> bool chmin(T &a,const U &b){return a>b?a=b,1:0;}
template <class T> void psum(T& c) {partial_sum(begin(c), end(c), begin(c));}
template<class T> using heap=priority_queue<T,vector<T>,greater<T>>;
struct before_main_function {
    before_main_function() {
        cin.tie(nullptr); ios::sync_with_stdio(0);
        cout << setprecision(15) << fixed;
        // #define endl "\n"
    }
} before_main_function;
//------------------8<------------------------------------8<--------------------

signed main() {
    int N, L;
    cin >> N >> L;
    int a = (L - 1) * N + (N + 1) * N / 2;
    int x = a - (L + 1 - 1);
    int y = a - (L + N - 1);
    
    if (L <= 0 && 0 <= L + N - 1) {
        cout << a << endl;
    } else if (abs(a - x) < abs(a - y)) {
        cout << x << endl;
    } else {
        cout << y << endl;
    }
    return (0^_^0);
}



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 i = 1;
	int x;
 
	while(i <= n){
	    x = i;
	    if(x % 3 == 0){
		System.out.printf(" %d", i);
	    }
	    else while(true){
		    if(x % 10 == 3){
			System.out.printf(" %d", i);
			break;
		    }
		    x /= 10;
		    if(x == 0){
			break;
		    }
		}
	    i++;
	}
	System.out.printf("\n");
    }
}

Measured memory_bytes: 38080
from functools import lru_cache
import sys
sys.setrecursionlimit(10**7)

T = int(input())
INF = 10**18

for _ in range(T):
    N, A, B, C, D = map(int, input().split())

    @lru_cache(maxsize=None)
    def search(now):
        if now == 0:
            return 0

        ret = now * D
        for div, cost in zip((2, 3, 5), (A, B, C)):
            q, r = divmod(now, div)
            ret = min(
                ret,
                search(q) + cost + r * D,
                search(q + 1) + cost + (div - r) * D if q + 1 < now else INF,
            )
        return ret

    print(search(N))


Measured memory_bytes: 11852
//https://onlinejudge.u-aizu.ac.jp/courses/library/7/DPL/1/DPL_1_B

#include <bits/stdc++.h>

using namespace std;


int knapsackW(vector<int> p, vector<int> w, int c) {
    int n = w.size();
    vector<int> F(c + 1);
    for (int i = 0; i < n; ++i)
        for (int a = c; a >= w[i]; --a)
            F[a] = max(F[a], F[a - w[i]] + p[i]);
    return F[c];
}


int main() {
    int n, W;
    cin >> n >> W;

    vector<int> value(n), weight(n);
    for (int i = 0; i < n; ++i) {
        cin >> value[i] >> weight[i];
    }

    cout << knapsackW(value, weight, W) << endl;
    return 0;
}

/*
 * spaghetti-sourceのコードを利用。
 * 
 */


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

class Program {
    static void Main(string[] args) {
        int n = Cin.Ni();
        int m = Cin.Ni();
        HashSet<int> startSet = new HashSet<int>();
        HashSet<int> goalSet = new HashSet<int>();
        for (int i = 0; i < m; i++) {
            int a = Cin.Ni();
            int b = Cin.Ni();
            if (a == 1) {
                startSet.Add(b);
            }
            if (b == n) {
                goalSet.Add(a);
            }
        }
        startSet.IntersectWith(goalSet);
        Console.WriteLine(startSet.Any() ? "POSSIBLE" : "IMPOSSIBLE");
    }
}


public class Cin {
    private static string[] s = new string[0];
    private static int i = 0;

    private static char[] cs = new char[] { ' ' };

    public static string Next() {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        i = 0;
        return Next();
    }

    public static int Ni() {
        return int.Parse(Next());
    }

    public static long NextLong() {
        return long.Parse(Next());
    }

    public static double NextDouble() {
        return double.Parse(Next());
    }

}


Measured memory_bytes: 25524
/**
 * @author: Mackenzie
**/
#include <bits/stdc++.h>

using namespace std;

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()
#define F first
#define S second
#define forn(i, n) for (int i = 0; i < (int)n; i++)
#define pb push_back
#define fastIO ios::sync_with_stdio(0), cin.tie(0)
#define endl '\n'
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
int main() {
#ifdef LOCAL
    // freopen("in.txt", "r", stdin);
    // freopen("out.txt", "w", stdout);
#else
    fastIO;
#endif
    int n;
    cin >> n;
    for (int a = 0; a <= n; a++) {
        for (int b = 0; b <= n; b++) {
            if (4 * a + 7 * b == n) {
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;
    return 0;
}

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

int main()
{
  string s, t;
  cin >> s >> t;
  t = t.erase(t.size() - 1);

  if (s == t) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }

  return 0;
}


Measured memory_bytes: 3600
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define rep2(i,s,n) for (int i = s; i < n; ++i)
#define all(a) a.begin(),a.end()
#define tmax(a,b,c) max(a,max(b,c))
#define tmin(a,b,c) min(a,min(b,c))
#define pb push_back
#define fi first
#define se second
using namespace std;
using ll = long long;
using P = pair<int,int>;
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;}
const int inf = 1001001001;

int main() {
    int n;
    string s;
    cin >> n >> s;
    if(n%2 == 1) {
        cout << "No" << endl;
        return 0;
    }
    string a = s.substr(0,n/2);
    string b = s.substr(n/2);
    if(a == b) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a),i##_len=(b);i<i##_len;++i)
#define MSVC_UNKO(x) x
#define rep(...) MSVC_UNKO(_overload3(__VA_ARGS__,repi,_rep,_rep)(__VA_ARGS__))
#define all(c) c.begin(),c.end()
#define mp make_pair
#define write(x) cout<<(x)<<"\n"
using namespace std; typedef long long ll;
typedef vector<int> vi; typedef vector<ll> vll; template<class T>using vv = vector<vector<T>>;
template<class T>vv<T> vvec(size_t n, size_t m, T v) { return vv<T>(n, vector<T>(m, v)); }
template<class T>bool chmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }
template<class T>bool chmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
constexpr int INF = 1 << 28, MOD = 1e6 + 3; constexpr ll LINF = 1ll << 60;
struct aaa { aaa() { cin.tie(0); ios::sync_with_stdio(0); }; }aaaa;
ll mpow(ll x, int n) { ll y = 1; for (; n > 0; n /= 2) { y = n % 2 ? y * x % MOD : y; x = x * x % MOD; } return y; }

struct Combination {
    vector<ll> fact, ifact;
    Combination(int n) : fact(n + 1), ifact(n + 1) {
        fact[0] = 1;
        for (int i = 0; i < n; ++i) fact[i + 1] = fact[i] * (i + 1) % MOD;
        ifact[n] = mpow(fact[n], MOD - 2);
        for (int i = n; i > 0; --i) ifact[i - 1] = ifact[i] * i % MOD;
    }
    ll operator ()(int n, int k) { return fact[n] * ifact[n - k] % MOD * ifact[k] % MOD; }
} C(2 * MOD + 10);

int Q;
vi X, D, N;

int main() {
    cin >> Q;
    X.resize(Q);
    D.resize(Q);
    N.resize(Q);
    rep(i, Q) {
        cin >> X[i] >> D[i] >> N[i];
    }

    rep(i, Q) {
        ll minusX = (MOD - X[i]) % MOD;
        ll K = minusX * mpow(D[i], MOD - 2) % MOD;

        if (D[i] == 0) {
            write(mpow(X[i], N[i]));
        }
        else if (X[i] == 0 || N[i] > K) {
            write(0);
        }
        else {
            ll XbyD = X[i] * mpow(D[i], MOD - 2) % MOD;
            ll a = C.fact[(XbyD + N[i] - 1) % MOD], b = mpow(C.fact[(XbyD + MOD - 1) % MOD], MOD - 2);
            ll ans = C.fact[(XbyD + N[i] - 1) % MOD] * mpow(C.fact[(XbyD + MOD - 1) % MOD], MOD - 2) % MOD * mpow(D[i], N[i]) % MOD;
            write(ans);
        }
    }
}

Measured memory_bytes: 33280
#include <bits/stdc++.h>
#define long long long
using namespace std;
template<class A, class B>inline bool chmax(A &a, const B &b){return (a<b)?a=b,1 : 0;}
template<class A, class B>inline bool chmin(A &a, const B &b){return (a>b)?a=b,1 : 0;}
using pii = pair<int,int>;


int main()
{
  int a[3];
  cin >> a[0] >> a[1] >> a[2];
  sort(a, a+3);
  cout << a[0] * a[1] / 2 << endl;
  return 0;
}


Measured memory_bytes: 256
import itertools
import math

n = int(input())
p = [list(map(int, input().split())) for i in range(n)]

p = itertools.permutations(p, n)

l = []
for i in p:
    temp = []
    for j in range(n-1):
        temp.append(math.sqrt((i[j][0] - i[j+1][0])**2 + (i[j][1] - i[j+1][1])**2))
    l.append(sum(temp))

print(sum(l) / len(l))

Measured memory_bytes: 42204
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
#include<stdio.h>
#include <cstdint>
#include <stdlib.h> 
#include <time.h>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define rrep(i,n) REP(i,1,n+1)
#define all(a) a.begin(), a.end()
#define fi first
#define se second
#define RNG(x, a, n) &((x)[a]), &((x)[n])
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
typedef long long ll;
typedef pair<ll, ll> Pll;
typedef pair<int, int> PII;
typedef vector<ll> Vl;
typedef vector<int> VI;
typedef tuple<int, int, int> TT;
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
#define rall(v) v.rbegin(), v.rend()
#define dmp(x,y) make_pair(x,y)
#define dmt(x, y, z) make_tuple(x, y, z)
#define pb(x) push_back(x)
#define pf(x) push_front(x)
const int MAX = 510000;
const int inf = 1e9 + 7;
const int mod = 1e9 + 7;
const ll longinf = 1LL << 60;
const long double PI = (acos(-1));
const long double EPS = 0.0000000001;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % mod;
		inv[i] = mod - inv[mod % i] * (mod / i) % mod;
		finv[i] = finv[i - 1] * inv[i] % mod;
	}
}

// 二項係数計算
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}

ll n, k;

int main() {

	COMinit();

	cin >> n >> k;

	rrep(i, k) {
		cout << COM(n - k + 1, i) * COM(k - 1, i - 1) % mod << endl;
	}

	return 0;
}

Measured memory_bytes: 12160
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;

#define MOD 1000000007

int main() {
  int n;
  cin >> n;
  vector<int> p(n), q(n);
  for (int i = 0; i < n; ++i) {
    cin >> p[i];
  }
  for (int i = 0; i < n; ++i) {
    cin >> q[i];
  }
  vector<int> order(n);
  for (int i = 0; i < n; ++i) {
    order[i] = i + 1;
  }
  int a = 0, b = 0;
  int cnt = 0;
  do {
    cnt++;
    if (order == p) a = cnt;
    if (order == q) b = cnt;
  } while (next_permutation(order.begin(), order.end()));
  cout << abs(a - b) << endl;
  return 0;
}

Measured memory_bytes: 3508
#include <iostream>
using i64 = long long;

int main() {
    int n;
    std::cin >> n;
    const int d = n % 10;
    if (d == 2 || d == 4 || d == 5 || d == 7 || d == 9) std::cout << "hon";
    else if (d != 3) std::cout << "pon";
    else std::cout << "bon";
    std::cout << std::endl;

    return 0;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a,b,c;
  cin>>a>>b>>c;
  
  vector<int> v(3);
  v.at(0)=a;
  v.at(1)=b;
  v.at(2)=c;
  
  sort(v.begin(),v.end());
  
  cout<<v.at(0)+v.at(1)<<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 A = sc.nextInt();
      	int B = sc.nextInt();
      	int C = sc.nextInt();
      	
      	// A B Cに5が二つ 7が1つ含まれている場合のみ
      	// A * B * C = 5 * 5 * 7 = 175 になる
      	int product = 175;
      	
      	// A * B * C = productと一致するか判定
      	if(A * B * C == product) {
        	System.out.println("YES");
        } else {
         	System.out.println("NO");
        }
	}  
}

Measured memory_bytes: 35752
# input
h,w = map(int, input().split())
grid = list()
for _ in range(h):
    grid.append(list(input()))

sharp_ind = set()
count = 0
for i in range(h):
    for j in range(w):
        if grid[i][j] == "#":
            sharp_ind.add((i,j))
            count += 1

check_ind = [(-1,0),(1,0),(0,-1),(0,1)]
check_res = []

for i in range(h):
    for j in range(w):
        if grid[i][j] == '#':
            flag = False
            for r,c in check_ind:
                if (i+r, j+c) in sharp_ind:
                    flag = True
            check_res.append(flag)

if sum(check_res) == count:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3316
mod = 1000000007
eps = 10**-9


def main():
    import sys
    from collections import deque
    input = sys.stdin.buffer.readline

    N = int(input())
    adj = [[] for _ in range(N+1)]
    for _ in range(N-1):
        a, b, c = map(int, input().split())
        adj[a].append((b, c))
        adj[b].append((a, c))
    Q, root = map(int, input().split())

    que = deque()
    que.append(root)
    seen = [-1] * (N+1)
    seen[root] = 0
    par = [0] * (N+1)
    child = [[] for _ in range(N+1)]
    seq = []
    while que:
        v = que.popleft()
        seq.append(v)
        for u, c in adj[v]:
            if seen[u] == -1:
                seen[u] = seen[v] + c
                par[u] = v
                child[v].append(u)
                que.append(u)
    seq.reverse()

    for _ in range(Q):
        x, y = map(int, input().split())
        print(seen[x] + seen[y])


if __name__ == '__main__':
    main()


Measured memory_bytes: 77360
#include <stdio.h>

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

Measured memory_bytes: 600
#include <iostream>
#include <vector>

using namespace std;

int digit_check(int n){
  int digit = 0;
  while(n!= 0){
    n = n/10;
    ++digit;
  }
  return digit;
}

bool archive_check(vector< int >& archive, int n){
  for (int i = 0; i < archive.size(); ++i)
  {
    if (archive[i] == n)
    {
      return true;
    }
  }
  return false;
}

int solve(int n){
  vector<int> ans;
  vector<int> archive;
  int digit, mul, upper, low, max;
  int count ;
  count = 0;
  while (true){
    digit = digit_check(n);
    // cout << n << endl;
    if (archive_check(archive, n)){
      return -1;
    }
    if (digit == 1 || digit == 0){
      return count;
    }
    for (int i = 1; i < digit; ++i)
    {
      mul = 1;
      for (int j = 0; j < i; ++j)
      {
        mul = mul*10;
      }
      upper = n / mul;
      low = n - mul * upper;
      ans.push_back(upper * low);
    }
    max = ans[0];
    for (int i = 0; i < digit-1; ++i)
    {
      if (max < ans[i])
      {
        max = ans[i];
      }
    }
    n = max;
    ans.clear();
    count ++;
  }

}

int main(){
  int q, n;
  cin >> q;
  for (int i = 0; i < q; ++i)
  {
    cin >> n;
    cout << solve(n) << endl;
  }
}

Measured memory_bytes: 1212
#include<stdio.h>
#include<math.h>
#define inf 9999999

int main(){
  int N,i,j,k,l,m;
  int matrix[200][200];
  int p[101];

  scanf("%d",&N);
  for(i=0;i<N;i++) scanf("%d%d",&p[i],&p[i+1]);
  for(i=1;i<=N;i++) matrix[i][i]=0;

  for(i=2;i<=N;i++){
    for(j=1;j<=N;j++){
      k=i+j-1;
      matrix[j][k]=inf;
      for(l=j;l<=k;l++){
	matrix[j][k]=fmin(matrix[j][k],matrix[j][l]+matrix[l+1][k]+p[j-1]*p[l]*p[k]);
      }
    }
  }
  
  printf("%d\n",matrix[1][N]);
  return 0;
}
	   
			  
  
  
  
    







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

using namespace std;

typedef long long ll;
typedef pair<int, int> ii;
typedef pair<ll, ll> pll;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;

#define getBit(x,i) (x&i)
#define setBit(x,i) (x|i)
#define mem(A,N) memset(A,N,sizeof(A))
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define mp make_pair
#define rep(i, x, y)  for(int i = x; i < y; ++i)
#define Rep(i, x, y)  for(int i = x; i <= y; ++i)
#define srep(i, x, y) for(int i = x; i > y; --i)
#define sRep(i, x, y) for(int i = x; i >= y; --i)
#define all(v) v.begin(),v.end()
#define Sort(x) sort(x.begin(), x.end())
#define f1(i,n) for (int i=1; i<=n; i++)
#define f0(i,n) for (int i=0; i<n; i++)
#define SZ(x) ((int)(x).size())
#define LEN(x) ((int)(x).length())
#define fi first
#define se second

#define linf 0x7FFFFFFFFFFFFFFF
#define inf 0x7FFFFFFF
#define mod 1000000007
#define eps 1e-9
#define Pi 3.14159265358979323846

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl
#define write(x) cerr << #x << " = " << (x) << ", "
#define writeI0 cerr << "i = " << 0 << ", "
#define dumpI0 cerr << "i = " << 0 << endl
#define printSet(x) for(auto it = s.begin(); it!=s.end(); it++) (it==s.begin())? cout << *it : cout << ' ' << *it; cout << endl;
#define printVector(x) for(auto it = x.begin(); it!=x.end(); it++) (it==x.begin())? cout << *it : cout << ' ' << *it; cout << endl;

// ***************** End Of Template ********************

int n;
int c[25];

int main() {
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    cin >> n; int t;
    rep(i, 0, n) {
        cin >> t;
        c[t]++;
    }

    Rep(j, 0, 12) {
        if(c[j] >= 3) {
            cout << 0;
            return 0;
        }
    }

    int sol = -1e9;

    rep(i, 0, 1<<13) {
        vi a;
        Rep(j, 0, 12) {
            if(c[j] == 2) { a.pb(j); a.pb(24-j); }
            else if(c[j] == 1) {
                if((1<<j) & i) a.pb(24-j);
                else a.pb(j);
            }
        }
        a.pb(0);
        a.pb(24);
        int n = SZ(a);
        int minD = 1e9;
        rep(j, 0, n) {
            rep(k, j+1, n) {
                minD = min( minD, abs( a[j]-a[k] ) );
            }
        }
        if(minD != 1e9)
            sol = max(sol, minD);
    }

    cout << sol;
    return 0;
}



Measured memory_bytes: 256
#include <stdio.h>
#include <vector>
#include <iostream>
#include <string>
#include <algorithm> 
#include <iterator> 
#include <map> 

using namespace std;


long long int N;
vector <long long int> A;
vector <long long int> B;
long long int ka;
long long int co=0;
map<long long int,long long  int> mp;


int main(){
	scanf("%lld",&N);
	for(int i=0;i<N;i++){
		scanf("%lld",&ka);
		A.push_back(ka);
		mp[ka]=i;
	}
	std::map<long long int,long long int>::iterator it = mp.begin();
	
	for(int i=0;i<N;i++){
		if((*it).second % 2 != i%2)co++;
		//printf("%lld,%d\n",mp[A[i]],i);
		++it;
	}
	//printf("%lld\n",mp[1]);
	printf("%lld\n",(long long int)co/2);
	
	return 0;
}


Measured memory_bytes: 7284
#include <iostream>
#include <vector>

using namespace std;
using ll = long long;
int main()
{
  int n;
  cin >> n;
  vector<int> x;
  int max = 0;
  for(int i = 0;i < n;i++){
    int tmp;
    cin >> tmp;
    if (max < tmp) {
      max = tmp;
    }
    x.push_back(tmp);
  }

  ll res = 0;
  for(int i = 1;i <= max;i++) {
    ll res1 = 0;
    for(int j = 0;j < n;j++) {
      res1 += (x[j] - i) * (x[j] - i);
    }
    if(res == 0 || res1 < res) {
      res = res1;
    }
  }
  cout << res << endl;
}

Measured memory_bytes: 256
#include <functional>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;
const ll MOD = 1000000007LL;

int main() {
    int x, y;
    cin >> x >> y;
    cout << (2 * x <= y && 4 * x >= y && y % 2 == 0 ? "Yes" : "No") << endl;
    return 0;
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long long LL;
const int maxn=1e5+10;
int a[maxn];
int main()
{
	int n;
	ll num=0;
	scanf("%d",&n);
	for(int i=1;i<=n;i++)scanf("%d",&a[i]);
	sort(a+1,a+n+1);
	for(int i=1;i<=n;i++){
		int l=i+1,r=i+2;
		while(r<=n){
			if(a[l]+a[i]>a[r]){
				num+=r-l;
				r++;
			}
			else {
				while(l<r&&a[l]+a[i]<=a[r]){
					l++;
				}
				if(l<r&&a[l]+a[i]>a[r])num+=r-l;
				r++;
			}
		}
	}
	printf("%lld\n",num);
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define FOR(i, a, b) for (int i = a; i < b; i++)
#define mFOR(i, a, b) for (int i = a; i > b; i--)
#define MP make_pair
#define PB push_back
#define ALL(v) v.begin(), v.end()
#define N 100007
#define INF 1000000007
using namespace std;

typedef long long ll;

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

int main()
{
   int n, a, b;
   cin >> n;
   if (n == 1)
      cout << "Hello World" << endl;
   else
   {
      cin >> a >> b;
      cout << a + b << endl;
   }
   return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cassert>
#include <complex>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <sstream>
#include <ctime>
#include <cctype>
#include <set>
#include <map>
#include <queue>
#include <bitset>
#include <deque>
#include <stack>
#include <memory.h>
using namespace std;
#define ll long long 
int n;
ll seq[200005];
int main(){ 
	cin>>n;
	ll sum=0;
	for(int i=0;i<n;i++){
		cin>>seq[i];
		sum+=seq[i];
	}
	ll sum1=0,o1,o2,ans=1e15;
	for(int i=0;i<n-1;i++){
		sum1+=seq[i];
		sum-=seq[i];
		ll res=abs(sum-sum1);
		ans=min(res,ans);
	}
	cout<<ans;
    return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
int n, a[20][20];
long long dp[1<<16];
int main(){
	scanf("%d", &n);
	rep(i,n) rep(j,n) scanf("%d", a[i]+j);
	rep(i,1<<n){
		rep(j,n) for(int k=j+1; k<n; k++) if(i>>j&i>>k&1) dp[i] += a[j][k];
		for(int j=(i-1)&i; j; j=(j-1)&i) dp[i] = max(dp[i], dp[j]+dp[j^i]);
	}
	printf("%lld\n", dp[(1<<n)-1]);
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
int main()
{
    long long int n,m,o,p,q,a[4],i;
    n=0;
    m=0;
    for(i=0;i<3;i++)
    {
        cin>>a[i];
        if(a[i]==5){n++;}
        else if(a[i]==7){m++;}
    }
    if(n==2 && m==1){cout<<"YES\n";}
    else{cout<<"NO\n";}

    return 0;
}


Measured memory_bytes: 508
#define _USE_NATH_DEFINES
#include<cstdio>
#include <iostream>
#include<sstream>
#include<fstream>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<complex>
#include <string>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<numeric>
#include<limits>
#include<climits>
#include<cfloat>
#include<functional>
#include<iterator>
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
using namespace std;

#define INF 100000000


int main() {
	int n, k;
	string s;
	cin >> n >> s >> k;
	char t = s[k-1];
	rep(i, n) {
		if (s[i] != t) {
			s[i] = '*';
		}
	}
	cout << s << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<vector>
#define N 999999

using namespace std;

int main(){
  int i, j, n, isFound, count;
  vector<int> data;

  data.push_back(2);
  data.push_back(3);
  for(i=5; i<=N; i+=2){
    for(j=1, isFound=0; data[j]<=sqrt(i); ++j){
      if(i%data[j] == 0){
	isFound = 1;
	break;
      }
    }
    if(isFound == 0) data.push_back(i);
  }

  while(cin >> n){
    for(i=0; i<data.size(); ++i){
      if(n < data[i]) break;
    }
    cout << i << endl;
  }

  return 0;
}

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

using namespace std;

int main(){
    int64_t n;
    cin >> n;
    int64_t S = 0;
    for (int64_t i = 1; i <= n; i++)
        if (i % 3 != 0 and i % 5 != 0)
            S += i;

    cout << S << endl;
}

Measured memory_bytes: 3676
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MOD 1000000007
#define INF 1e9
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;

int main(){
	int N;
	ll W;
	cin>>N>>W;
	ll w[N],v[N];
	rep(i,N) cin>>v[i]>>w[i];
	vector<pair<ll,ll>> p;
	int N2=N/2;
	for(int i=0;i<1<<N2;i++){
		ll sw=0,sv=0;
		for(int j=0;j<N2;j++){
			if(i>>j & 1){
				sw+=w[j];
				sv+=v[j];
			}
		}
		p.push_back(make_pair(sw,sv));
	}
	sort(all(p));
	int m=1;
	for(int i=1;i<1<<N2;i++){
		if(p[m-1].second<p[i].second){
			p[m]=p[i];
			m++;
		}
	}
	ll res=0;
	for(int i=0;i<1<<(N-N2);i++){
		ll sw=0,sv=0;
		for(int j=0;j<N-N2;j++){
			if(i>>j & 1){
				sw+=w[N2+j];
				sv+=v[N2+j];
			}
		}
		if(sw<=W){
			pair<ll,ll> _p=make_pair(W-sw,INF);
			ll tv=(lower_bound(p.begin(),p.begin()+m,_p)-1)->second;
			res=max(res,sv+tv);
		}
	}
	cout<<res<<endl;
}


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

int main(){
  using namespace std;
  unsigned long N;
  cin >> N;
  for(unsigned long i{1}; i < 10; ++i)
    if(N % i == 0 && N / i <= 9)return 0 & puts("Yes");
  puts("No");
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include<functional>
#include<numeric>
#include<queue>
#include<stack>
#include<map>
#include<unordered_map>
#include<set>
#include<bitset>
#include<random>

#pragma region
using namespace std;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define rep(i,n) FOR(i,0LL,n)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define rrep(i,n) RFOR(i,0LL,n)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define COUNT(a,y,x) upper_bound(all(a), y) - lower_bound(all(a), x)
#define UNIQUE(a) sort(all(a)); a.erase(unique(all(a)), a.end())
#define pb push_back
typedef long long int ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<string> vs;
typedef map<ll, ll> MAP;
const ll inf = 1LL << 61;
const ll mod = 1000000007LL;
//const ll mod = 998244353LL;

ll n = 0, m = 0, ans = 0, tmp = 0, ma = -inf, mi = inf;
string s;
bool ok;
ll dx[9] = { 0,1,0,-1,0,1,1,-1,-1 }, dy[9] = { 0,0,1,0,-1,1,-1,1,-1 };
#define endl '\n'
#pragma endregion
#define MAX 222222


vll fac, inv, invfac;
void comb_set(ll x = MAX) {
  fac.resize(x + 1, 0);
  invfac.resize(x + 1, 0);
  inv.resize(x + 1, 0);
  fac[0] = inv[1] = invfac[0] = 1;
  FOR(i, 1, x + 1) (fac[i] = fac[i - 1] * i) %= mod;
  FOR(i, 2, x + 1) (inv[i] = (mod - mod / i) * inv[mod%i]) %= mod;
  FOR(i, 1, x + 1) (invfac[i] = invfac[i - 1] * inv[i]) %= mod;
}
ll comb(ll x, ll y) {
  if (x < y) return 0;
  return fac[x] * invfac[x - y] % mod * invfac[y] % mod;
}


ll sum[MAX];

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


  ll k;
  cin >> n >> m >> k;
  comb_set(MAX);
  rep(i, MAX - 2) (sum[i + 1] = sum[i] + i + 1) %= mod;
  FOR(y, 1, n + 1) {
    FOR(x, 1, m + 1) {
      (ans += sum[y - 1] * comb(n*m - 2, k - 2)*m) %= mod;
      (ans += sum[n - y] * comb(n*m - 2, k - 2)*m) %= mod;
      (ans += sum[x - 1] * comb(n*m - 2, k - 2)*n) %= mod;
      (ans += sum[m - x] * comb(n*m - 2, k - 2)*n) %= mod;
    }
  }
  cout << (ans*inv[2]) % mod << endl;



  return 0;
}

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

int main() {
	int n, k; cin>>n>>k;
	vector<int> a(n + 1);
	for(int i = 1; i <= k; i++){
		int d; cin>>d;
		for(int j = 1; j <= d; j++){
			int x; cin>>x;
			a[x]++;
		}
	}
	int answer = 0;
	for(int i =1; i <= n; i++){
		answer += (a[i] == 0);
	}
	cout<<answer<<endl;
	return 0;
}

Measured memory_bytes: 3628