akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define pb push_back
#define mp make_pair
#define ss(x) (int) x.size()
#define fi first
#define se second
#define cat(x) cerr << #x << " = " << x << endl
#define rep(i, j, n) for (int i = j; i <= n; ++i)
#define per(i, j, n) for (int i = n; j <= i; --i)
#define all(x) x.begin(), x.end()
 
using namespace std;

ll a, b, c, k;

int main() {
	scanf ("%lld%lld%lld%lld", &a, &b, &c, &k);
	if (k % 2 == 0) printf ("%lld\n", a - b);
	else printf ("%lld\n", b - a);
	
	
	return 0;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var n int
	var ans float64
	fmt.Scan(&n)
	x := make([]float64, n)
	u := make([]string, n)
	for i := 0; i < n; i++ {
		fmt.Scanf("%f %s", &x[i], &u[i])
		if u[i] == "BTC" {
			ans += 380000 * x[i]
		} else {
			ans += x[i]
		}
	}
	fmt.Println(ans)
}

Measured memory_bytes: 512
// Shinchan Loves Coding :)))
#include<bits/stdc++.h>
#include<map>
#include<set>
#include<stack>
using namespace std;

#define night_rider ios::sync_with_stdio(false);cin.tie(NULL);
#define int long long int
#define double long double
#define en "\n"
#define fi first
#define se second
#define MP make_pair
#define PB push_back
#define all(v) v.begin(),v.end()
#define allr(v) v.rbegin(),v.rend()
#define toUpper(x) transform(x.begin(), x.end(), x.begin(),::toupper);
#define toLower(x) transform(x.begin(), x.end(), x.begin(),::tolower);
typedef vector<int> vi;
typedef vector<vector<int>> vii;
typedef pair<int,int> pi;
typedef vector<pair<int,int>> pii;
bool secdes(const pair<int,int>&a , const pair<int,int>&b){if(a.se==b.se){return a.fi>b.fi;}else{return a.se>b.se;}}//second descending !
bool sir(const pair<int,int>&a , const pair<int,int>&b){if(a.fi==b.fi){return a.se>b.se;}else{return a.first>b.first;}}//first descending !
bool bysec(const pair<int,int>&a , const pair<int,int>&b){if(a.se==b.se){return a.fi<b.fi;} else{return a.se<b.se;}}//second ascending !

/*--------------------------------------------------------------------------------------------------------------------------------------------------------------*/

const int no=3e6+5;
const int modulo=1e9+7;
const int inf=1e18;
const int N=1001;
int a[no],b[no],cc[no],dd[no],mat[N][N];
stack<int> S;
stack<int> ma;
int dx[]={-1 , 0 , 1 , 0};
int dy[]={0 , 1 , 0 , -1};
char c[N][N];

/*--------------------------------------------------------------------------------------------------------------------------------------------------------------*/
int mul(int x ,int y,int mod) {
    return ((x%mod)*(y%mod))%mod;
}

int powwmod(int x, int y , int mod) { int res=1; while (y) { if (y & 1){ y--; res=mul(res,x,mod); res%=mod; } else { y/=2; x=mul(x,x,mod); x%=mod; } } return res%mod; }

int poww(int x , int y) { int res=1; while(y) { if(y%2) { y--; res=res*x; } else { y/=2; x=x*x; } } return res; }

bool comp(int x, int y) {
    return (x < y);   // MINIMUM
    return (x > y);   // MAXIMUM
}

int gcd(int x, int y) { if(y==0) return x; else return gcd(y,x%y); }

/*--------------------------------------------------------------------------------------------------------------------------------------------------------------*/

vi adj[no];
int used[no],vis[N][N],dist[N][N],timer,in[no],low[no];
int pp,brig;

/**/
void solve (){
    int n,m,k,x,y,p,q;
    cin>>n>>m>>k;
    float kk=(float)n/(float)k;
    if(kk<=(float)m) cout<<"Yes";
    else cout<<"No";
}
void runn(){
        #ifndef ONLINE JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
        #endif
}

signed main()
{
    night_rider
    //runn();
    int t=1;
    //cin>>t;
    while(t--){
        solve();
    }
}


Measured memory_bytes: 73936
#include<iostream>
#include<string>
#include<cmath>
#include<algorithm>
using namespace std;

struct light{
	int k, s[10];
};

int check[10];

void count(int n, int m, light l[], int p[], int& ans){
	check[n] = 0;
	if(n > 0)
		count(n-1, m, l, p, ans);
	else{
		bool judge = true;
		for(int i = 0; i < m; i++){
			int on = 0;
			for(int j = 0; j < l[i].k; j++){
				if(check[l[i].s[j]-1])
					on++;
			}
			if(on%2 != p[i]){
				judge = false;
				break;
			}
		}
		if(judge)
			ans++;
	}
	check[n] = 1;
	if(n > 0)
		count(n-1, m, l, p, ans);
	else{
		bool judge = true;
		for(int i = 0; i < m; i++){
			int on = 0;
			for(int j = 0; j < l[i].k; j++){
				if(check[l[i].s[j]-1])
					on++;
			}
			if(on%2 != p[i]){
				judge = false;
				break;
			}
		}
		if(judge)
			ans++;
	}
}

int main(){
	int n, m;
	cin >> n >> m;
	light l[10];
	for(int i = 0; i < m; i++){
		cin >> l[i].k;
		for(int j = 0; j < l[i].k; j++){
			cin >> l[i].s[j];
		}
	}
	int p[10];
	for(int i = 0; i < m; i++)
		cin >> p[i];
	int ans = 0;
	count(n-1, m, l, p, ans);
	cout << ans << '\n';
	return 0;
}

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

int main() {
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	int a;
	cin >> a;
	cout << a + a*a + a*a*a << '\n';
}

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

using namespace std;

int main() {
#ifdef _DEBUG
	freopen("_in" , "r", stdin );
	freopen("_out", "w", stdout);
#endif
	int n; cin >> n;
	string s; cin >> s;
	s = '$' + s;
	int ans = 0;
	for (int i = 1; i < s.size(); i++) {
		if (s[i] != s[i - 1]) ans++;
	}
	cout << ans << '\n';
}

Measured memory_bytes: 512
#include<algorithm>
#include<iostream>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<iomanip>
#include<complex>
#include<cstdio>
#include<vector>
#include<queue>
#include<stack>
#include<cmath>
#include<list>
#include<map>
#include<set>
using namespace std;

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef stack<int> SI;
typedef queue<int> QI;
typedef list<int> LI;
typedef pair<int,int> PII;
typedef long long LL;

#define d(x)  cout<<#x<<" = "<<(x)<<endl;
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define EP empty()
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define REACH(i,c) for(typeof((c).rbegin()) i=(c).rbegin(); i!=(c).rend(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c,n) sort(c,c+n)
#define VSORT(c) sort((c).begin(),(c).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define DFOR(i,b,a) for(int i=(b)-1;i>=(a);--i)
#define DREP(i,n) DFOR(i,n,0)
#define INF 1000000000
#define PI  acos(-1.0)
////////////////////////////////////////////////
int main()
{
	int n=0;cin>>n;
	int a[110]={0};
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
		a[i]*=-1;
	}
	sort(a,a+n);
	int ans=0;
	for(int i=0;i<n;i++)
	{
		ans+=a[i]*pow(-1,i+1);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;

bool check(ll a, ll b, ll c){
  if(a == b) return false;
  if(b == c) return false;
  if(a == c) return false;

  if(a+b <= c) return false;
  if(b+c <= a) return false;
  if(a+c <= b) return false;

  return true;
}


int main(){
  int N;
  cin >> N;

  vector<ll> v;
  rep(i,N){
    ll a;
    cin >> a;
    v.push_back(a);
  }

  int ret = 0;
  rep(i,N){
    REP(j,i+1,N){
      REP(k,j+1,N){
        if(check(v[i], v[j], v[k])) ret++;
      }
    }
  }
  
  cout << ret << endl;
  
  return 0;
}


Measured memory_bytes: 3632
/*
g++ -std=c++14 -O2 -Wall a.cpp -o a && a < in.txt > out.txt
*/

//  io
#include <iostream>
//#include <fineam> //http://www.cplusplus.com/reference/fineam/fineam/
//#include <cstdio>
#include <iomanip> //http://www.cplusplus.com/reference/iomanip/
#include <limits>
//  util
#include <string>
#include <cstring>
#include <algorithm>
//#include <utility>
//#include <functional> //http://www.cplusplus.com/reference/functional/
//#include <cstdlib>
#include <cmath>
//#include <complex>
//#include <random>
//#include <bitset>
//  containers https://en.cppreference.com/w/cpp/container
#include <vector>
#include <queue>
#include <set>
//#include <map>
//#include <unordered_set>
//#include <unordered_map>
//  time
//#include <ctime>
//#include <chrono>
//                  https://en.cppreference.com/w/cpp/header/chrono
//                  http://www.cplusplus.com/reference/chrono/

using namespace std;
typedef vector<int> arri;
typedef vector<float> arrf;
typedef pair<int, int> pairi;
typedef long long ll;
typedef long double ld;
const int mod = 1e9 + 7;
const ll inf = 0x7fffffffffffffff;
const ll infneg = -0x7fffffffffffffff;

//file input routed to stdinout
/*
std::ifineam inFile("input.txt");
std::ofineam outFile("output.txt");
std::cin.rdbuf(inFile.rdbuf());
std::cout.rdbuf(outFile.rdbuf());
*/

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

    int n;
    cin >> n;

    arri vals(n + 1);
    vals[0] = mod;
    vals[n] = mod;

    for (int i = 1; i < n; i++)
    {
        cin >> vals[i];
    }
    int sum = 0;
    for (int i = 1; i < n + 1; i++)
    {
        sum += min(vals[i], vals[i - 1]);
    }
    cout << sum;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key

typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef long double ld;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

const long long mod = 1000000007;
const long long inf = 1e18;

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    int n,m;
    cin>>n>>m;
    cout<<(n*n-m)<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
using namespace std;
typedef long long ll;
typedef long double ld;
ll pow(ll x,ll y){
  if(y==0) return 1;
  ll ret=pow(x,y/2);
  ret*=ret;
  if(y%2==1) ret*=x;
  return ret;
}
int main(){
  ll n,k;
  cin>>n>>k;
  ll k2=1;
  int cnt=0;
  while(k2<k){
    k2*=2;
    cnt++;
  }
  ll as=0;
  for(int i=1;i<=n;i++){
    int c=0;
    ll kat=i;
    while(kat<k) {
      kat*=2;
      c++;
    }
    as+=pow(2,cnt-c);
  }
  printf("%.12Lf\n",(ld)as/(ld)(k2*n));
}


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

int main(){
    long long s;
    cin >> s;

    long long ans[8];
    for(int i = 0; i < 8; i++){
        ans[i] = 0;
    }

    int k = 0;

    for(int i = 0; i < 8; i++){
        if(s / 100 == 0){
            break;
        }
        ans[i] = s % 1000;
        s /= 10;
        k++;
    }

    vector<int> absk;

    for(int i = 0; i < k; i++){
        absk.push_back(abs(753 - ans[i]));
        //cout << ans[i] << " " << absk[i] << endl;
    }

    int min = 10000;

    for(int i = 0; i < k; i++){
        if(min >= absk[i]){
            min = absk[i];
        }
    }

    cout << min << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define sz(x) (int)(x).size()
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define EPS (1e-10)
#define equals(a, b) (fabs((a)-(b)) < EPS)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;
  
int main() {
  ll N,D;
  cin >> N >> D;
  int ans = 0;
  rep(i,N) {
    ll x,y;
    cin >> x >> y;
    if(x*x+y*y<=D*D) ans++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3668
#入力
D, G = map(int, input().split())
p = [tuple(map(int, input().split())) for i in range(D)]

min = 0
for val in p:
    min += val[0]

for i in range(2 ** D -1):
    s = bin(i)[2:].zfill(D)
    point = 0
    count = 0
    #全問解く問題を加算
    for j in range(D):
        if s[j] == "1":
            point += p[j][0] * 100 * (j+1) + p[j][1]
            count += p[j][0]
    #目標点を超えた場合、問題数を更新
    if point >= G and min > count:
        min = count
    #全問解いた問題を除く最高点の問題を加算
    idx = s.rfind("0")
    for j in range(p[idx][0] -1):
        point += 100 * (idx + 1)
        count += 1
        #最小問題数を更新
        if point >= G and min > count:
            min = count
            break

#出力
print(min)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
//#include <boost/multiprecision/cpp_int.hpp>
//using multiInt = boost::multiprecision::cpp_int;

using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template <typename Q_type>
using smaller_queue = priority_queue<Q_type, vector<Q_type>, greater<Q_type>>;

const int MOD_TYPE = 1;
const ll MOD = (MOD_TYPE == 1 ? (ll)(1e9 + 7) : 998244353);
const int INF = (int)1e9;
const ll LINF = (ll)4e18;
const ld PI = acos(-1.0);
const ld EPS = 1e-11;

#define REP(i, m, n) for (ll i = m; i < (ll)(n); ++i)
#define rep(i, n) REP(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << endl
#define possible(n) cout << ((n) ? "possible" : "impossible") << endl
#define Yay(n) cout << ((n) ? "Yay!" : ":(") << endl
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x) cerr << #x << ":" << x << endl;

vector<int> Dx = {0, 0, -1, 1, -1, 1, -1, 1, 0};
vector<int> Dy = {1, -1, 0, 0, -1, -1, 1, 1, 0};

int n;
ld dp[310][310][310];

ld f(int i, int j, int k)
{
  if (i == 0 && j == 0 && k == 0)
    return 0.0;
  if (i < 0 || j < 0 || k < 0)
    return -123456;
  if (dp[i][j][k] != -1)
    return dp[i][j][k];

  ld res = ld(n) / ld(i + j + k);
  res += f(i - 1, j, k) * ld(i) / ld(i + j + k);
  res += f(i + 1, j - 1, k) * ld(j) / ld(i + j + k);
  res += f(i, j + 1, k - 1) * ld(k) / ld(i + j + k);
  return dp[i][j][k] = res;
}

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(30) << setiosflags(ios::fixed);

  cin >> n;
  int cnt[3] = {};
  rep(i, n)
  {
    int a;
    cin >> a;
    cnt[a - 1]++;
  }
  rep(i, 310) rep(j, 310) rep(k, 310) dp[i][j][k] = -1;
  cout << f(cnt[0], cnt[1], cnt[2]) << endl;
  return 0;
}


Measured memory_bytes: 465792
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
using ll = long long;
#define FOR(i,N) for(auto i=0; i<N; ++i)
#define ALL(x) x.begin(), x.end()

/* clang-format off */
template <class T> inline void chmin(T& a, const T& b) { if (b < a) a = b; }
template <class T> inline void chmax(T& a, const T& b) { if (b > a) a = b; }
/* clang-format on */

int main() {

  ll W, H; cin >> W >> H;
  ll x, y; cin >> x >> y;
  cout << fixed;

  double ans = double(H) * W / 2;
  ll mult = 0;
  if (x *2== W  && y *2== H ) {
    mult = 1;
  }
  
  cout << setprecision(10)<<ans<<" "
    << mult << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
using namespace std;
using P = pair<int,int>;
const vector<int> di{-1,0,1,0};
const vector<int> dj{0,-1,0,1};

int main(){
  int H, W;
  cin >> H >> W;
  vector<vector<char>> A(H,vector<char>(W));
  vector<vector<int>> D(H,vector<int>(W,-1));
  queue<P> q;
  for(int i=0; i<H; i++){
    for(int j=0; j<W; j++){
      cin >> A.at(i).at(j);
      if(A.at(i).at(j)=='#'){
        q.push(make_pair(i,j));
        D.at(i).at(j) = 0;
      }
    }
  }
  while(!q.empty()){
    int i, j;
    tie(i,j) = q.front();
    q.pop();
    for(int v=0; v<4; v++){
      int ni = i+di.at(v);
      int nj = j+dj.at(v);
      if(ni<0||ni>=H) continue;
      if(nj<0||nj>=W) continue;
      if(D.at(ni).at(nj)<0){
        D.at(ni).at(nj) = D.at(i).at(j)+1;
        q.push(make_pair(ni,nj));
      }
    }
  }
  for(int i=0; i<H; i++){
    sort(D.at(i).begin(),D.at(i).end());
  }
  int ans = 0;
  for(int i=0; i<H; i++){
    ans = max(ans,D.at(i).at(W-1));
  }
  cout << ans;
  return 0;
}

Measured memory_bytes: 16212
#include<stdio.h>
int main(){
    int n,a[10],i,temp=0,sum=0,cost;
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%d",&a[i]);
        if(a[i]>temp){
            temp=a[i];
        }
        sum+=a[i];
    }
    cost=sum-temp+(temp/2);
    printf("%d\n",cost);
    return 0;
}


Measured memory_bytes: 128
#include <stdio.h>

int main(void)
{
    char T[200000]={0};
    scanf("%s", T);
    int i=0;
    while(1){
        if(T[i]=='\0')  break;
        if(T[i]=='\?'){
        T[i] = 'D';
        }
        i++;
    }
    printf("%s",T);
}


Measured memory_bytes: 1928
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define SZ(x) ((int)(x).size())
#define m0(x) memset(x,0,sizeof(x))
#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))

map<ll, ll> primeFactors(ll n)
{
    map<ll, ll> ret;
    while (n % 2 == 0)
    {
        if( ret.find(2) != ret.end() ) {
            ret[2]++;
        }
        else
        {
            ret[2] = 1;
        }
        n = n / 2;
    }
    for (ll i = 3; i <= sqrt(n); i = i+2)
    {
        while (n%i == 0)
        {
            if( ret.find(i) != ret.end() ) {
            ret[i]++;
        }
        else
        {
            ret[i] = 1;
        }
            n = n / i;
        }
    }
    if (n > 2)
        {
            if( ret.find(n) != ret.end() ) {
            ret[n]++;
        }
        else
        {
            ret[n] = 1;
        }
        }
    return ret;
}

void print_map(map<ll, ll> mp){
    for(auto itr = mp.begin(); itr != mp.end(); ++itr) {
        std::cout << "key = " << itr->first           // キーを表示
                        << ", val = " << itr->second << "\n";    // 値を表示
    }
}

// Returns nCr % p
ll nCrModp(ll n, ll r, ll p)
{
    ll C[r+1];
    memset(C, 0, sizeof(C));

    C[0] = 1;

    for (ll i = 1; i <= n; i++)
    {
        for (ll j = min(i, r); j > 0; j--)
            C[j] = (C[j] + C[j-1])%p;
    }
    return C[r];
}

ll hantokei(ll a, ll b, ll L) {
    ll count = 0;
    while (a % L != b)
    {
        a++;
        count++;
    }
    return count;
}

ll  tokei(ll a, ll b, ll L) {
    ll count = 0;
    while (a != b) {
        if (a == 0) {
            a = L;
        }
        a--;
        count++;
    }
    return count;
}

int main()
{
    ll N, H, W;
    cin >> N >> H >> W;

    cout << (N-H + 1) * (N - W + 1) << endl;
    return 0;
}



Measured memory_bytes: 256
# include<bits/stdc++.h>
# define LL long long
using namespace std;
const int mod=1e9+7,MAX=4e3+5,MAXN=2e5+1,TT=2e3+1;
const LL inv2=5e8+4;
struct p{
	int a,b;
}a[MAXN];
int n;
LL ans;
LL c[MAX][MAX],cc[MAX][MAX];
int main()
{
	
	scanf("%d",&n);
	for(int i=1;i<=n;++i)
	  scanf("%d%d",&a[i].a,&a[i].b),++c[TT-a[i].a][TT-a[i].b];
	cc[1][1]=1;
	for(int i=1;i<MAX;++i)
	  for(int j=1;j<MAX;++j)
	    if(i!=1||j!=1) cc[i][j]=(cc[i-1][j]+cc[i][j-1])%mod,c[i][j]=(c[i][j]+c[i-1][j]+c[i][j-1])%mod;
	for(int i=1;i<=n;++i)
	  ans=(ans+c[TT+a[i].a][TT+a[i].b]-cc[a[i].a+a[i].a+1][a[i].b+a[i].b+1]+mod)%mod;
	return printf("%lld",ans*inv2%mod),0;
}

Measured memory_bytes: 252416
/**
 * Author: Martin Leshko (leshko.martin@gmail.com)
 */
#include <bits/stdc++.h>

using namespace std;

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


Measured memory_bytes: 256
# input()
# int(input())
# map(int, input().split())
# list(map(int, input().split()))
# list(map(int, list(input()))) # スペースがない数字リストを読み込み
import math
import fractions
import sys
import bisect
import heapq  # 優先度付きキュー(最小値取り出し)
import collections
from collections import Counter
from collections import deque
import pprint
import itertools

sr = lambda: input()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

"""nを素因数分解"""
"""2以上の整数n => [[素因数, 指数], ...]の2次元リスト"""


def factorization(n):
    arr = []
    temp = n
    if n == 1:
        return arr

    for i in range(2, int(-(-n ** 0.5 // 1)) + 1):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr.append([i, cnt])

    if temp != 1:
        arr.append([temp, 1])

    if arr == []:
        arr.append([n, 1])

    return arr


# a^n
def power(a, n, mod):
    x = 1
    while n:
        if n & 1:
            x *= a % mod
        n >>= 1
        a *= a % mod
    return x % mod


# n*(n-1)*...*(l+1)*l
def kaijo(n, l, mod):
    if n == 0:
        return 1
    a = n
    tmp = n - 1
    while (tmp >= l):
        a = a * tmp % mod
        tmp -= 1
    return a

# Union Find
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())


inf = 10 ** 18
mod = 10 ** 9 + 7

h,w = lr()
n = ir()
a = lr()
ans = [[-1 for j in range(w)] for i in range(h)]
now = 1
nowa = 0
i = 0
j = 0
for i in range(h):
    for j in range(w):
        if i%2==0:
            ans[i][j] = now
        else:
            ans[i][w-1-j] = now
        a[nowa]-=1
        if a[nowa] == 0:
            now+=1
            nowa+=1
for i in range(h):
    print(*ans[i], sep = ' ')


Measured memory_bytes: 79624
#include<iostream>

using namespace std;

int main(){
	int N, D, X, A, i, sum=0;
	cin >> N >> D >> X;
	for (i = 0; i < N; i++){
		cin >> A;
		sum += ((D - 1) / A) + 1;
	}
	sum += X;
	cout << sum << endl;
	return 0;
}

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

using namespace std;

void solve()
{
	string str;
	cin >> str;
	if(str[0] == str[str.size() - 1] && str[0] == 'x')
	{
		cout << "x" << endl;
	}
	else
	{
		cout << "o" << endl;
	}
}

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

Measured memory_bytes: 1176
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  vector<int> D(N);
  int count= 1;
  
  for (int i = 0; i < N; i++)
    cin >> D.at(i);
  
  sort(D.begin(), D.end());
  
  for (int i = 0; i < N-1; i++){
   if(D.at(i) < D.at(i+1) )
     count++;
  }
  

  cout << count << endl;
}

Measured memory_bytes: 3620
#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <set>

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,j) FOR(i,0,j)
#define mp std::make_pair

const int INF = 1 << 24;
const int dx[8] = {0, 0, 1, -1, 1, 1, -1, -1}, dy[8] = {1, -1, 0, 0, 1, -1, 1, -1};

typedef unsigned long long ull;
typedef std::pair<int,int> P;

int H, W, C;
char map[8][8];

void changeColor(char (&a)[8][8], int color){
    int used[8][8];
    REP(i, 8){
        REP(j, 8){
            used[i][j] = 0;
        }
    }

    std::queue<P> q;
    q.push(mp(0, 0));

    char headColor = a[0][0];
    while(!q.empty()){
        P p = q.front(); q.pop();

        if(used[p.second][p.first]){continue;}
        a[p.second][p.first] = color + '0';
        used[p.second][p.first] = 1;
        
        REP(i, 4){
            int nx = p.first + dx[i], ny = p.second + dy[i];
            if(0 <= nx && nx < W && 0 <= ny && ny < H && 
               !used[ny][nx] && a[ny][nx] == headColor){
                q.push(mp(nx, ny));
            }
        }
    }
}

int count(char (&a)[8][8]){
    int used[8][8];
    REP(i, 8){
        REP(j, 8){
            used[i][j] = 0;
        }
    }

    std::queue<P> q;
    q.push(mp(0, 0));

    int res = 0;
    while(!q.empty()){
        P p = q.front(); q.pop();

        if(used[p.second][p.first]){continue;}
        res++;
        used[p.second][p.first] = 1;
        
        REP(i, 4){
            int nx = p.first + dx[i], ny = p.second + dy[i];
            if(0 <= nx && nx < W && 0 <= ny && ny < H && 
               !used[ny][nx] && a[ny][nx] == a[0][0]){
                q.push(mp(nx, ny));
            }
        }
    }

    return res;
}

int main(){
    while(std::cin >> H >> W >> C, H){
        REP(i, H){
            REP(j, W){
                std::cin >> map[i][j];
            }
        }

        // char _map[8][8];
        // REP(y, H){
        //     REP(x, W){
        //         _map[y][x] = map[y][x];
        //     }
        // }

        // changeColor(_map, 6);

        // REP(i, H){
        //     REP(j, W){
        //         putchar(_map[i][j]);
        //     }
        //     puts("");
        // }
        
        int res = 0;
        FOR(i, 1, 7){
            FOR(j, 1, 7){
                FOR(k, 1, 7){
                    FOR(l, 1, 7){
                        char _map[8][8];
                        REP(y, H){
                            REP(x, W){
                                _map[y][x] = map[y][x];
                            }
                        }

                        changeColor(_map, i);
                        changeColor(_map, j);
                        changeColor(_map, k);
                        changeColor(_map, l);
                        changeColor(_map, C);

                        res = std::max(res, count(_map));
                    }
                }
            }
        }

        std::cout << res << std::endl;
    }
}

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

#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define lfs <<fixed<<setprecision(10)<<
#define test cout<<"test"<<endl;
#define fi first
#define se second
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define rep(i,n,m) for(ll i = n; i < (ll)(m); i++)
#define rrep(i,n,m) for(ll i = n - 1; i >= (ll)(m); i--)
typedef long long ll;
typedef long double ld;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const ll INF = 1e18;
using P = pair<ll, ll>;
template<typename T>
void chmin(T &a,T b){if(a>b)a=b;}
template<typename T>
void chmax(T &a,T b){if(a<b)a=b;}
void pmod(ll &a,ll b){a=(a+b)%MOD;}
void pmod(ll &a,ll b,ll c){a=(b+c)%MOD;}
void qmod(ll &a,ll b){a=(a*b)%MOD;}
void qmod(ll &a,ll b,ll c){a=(b*c)%MOD;}
ll median(ll a,ll b, ll c){return a+b+c-max({a,b,c})-min({a,b,c});}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
template<typename T1,typename T2>
void ans(bool x,T1 y,T2 z){if(x)cout<<y<<endl;else cout<<z<<endl;}  
template<typename T>
void debug(vector<vector<T>>v,ll h,ll w){for(ll i=0;i<h;i++)
{cout<<v[i][0];for(ll j=1;j<w;j++)cout spa v[i][j];cout<<endl;}};
void debug(vector<string>v,ll h,ll w){for(ll i=0;i<h;i++)
{for(ll j=0;j<w;j++)cout<<v[i][j];cout<<endl;}};
template<typename T>
void debug(vector<T>v,ll n){cout<<v[0];
for(ll i=1;i<n;i++)cout spa v[i];cout<<endl;};
template<typename T>
vector<vector<T>>vec(ll x, ll y, T w){
  vector<vector<T>>v(x,vector<T>(y,w));return v;}
ll gcd(ll x,ll y){ll r;while(y!=0&&(r=x%y)!=0){x=y;y=r;}return y==0?x:y;}
template<typename T>
void emp(map<T,ll>&m, T x){m.emplace(x,0).first->second++;}
vector<ll>dx={1,0,-1,0,1,1,-1,-1};
vector<ll>dy={0,1,0,-1,1,-1,1,-1};

int main(){
  cin.tie(NULL);
  ios_base::sync_with_stdio(false);
  ll res=0,res1=INF,res2=-INF,buf=0;
  bool judge = true;
  ll n;cin>>n;
  ll m=pow(2,n);
  vector<ll>a(m);
  rep(i,0,m)cin>>a[i];
  sort(ALLR(a));
  multiset<ll,greater<ll>>s,t;
  s.insert(a[0]);
  rep(i,1,m){
    t.insert(a[i]);
    //cout<<a[i]<<endl;
  }
  ll x=1;
  //cout<<t.size()<<endl;
  //for(auto z:t)cout<<z<<endl;
  //cout<<*s.begin()<<endl;
  rep(i,0,n){
    multiset<ll,greater<ll>>tmp;
    for(auto z:s){
      auto itr=t.upper_bound(z);
      //cout<<x spa z spa *itr spa t.size()<<endl;
      if(itr==t.end()){
        //cout<<x spa z<<endl;
        judge=false;break;
      }
      tmp.insert(*itr);
      t.erase(itr);
    }
    if(!judge)break;
    for(auto z:tmp)s.insert(z);
  }
  ans1(judge);
  //cout<<t.size()<<endl;
  //for(auto z:t)cout<<z<<endl;
  return 0;
}

Measured memory_bytes: 20736
#include <iostream>
#include <bits/stdc++.h>
typedef long long ll;
typedef unsigned long long int ulli;
#define FASTIO ios_base::sync_with_stdio(false);cin.tie(NULL);
using namespace std;
/* TUMSE NAA HO PAAYEGA HAR DO DIN MAI LAGEGA
   LEKIN RUKNE KA NAHI :P */

int main() {
	// your code goes here
	FASTIO
	string s;
	cin >> s;
	int n=s.length();
	if(s[n-1]=='s')
	    cout << s << "es";
	else
	    cout << s << "s";
	return 0;
}


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

#define PI 3.14159265359
#define MODULO 1000000007

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vii;

int main () {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int x, n;
  int index;
  int diff = 101;
  cin >> x >> n; 
  vi v(102);
  for(int i =0; i<n;i++){
    int k;
    cin >> k;
    v[k] = !!k;
  }
  for(int i =0; i<102;i++){
    if(v[i] == 0){
      if( abs(i-x) <diff){
        diff = abs(i-x);
        index = i;
      }
    }
  }
  cout << index;
}

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

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
typedef long long ll;
//typedef long long int;
const ll M = 1000000007;
ll A, B, C, D, G, H, N, L, K, P, Q, R, W, X, Y, Z;
string S, T;

signed main(){
	std::cin >> N>>S;
    if(N%2>0) cout<<"No"<<endl;
    else{
      if (S.substr(0,N/2)==S.substr(N/2,N))
        cout<<"Yes"<<endl;
      else cout<<"No"<<endl;}
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline

def gcd(a, b):
    while a > 0:
        if a < b:
            a, b = b, a
        a = a % b
    return b

def main():
    n, x = map(int, input().split())
    town = map(int, input().split())

    distance = (abs(x-y) for y in town)
    res = next(distance)
    for d in distance:
        if d % res != 0:
            res = gcd(res, d)

    print(res)

if __name__ == "__main__":
    main()

Measured memory_bytes: 11172
#define _USE_MATH_DEFINES
#include <algorithm>
#include <cstdio>
#include <fstream>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<ll, int> ll_i;
typedef pair<double, int> d_i;
typedef pair<ll, ll> ll_ll;
typedef pair<double, double> d_d;
struct edge { int u, v; ll w; };
 
ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;
 
struct union_find {
    vector<int> v;
    union_find(int n) : v(n, -1) {}
    int find(int x) { return (v[x] < 0) ? x : (v[x] = find(v[x])); }
    void unite(int x, int y) {
        x = find(x); y = find(y);
        if (x != y) {
            if (-v[x] < -v[y]) swap(x, y);
            v[x] += v[y]; v[y] = x;
        }
    }
    bool same(int x, int y) { return find(x) == find(y); }
    int size(int x) { return -v[find(x)]; }
};
 
int main() {
    int n; cin >> n;
    vector< vector<bool> > a(n, vector<bool>(n));
    for (int i = 0; i < n; i++) {
        string s; cin >> s;
        for (int j = 0; j < n; j++) a[i][j] = (s[j] == 'Y');
    }
    int m = 0;
    union_find uf(n);
    for (int i = 0; i < n; i++)
        for (int j = i + 1; j < n; j++)
            if (a[i][j]) {
                m++;
                uf.unite(i, j);
            }
    int x = n * (n - 1) / 2 - m;
    if (n % 2 == 0) {
        int y = 0, e = 0, o = 0;
        for (int i = 0; i < n; i++)
            if (uf.find(i) == i) {
                int k = uf.size(i);
                y += k * (k - 1) / 2;
                if (k % 2 == 0) e++;
                else o++;
            }
        y -= m;
        if (x % 2 == 0) cout << (y % 2 == 1 && e <= 1 ? "Taro" : "Hanako") << endl;
        else cout << ((e == 0 && y % 2 == 1) || e >= 1 ? "Taro" : "Hanako") << endl;
    }
    else cout << (x % 2 == 0 ? "Hanako" : "Taro") << endl;
}

Measured memory_bytes: 1376
import sys
from operator import itemgetter
from collections import deque


def solve():
    N, D, A = map(int, sys.stdin.readline().split())
    m = map(int, sys.stdin.read().split())
    XH = sorted(list(zip(m, m)), key=itemgetter(0))
    H = deque()
    X = deque()
    h_popleft = H.popleft
    x_popleft = X.popleft
    h_append = H.append
    x_append = X.append
    count = 0
    num = 0
    for x, h in XH:
        while X and X[0] < x:
            x_popleft()
            num -= (h_popleft() + (A - 1)) // A
        h -= A * num
        if h > 0:
            count += (h + (A - 1)) // A
            x_append(x + D*2)
            h_append(h)
            num += (h + (A - 1)) // A
    return count


if __name__ == '__main__':
    answer = solve()
    print(answer)


Measured memory_bytes: 59152
#include <bits/stdc++.h>
using namespace std;
using Int = int_fast64_t;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n, m; cin >> n >> m;
	cout << n * (n-1) / 2 + m * (m-1) / 2 << "\n";
}

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

int main() {
  
  int A,B;
  cin >> A >> B;
  int AA=A;
  int BB=B;
  
  int x=1;
  while (AA/10!=0) {
    x++;
    AA/=10;
  }
  // AA(==A)はx桁の整数
  
  int y=1;
  while (BB/10!=0) {
    y++;
    BB/=10;
  }
  // BB(==B)はy桁の整数
  
  
  int s;
  if (x==1 && y==1) s=B-A+1;
  if (x==1 && y!=1) s=9-A+1;
  if (x!=1 && y!=1) s=0;
  for (int i=0; i<y-x+1; i++) {
    
    int a=1;
    for (int i=0; i<x-1; i++) {
      a*=10;
    }
    // aは10の(x-1)乗
     
    while (a<=A && A<a*10 && A<=B) {
      int v=1;
      int u=1;
      int t=x/2-1;
      for (int j=0; j<t+1; j++) {
        if (j==0) {
          if (A/a==A%10) u*=1;
          else {
            u*=0;
            break;
          }
        }
    
        else {
          if (A/(a/v)%v==A%(v*10)/v) u*=1;
          else {
          u*=0;
          break;
          }
        }           
        
        v*=10;
      }
      if (t>=0 && u==1) s+=1;
      A++;
    }
    x++;
  }
  
  cout << s << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using i64 = long long;

int main() {
    int n;
    std::cin >> n;
    int ret = 0;
    for (int i = 1; i <= n; i++) if (std::to_string(i).length() % 2) ret++;
    std::cout << ret << std::endl;

    return 0;
}


Measured memory_bytes: 256
n = int(input())
dp = [0]*(n+1)

def calc(n):
    global dp
    for i in range(n+1):
        if i == 0:
            dp[i] = 1
        elif i == 1:
            dp[i] = 1
        else:
            dp[i] = dp[i-1] + dp[i-2]

def fibonacci(n):
    if n == 0:
        return 1
    if n == 1:
        return 1
    else:
        return fibonacci(n-1) + fibonacci(n-2)

#print(fibonacci(n))
calc(n)
print(dp[n])



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


Measured memory_bytes: 3080
#include <iostream>
#include <stdio.h>
#include <string>
#include <cmath>
using namespace std;

int main() {
    int a,b, x=0;
    cin >> a>>b;
    double p = a * 100. / 8., q = (a + 1) * 100. / 8., r = b * 10., s = (b + 1) * 10.;
    int c = a * 100 / 8, d = (b+1) * 10;
    for (int i = c; i < d;++i) {
        double j = 1.0 * i;
        if (j >= p && j < q && j >= r && j < s) {
            cout << i << endl; 
            x += 1;
            break;
        }   
    }
    if (x == 0) cout << -1 << endl;
}

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

using namespace std;

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

	int a[100000], b[100000];
	for (int i = 0; i < n; ++i) {
		cin >> a[i] >> b[i];
	}
	int num = 0;
	int ii = 0;
	for (int i = 0; i < n; ++i) {
		if (num < a[i]) {
			num = a[i];
			ii = i;
		}
	}
	cout << a[ii] + b[ii] << endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <cmath>
#include <string>
#include <sstream>
#include <iomanip>
#include <complex>
using namespace std;

#define ll long long
#define vvi vector< vector<int> >
#define vi vector<int>
#define All(X) X.begin(),X.end()
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back
#define pii pair<int,int>
#define mp make_pair
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;}

int main(){
	int a,b;
	cin >> a >> b;
	if(a==b) cout << "a == b" << endl;
	else cout << (a<b ? "a < b" : "a > b") << endl;
	/*
	if(a==b) cout << "a == b" << endl;
	else if (a<b) cout << "a < b" << endl;
	else cout << "a > b" << endl;
	*/
}

Measured memory_bytes: 1156
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;

int N;
int mod = 1e9 + 7;

int main() {
    cin >> N;
    vector<int> h(N);
    int count = 0;
    for (int i = 0; i < N; i++) {
        cin >> h[i];
    }
    for (int i = 1; i <= 100; i++) {
        if (h[0] >= i) {
            count++;
        }
        for (int j = 1; j < N; j++) {
            if (h[j] >= i && h[j - 1] < i) {
                count++;
            }
        }
    }
    cout << count << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<cstring>
#include<cmath>
#include<ctime>
#include<algorithm>
#include<utility>
#include<stack>
#include<queue>
#include<vector>
#include<set>
#include<map>
#define EPS 1e-9
#define PI acos(-1.0)
#define INF 0x3f3f3f3f
#define LL long long
const int MOD = 1E9+7;
const int N = 4000+5;
const int dx[] = {0,0,-1,1,-1,-1,1,1};
const int dy[] = {-1,1,0,0,-1,1,-1,1};
using namespace std;
bool vis[10];
bool judge(int x){
    while(x){
        int temp=x%10;
        if(vis[temp])
            return false;
        x/=10;
    }
    return true;
}
int main(){
    int n,k;
    scanf("%d%d",&n,&k);

    memset(vis,false,sizeof(vis));
    for(int i=1; i<=k; i++){
        int x;
        scanf("%d",&x);
        vis[x]=true;
    }

    for(int i=n; ; i++){
        if(judge(i)){
            printf("%d\n",i);
            break;
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define print(s) cout << s << endl
#define acc(v) accumulate(v.begin(), v.end(), 0)
#define cinv(n,v) rep(i,n) cin >> v[i]
using namespace std;
const int INF = 1e9;
typedef long long ll;
typedef vector<int> vint;
typedef vector<string> vstr;
typedef vector<char> vchar;
const ll LINF = 1e18;
const ll MOD = 1e9 + 7;
// const lint MOD = 998244353;
int x_pos[4] = {1,0,-1,0}, y_pos[4] = {0,1,0,-1};
int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}
char upper(char c){
	return c-0x20;
}
char lower(char c){
	return c+0x20;
}

int gcd(int x, int y) {
  if (y == 0) return x;
  return gcd(y, x%y);
}

int main(){
	int a,b,c; cin >> a >> b >> c;
	vector<int> li(3);
	li[0] = a%2;
	li[1] = b%2;
	li[2] = c%2;
	vector<int> li2(3);
	li2[0] = a;
	li2[1] = b;
	li2[2] = c;
	int x = 0;
	if (acc(li)==3 || acc(li)==0){
		int m = *max_element(all(li2));
		x = (3*m-a-b-c)/2;
	}else if(acc(li)==1){
		rep(i,3){
			if (li[i]==0) li2[i]++;
		}
		int m = *max_element(all(li2));
		x = (3*m-acc(li2))/2+1;
	}else{
		rep(i,3){
			if (li[i]==1) li2[i]++;
		}
		int m = *max_element(all(li2));
		x = (3*m-(acc(li2)))/2+1;
	}
	cout << x << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <stdio.h>
#include <cstdlib>

static const int MAX = 200000;
using namespace std;

int S[MAX], top=0;

void push(int x){
  S[++top] = x;
}

int pop(){
  top--;
  return S[top+1];
}

int main(int argc, const char * argv[]) {
  int a, b;
  top = 0;
  
  char s[100];
  while(cin >> s){
    if(cin.eof())
      break;
    if(s[0] == '+'){
      a = pop();
      b = pop();
      push(a + b);
    } else if(s[0] == '-'){
      b = pop();
      a = pop();
      push(a - b);
    } else if(s[0] == '*'){
      a = pop();
      b = pop();
      push(a * b);
    } else{
      push(atoi(s));
    }
  }
  printf("%d\n", pop());
  return 0;
}



Measured memory_bytes: 3220
import java.util.Scanner;

public class Main {
	public static void main(String[] args)
	{
		Scanner stdIn = new Scanner(System.in);
		
		int n = stdIn.nextInt();
		int m = stdIn.nextInt();
		int l = stdIn.nextInt();
		
		int[][] a = new int[n][m];
		int[][] b = new int[m][l];
		long[][] c = new long[n][l];
		
		for(int i=0;i<n;i++)
		{
			for(int j=0;j<m;j++)
			{
				a[i][j] = stdIn.nextInt();
			}
		}
		for(int i=0;i<m;i++)
		{
			for(int j=0;j<l;j++)
			{
				b[i][j] = stdIn.nextInt();
			}
		}
		
		for(int i=0;i<n;i++)
		{
			for(int j=0;j<l;j++)
			{
				c[i][j] =0;
				for(int k=0;k<m;k++)
				{
					c[i][j]+=a[i][k]*b[k][j];
				}
				System.out.print(c[i][j]);
				if(j!=l-1)
				{
					System.out.print(" ");
				}
			}
			System.out.println();
		}
		
	}
}

Measured memory_bytes: 44888
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int INF = 1LL<<60;
const int MOD = (int)1e9 + 7;


signed main() {
    int n, k;
    cin >> n >> k;
    vector<int> v(n);
    for (int i = 0; i < n; i++) {
        cin >> v[i];
    }
    vector<int> dp(n);
    for (int i = 0; i < n; i++) {
        if (i == 0) {
            dp[i] = 0;
            continue;
        }
        int min_v = INF;
        for (int j = 1; j < k + 1; j++) {
            if (i < j) break;
            min_v = min(dp[i - j] + abs(v[i] - v[i - j]), min_v);
        }
        dp[i] = min_v;
    }
    cout << dp[n - 1] << "\n";
}

Measured memory_bytes: 1792
#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); }
ll fceil(ll a, ll b) { return (a % b == 0 ? a / b : a / b + 1); }
int main()
{
   int n, s = 0;
   string ans = "No";
   cin >> n;
   int tmp = n;
   while (tmp > 0)
   {
      s += tmp % 10;
      tmp /= 10;
   }
   if(n%s==0)
      ans = "Yes";
   cout << ans << endl;
   return 0;
}


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

using ll = long long;
using pii = pair<ll, ll>;
using vi = vector<ll>;
using vvi = vector<vi>;

template <class T>
using max_heap = priority_queue<T>;
template <class T>
using min_heap = priority_queue<T, vector<T>, greater<T>>;

template <class T, class U>
void chmax(T &a, U b) {
    if (a < b) a = b;
}
template <class T, class U>
void chmin(T &a, U b) {
    if (b < a) a = b;
}

#define rep(i, j) for (int i = 0; i < j; i++)
#define all(obj) (obj).begin(), (obj).end()
#define rall(obj) (obj).rbegin(), (obj).rend()
#define debug(x) cerr << #x << ": " << x << endl;
#define int ll

const ll mod = 1e9 + 7;
const ll inf = (1LL << 50);

void solve(long long N, std::vector<long long> A) {
    int ans = 0;
    map<int, int> mp;
    ll sum = 0;
    mp[0] = 1;
    rep(i, N) {
        sum += A[i];
        ans += mp[sum];
        mp[sum]++;
    }
    cout << ans << endl;
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(10);
    cout << fixed;

    long long N;
    scanf("%lld", &N);
    std::vector<long long> A(N);
    for (int i = 0; i < N; i++) {
        scanf("%lld", &A[i]);
    }
    solve(N, std::move(A));
    return 0;
}


Measured memory_bytes: 14336
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inpl(): return list(map(int, input().split()))
def inpl_s(): return list(input().split())

N,M = inpl()

if N >= 2 and M >= 2:
	print((N-2)*(M-2))
elif N == 1 and M == 1:
	print(1)
else:
	print((N+M-1)-2)


Measured memory_bytes: 4208
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
	private final static byte MASK_RIGHT = 0x0F; //右4bit数値化用マスク
	private final static int STRIP_LENGTH = 10; //短冊1行の長さ
	private static int[] punchTape = new int[100]; //10*10の方眼紙を短冊にしてくっつけた紙テープ

	public static void main(String[] args) throws Exception {
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in), 256);
		String sLine;
		while ((sLine = reader.readLine()) != null) {
			droppingInk(sLine.charAt(0) & MASK_RIGHT, sLine.charAt(2) & MASK_RIGHT, sLine.charAt(4) & MASK_RIGHT);
		}
		calcResult();
	}

	/**
	 *都合の良い滴下
	 */
	private static void droppingInk(int x, int y, int size) {
		sinking(x, y - 1);
		sinking(x - 1, y);
		sinking(x, y);
		sinking(x + 1, y);
		sinking(x, y + 1);
		if (size == 1) {
			return;
		}

		sinking(x - 1, y - 1);
		sinking(x + 1, y - 1);
		sinking(x - 1, y + 1);
		sinking(x + 1, y + 1);
		if (size == 2) {
			return;
		}

		sinking(x, y - 2);
		sinking(x - 2, y);
		sinking(x + 2, y);
		sinking(x, y + 2);
	}

	/**
	 * 床は汚さないようにする
	 */
	private static void sinking(int x, int y) {
		if (x >= 0 && x < 10 && y >= 0 && y < 10) {
			punchTape[x * STRIP_LENGTH + y]++;
		}
	}

	/**
	 *紙の染みを数え、損害を報告する
	 */
	private static void calcResult() {
		int white = 0;//綺麗な部分
		int max = 0;//一番ひどい汚れ
		for (int cell : punchTape) {
			if (cell == 0) {
				white++;
			} else if (cell > max) {
				max = cell;
			}
		}
		System.out.println(white);
		System.out.println(max);
	}
}

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

int main() {
	int n;
  	char c;
  	unordered_set<char> s;
  	cin >> n;
  	while (n--) {
    	cin >> c;
      	s.insert(c);
    }
  	cout << (s.size() == 3 ? "Three" : "Four");
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc *bufio.Scanner = func() *bufio.Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	return sc
}()

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	a, b := nextInt(), nextInt()

	isInRange := func(i int) bool {
		return i >= 1 && i <= 9
	}

	if isInRange(a) && isInRange(b) {
		fmt.Println(a * b)
	} else {
		fmt.Println(-1)
	}
}


Measured memory_bytes: 640