akhauriyash/Code-Regression huggingface dataset:
import sys
import math
import fractions
import bisect
import queue
import heapq
import collections
import itertools
sys.setrecursionlimit(4100000)

MOD = int(1e9+7)
PI = 3.14159265358979323846264338327950288
INF = 1e18

'''　標準入力
1行のint=====================================
N, K = map(int, input().split())

1行のstring=================================
S, T = input().split()

1行の整数配列================================
A = list(map(int,input().split()))

改行あり整数==================================
X = []
Y = []
for i in range(N):
    x1,y1=[int(i) for i in input().split()]
    X.append(x1)
    Y.append(y1)
    
2次元整数配列=====================================
A = []
for i in range(N):
    tmp = list(map(int,input().split()))
    A.append(tmp)


N行M列の初期化====================================
dp = [[VAL] * RETU for i in range(GYO)]

'''


N = int(input())
A = list(map(int,input().split()))

B = A.copy()
B.reverse()

upper = [0] * (N+1)
upper[0] = B[0]
for i in range(N):
    upper[i + 1] = upper[i] + B[i+1]
upper.reverse()

V = [0] * (N+1)
if A[0] == 1:
    if N >= 1:
        print(-1)
        sys.exit()
    elif N == 0:
        print(1)
        sys.exit()

if A[0] > 1:
    print(-1)
    sys.exit()

V[0] = 1
for d in range(1, N + 1):
    can = min((V[d-1] - A[d-1]) * 2, upper[d])
    least = V[d-1] - A[d-1]

    if A[d] > can or least > can:
        print(-1)
        sys.exit()

    V[d] = can

V[N] = A[N]

ans = 0
for v in V:
    ans += v

print(ans)











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

int main() {
  const ll m = 998244353;
  ll n, s;
  cin >> n >> s;
  vector<ll> a(n);
  rep(i, n) cin >> a[i];

  vector<vector<ll>> dp(n+1, vector<ll>(s+1, 0));
  dp[0][0] = 1;
  rep(i, n) {
    rep(j, s+1) {
      dp[i + 1][j] += (dp[i][j] * 2) % m;
      dp[i + 1][j] %= m;
      int nj = j + a[i];
      if(nj <= s) {
        dp[i + 1][nj] += dp[i][j];
        dp[i + 1][nj] %= m;
      }
    }
  }

  cout << dp[n][s] << endl;
  return 0;
}

Measured memory_bytes: 73724
#include<bits/stdc++.h>
#include <iomanip>
#define ll long long int
#define ld long double
#define IOS cin.tie(NULL);cout.tie(NULL)
#define f first
#define inf 100000000000000000
#define ii pair<ll,ll>
#define vi vector<ll>
#define vii vector<ii>
#define MS0(x) memset(x,0,sizeof(x))
#define MS1(x) memset(x,-1,sizeof(x))
#define sc(i) scanf("%lld",&i);
#define s second
#define pb push_back
#define forn(i,n) for(int i=0;i<(int)n;i++)
using namespace std;
ll const mod=1000000007;
ll gcdfun(ll a , ll b)
{
   if(b==0) return a;
   a%=b;
   return gcdfun(b,a);
}
// int arr1[1000109];
// set<ll> sieve;
// void sievefun(ll n){
//     for(ll i=2;i<=n;i++){
//         if(arr1[i]==0){
//             for(ll j=i*i;j<=n;j+=i){
//                 arr1[j]=1;
//             }
//         }
//     }
//     for(ll i=2;i<=n;i++){
//     	if(arr1[i]==0)sieve.insert(i);
//     }
// }
ll power(ll x, ll y,ll m) {
	ll temp;
	if( y == 0)
		return 1;
	temp = power(x, y/2,m)%m;
	if (y%2 == 0)
		return ((temp)*(temp))%m;
	else
		return (((x)%m)*((temp*temp)%m))%m;
}

ll a[1000009]; 
ll p[200009];
ll val[200009];
ll tree[5000009];
ll num=1000000000;
// void build(int node,int start,int end){
// 	int mid=(start+end)/2;
// 	if(start==end){
// 		tree[node].val=a[start];
// 		tree[node].cnt=1;
// 		return ;
// 	}
// 	build(2*node,start,mid);
// 	build(2*node+1,mid+1,end);
// 	ll temp=gcdfun(tree[2*node].val,tree[2*node+1].val);
// 	tree[node].val=temp;
// 	if(temp==tree[2*node].val)tree[node].cnt+=tree[2*node].cnt;
// 	if(temp==tree[2*node+1].val)tree[node].cnt+=tree[2*node+1].cnt;
	
// }
void update(int node,int start,int end,int index,ll num){
	int mid=(start+end)/2;
	if(start==end){
		tree[node]+=num;
		return ;
	}
	if(start<=index&&index<=mid){
		update(2*node,start,mid,index,num);
	}
	if(index>mid&&index<=end){
		update(2*node+1,mid+1,end,index,num);
	}
	tree[node]=max(tree[2*node],tree[2*node+1]);
}
ll query(int node,int start,int end,int l,int r){
	int mid=(start+end)/2;
	if(start>=l&&end<=r)return tree[node];
	if(start>r||end<l){
		return 0;
	}
	ll L=query(2*node,start,mid,l,r);
	ll R=query(2*node+1,mid+1,end,l,r);
	return max(L,R);
}

int main()
{	//sievefun(100000);
	// cout << fixed << setprecision(10);
	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	ll T;
	// cin>>T;
	T=1;
	

	forn(_,T){
		ll n;
		cin>>n;
		forn(i,n)cin>>p[i];
		forn(i,n)cin>>val[i];
		ll out=0;
		forn(i,n){
			if(p[i]==1){
				update(1,1,n,1,val[i]);
				out=max(out,val[i]);
				continue;
			}
			ll ans=query(1,1,n,1,p[i]-1);
			ans+=val[i];
			// cout<<ans<<"\n";
			out=max(out,ans);
			update(1,1,n,p[i],ans);
		}
		cout<<out<<"\n";

	}

}

Measured memory_bytes: 10496
/*Knapsack problem
Input:
N W
w1 v1
w2 v2
.
.
.
wn vn 

Output: print ma possible sum of the values if time that knapsack of capacity W can contain.
*/

#include<bits/stdc++.h>
using namespace std;

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
 
using ll = long long;
const ll INF=1e18L + 5;
const int nax = 405;
vector<vector<ll>> dp(nax, vector<ll> (nax, INF));

int main(){
	int n;
	cin >> n;
	ll a[n];
	for(int i = 0; i < n; ++i) {
		cin >> a[i];
	}
	
	auto sum = [&](int l, int r) {
		ll s = 0;
		for(int i = l; i <= r; ++i) {
			s += a[i];
		}
		return s;
	};
	
	for(int l = n - 1; l >= 0; --l) {
		for(int r = l; r < n; ++r) {
			if(l == r) {
				dp[l][r] = 0;
			}
			else{
				ll s = sum(l, r);
				for(int i = l; i <= r - 1; ++i) {
					dp[l][r] = min(dp[l][r], dp[l][i] + dp[i+1][r] + s);
				}
			}
		}
	}
	
	printf("%lld\n", dp[0][n-1]);
	
}


Measured memory_bytes: 1536
#include <bits/stdc++.h>
using namespace std;
constexpr int N = 200'225, P = 1000'000'007;
vector<int> g[N];
int sz[N], p2[N],  n, ans, inv2 = (P + 1) / 2;
int dfs(int u, int p) {
  sz[u] = 1;
  for (int v : g[u])
    if (v != p)
      sz[u] += dfs(v, u);
  if (p != 0)
    ans = (ans + (int64_t) (1 + P - p2[sz[u]]) * (1 + P - p2[n - sz[u]]) % P) % P;
  return sz[u];
}
int main() {
  p2[0] = 1;
  for (int i = 1; i < N; ++i)
    p2[i] = (int64_t) p2[i - 1] * inv2 % P;
  cin >> n;
  ans = (P - (int64_t)n * inv2 % P) % P;
  for (int i = 1, v, u; i < n; ++i) {
    cin >> v >> u;
    g[v].push_back(u);
    g[u].push_back(v);
  }
  dfs(1, 0);
  cout << (int64_t)(ans + (int64_t)(1 + P - p2[n]) % P) % P << '\n';
}

Measured memory_bytes: 19456
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <utility>
#include <bitset>

using namespace std;
#define LL long long
#define pb push_back
#define mk make_pair
#define pill pair<int, int>
#define mst(a, b)	memset(a, b, sizeof a)
#define REP(i, x, n)	for(int i = x; i <= n; ++i)
const int MOD = 1e9 + 7;
const int qq = 300 + 10;
const LL INF = 1e15 + 10;
LL dis[qq][qq];

int main(){
	int n;	scanf("%d", &n);
	for(int i = 1; i <= n; ++i) {
		for(int j = 1; j <= n; ++j) {
			scanf("%lld", &dis[i][j]);
		}
	}
	bool f = true;
	for(int k = 1; k <= n; ++k) {
		for(int i = 1; i <= n; ++i) {
			for(int j = 1; j <= n; ++j) {
				if(dis[i][k] + dis[k][j] < dis[i][j]) {
					f = false;
				}
			}
		}
	}
	if(!f) {
		puts("-1");
		return 0;
	}
	LL ans = 0;
	for(int i = 1; i <= n; ++i) {
		for(int j = i + 1; j <= n; ++j) {
			LL minx = dis[i][j];
			LL xmin = INF;
			for(int k = 1; k <= n; ++k) {
				if(k == i || k == j)	continue;
				xmin = min(xmin, dis[i][k] + dis[k][j]);
			}
			if(minx < xmin)	ans += minx;
		}
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 1024
#include<iostream>
int main(){
	int na,nb;
	while(1){
		std::cin>>na>>nb;
		if(na == 0 && nb == 0) break;
		if(na < nb)
			std::cout<<na<<" "<<nb<<std::endl;
		else
			std::cout<<nb<<" "<<na<<std::endl;
	}
	return 0;
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#include <functional> // for less 
using namespace __gnu_pbds; 
#define mod 1000000007
#define int long long
#define pb push_back
#define boost ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define inp(n) for(i=0;i<n;i++) cin>>A[i];
#define inz(A) memset(A,0,sizeof(A))
#define lb lower_bound
#define ub upper_bound
#define all(v) v.begin(),v.end()
#define T 1000000
#define F first
#define S second
#define pi pair<int,int>
#define vi vector<int>
#define mii map<int,int>
#define vp vector<pair< int,int> >
#define mpi map<pair<int,int> ,int>
#define mip map<int, pair<int,int> >
#define inf INT_MAX
#define inf1 LONGLONG_MAX
#define sz(v) v.size()
#define rep(i,n) for(int i=0;i<n;i++)
#define forn(i,a,b) for(int i=a;i<=b;i++)
#define deb(x) cout<<#x<<"is "<<x<<endl;
#define lower(s) transform(all(s),s.begin(),::tolower)
#define endl "\n"
typedef tree<int, null_type, less<int>, rb_tree_tag, 
         tree_order_statistics_node_update> pbds;
   
/* brownsands :Arpit */		

void solve()
{    mii m;mii mark;int n,i,ans=0;
   cin>>n;int A[n+5];
   for(i=0;i<n;i++)
   {
      cin>>A[i];
      m[A[i]]++;
   }
   for(i=0;i<n;i++)
   {  if(mark[A[i]]==0){mark[A[i]]++;
      ans+=(m[A[i]]*(m[A[i]]-1))/2;}
   }//cout<<ans<<"::";
   for(i=0;i<n;i++)
   {
      cout<<ans -( m[A[i]]-1)<<endl;
   }
}
signed main()
{
   boost
        int test=0,t;
		//cin>>t;
		t=1;
		while(test++ <t){
            //cout<<"Case #"<<test<<": ";
            solve();
            //cerr << "\nTime : " << (double)clock() / (double)CLOCKS_PER_SEC << "s\n";
               }		
} 
               
			
 

				
		
		




Measured memory_bytes: 18944
using System;
class aoj
{
    static void Main()
    {
        int[] x = new int[10000];
        int i;
        for (i = 0; i < 10000; i++)
        {
            x[i] = int.Parse(Console.ReadLine());
            if (x[i] == 0)
            {
                break;
            }
        }
        for (int y = 0; y < i; y++) { 
            Console.WriteLine("Case " + (y+1) + ": " + x[y]);
    }
    }
}

Measured memory_bytes: 9200
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 1;i<=n;++i)
int main(){
  int n;
  cin >> n;
  rep(i,9){
    rep(j,9){
      if(n == i*j){
        puts("Yes");
        return 0;
      }
    }
  }
  puts("No");
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) FOR(i,0,n)
#define repr(i,n) for(int i=(n)-1;0<=i;--i)
#define each(e,v) for(auto&& e:(v))
#define all(v) begin(v),end(v)
#define dump(x) cerr<<#x<<": "<<(x)<<endl
using namespace std;
using vint = vector<int>;
using ll = long long;
using vll = vector<ll>;
template <class T> void chmin(T& a, const T& b) { a = min(a, b); }
template <class T> void chmax(T& a, const T& b) { a = max(a, b); }

void No() { cout << "No" << endl; exit(0); }
void Yes() { cout << "Yes" << endl; exit(0); }

int main() {
    int n; cin >> n;
    vint t(n+1, 0), x(n+1, 0), y(n+1, 0);
    FOR(i, 1, n+1) {
        cin >> t[i] >> x[i] >> y[i];
    }
    rep(i, n) {
        // (2, 3) -> (5, 5) => 3 + 2
        int dt = t[i+1] - t[i];
        int dx = x[i+1] - x[i];
        int dy = y[i+1] - y[i];
        int d = dx + dy;
        if(dt < d) No();
        if((d - dt) % 2 != 0) No();
    }
    Yes();
    return 0;
}


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

const int MAX_N = 1e5;

int n, m;
vector<int>adj[MAX_N + 7];

int main() {
    scanf("%d%d", &n, &m);
    for (int i = 0; i < m; i++) {
        int a, b;
        scanf("%d%d", &a, &b);
        a--;b--;
        adj[a].push_back(b);
        adj[b].push_back(a);
    }
    int cnt = 0;
    int sum = 0;
    vector<int> V;
    for (int i = 0; i < n; i++) {
        int k = (int)adj[i].size();
        if (k&1) {
            printf("No\n");
            return 0;
        }
        if (k > 2) {
            cnt++;
            V.push_back(i);
        }
        sum += k / 2 - 1;
    }
    if (cnt == 1)
        printf("%s\n", sum >= 2 ? "Yes" : "No");
    else if (cnt >= 3)
        printf("Yes\n");
    else if (cnt == 0)
        printf("No\n");
    else {
        if (sum >= 3)
            printf("Yes\n");
        else {
            for (int i = 0; i < 3; i++) {
                int u = V[0], v = adj[V[0]][i];
                while(1) {
                    if (v == V[0] || v == V[1])
                        break;
                    if (adj[v][0] == u) {
                        u = v;
                        v = adj[v][1];
                    }
                    else {
                        u = v;
                        v = adj[v][0];
                    }
                }
                if (v == V[0]) {
                    printf("Yes\n");
                    return 0;
                }
            }
            printf("No\n");
        }
    }
}


Measured memory_bytes: 5760
#include <iostream>
#include <cstdio>
using namespace std;
const int maxn = 101;
char color[maxn];
bool use[5];
int num[maxn];
int N;
int main()
{
	cin >> N;
	for(int i = 1;i <= N;i ++){
		cin >> color[i];
		switch(color[i]){
			case 'P' :num[i] = 1;break;
			case 'W' :num[i] = 2;break;
			case 'G' :num[i] = 3;break;
			case 'Y' :num[i] = 4;break;
		}
	}
	for(int i = 1;i <= N;i ++){
		if(use[num[i]] == 0) use[num[i]] = 1;
	}
	if(use[1] && use[2] && use[3] && use[4]) cout<<"Four\n";
	else cout<<"Three\n";
	return 0;
}

Measured memory_bytes: 256
//include
//------------------------------------------
#include <string>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>

#include <numeric>
#include <utility>
#include <complex>

#include <sstream>
#include <iostream>
#include <iomanip>

#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <ctime>

// namespace
using namespace std;

// type alias
using ll = long long;
using ull = unsigned long long;
using comp = complex<double>;

// constant
static const ll MOD = 1000000007LL;
static const double PI = 3.14159265358979323846;

// conversion
inline ll toint(string s) { ll v; istringstream sin(s); sin >> v; return v; }
template<class t> inline string tostring(t x) { ostringstream sout; sout << x; return sout.str(); }

// print
#define RET(x) return cout << x << endl, 0;

// for loop
#define REP(i, a, b) for ((i) = (ll)(a);(i) < (ll)(b);(i)++)
#define REPD(i, a, b) for (ll i = (ll)(a);(i) < (ll)(b);(i)++)
#define REPI(v, vs) for (auto& v : vs)

//debug
#define DUMP(x)  cerr << #x << " = " << (x) << endl
#define DEBUG(x) cerr << #x << " = " << (x) << " (l" << __LINE__ << ")" << " " << __FILE__ << endl

#define MAX_VALUE 9223372036854775807

inline ll get_highest_one_bit(ll a)
{
	while ((a & (a - 1)) != 0)
	{
		a = a & (a - 1);
	}
	return a;
}

int solve() {
	ll N;
	cin >> N;

	map<ll, ll> val_to_count;
	ll a, b;
	REPD(i, 0, N) {
		cin >> a;
		if (val_to_count.count(a) == 0) val_to_count[a] = 0;
		++val_to_count[a];
	}

	ll res = 0;
	vector<bool> used(N, false);
	for (auto iter = val_to_count.end(); iter != val_to_count.begin(); ) {
		--iter;
		a = iter->first;
		b = get_highest_one_bit(a) * 2LL - a;
		if (val_to_count[a] == 0) continue;
		if (val_to_count.count(b) > 0) {
			if (a != b) {
				ll count = min(val_to_count[a], val_to_count[b]);
				val_to_count[a] -= count;
				val_to_count[b] -= count;
				res += count;
			}
			else {
				ll count = val_to_count[a] / 2LL;
				val_to_count[a] -= count * 2LL;
				res += count;
			}
		}
	}

	RET(res);

	return 0;
}

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

	solve();
	// ll t;
	// cin >> t;
	// REPD(i, 0, t) solve();

	return 0;
}


Measured memory_bytes: 16192
def foo():
    for i in range(len(F)):
        for j in range(len(F)):
            if F[i] + F[j] == X:
                print(i, -j)
                return
            if F[i] - F[j] == X:
                print(i, j)
                return
X = int(input())
F = [i**5 for i in range(1000)]
flg = False
foo()

Measured memory_bytes: 63532
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define mod 1000000007ll
#define mod1 998244353ll
#define endl '\n'
#define inf ((ll)1e18+1)
#include<chrono>
using namespace chrono;
mt19937_64 rng(high_resolution_clock::now().time_since_epoch().count());
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<ll,null_type,less_equal<ll>,rb_tree_tag,tree_order_statistics_node_update>
#define deb(x) cout<<"-->  "<<#x<<" :  "<<x<<endl;
#define debr(x,y) {cout<<"-->  "<<#x<<" to "<<#y<<" :  "; auto itr=x; while(itr!=y) cout<<(*itr++)<<' '; cout<<endl; }
#define deba(x) {cout<<"-->  "<<#x<<" :  "; for(auto ele:(x)) cout<<ele<<"  "; cout<<endl; }


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    bool turn=1;
    while(a>0 && c>0){
        if(turn){
            c-=b;
        }else{
            a-=d;
        }
        turn=1-turn;
    }
    if(a<=0){
        cout<<"No"<<endl;
    }else{
        cout<<"Yes"<<endl;
    }
    return 0;
}

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

int main() {
  int N;
  cin >> N;
  
  
  if ( N%1 == 0 && N/1 <= 9 ) {
      cout << "Yes" << endl;
  }
  else if ( N%2 == 0 && N/2 <= 9 ) {
      cout << "Yes" << endl;
  }
  else if ( N%3 == 0 && N/3 <= 9 ) {
      cout << "Yes" << endl;
  }
  else if ( N%4 == 0 && N/4 <= 9 ) {
      cout << "Yes" << endl;
  }
  else if ( N%5 == 0 && N/5 <= 9 ) {
      cout << "Yes" << endl;
  }
  else if ( N%6 == 0 && N/6 <= 9 ) {
      cout << "Yes" << endl;
  }
  else if ( N%7 == 0 && N/7 <= 9 ) {
      cout << "Yes" << endl;
  }
  else if ( N%8 == 0 && N/8 <= 9 ) {
      cout << "Yes" << endl;
  }
  else if ( N%9 == 0 && N/9 <= 9 ) {
      cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;    
  }
}

Measured memory_bytes: 256
//----------------------------------------------------------------------
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
//----------------------------------------------------------------------

using namespace std;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;

int main(void) {
    ll H;
    cin >> H;
    ll num= 0; 
    ll ans = 1;
    while(H>1) {
        H /= 2;
        num += ans;
        ans *= 2;
    }

    cout << num + ans << endl;

    return 0;
}   

Measured memory_bytes: 256
H, W = map(int, input().split())
C=list(list(map(int, input().split())) for _ in range(10))

#d[i][j]は2頂点間i, j間の移動コストを格納, Vは頂点数
def warshall_floyd(d, V): 
	for k in range(V):
		for i in range(V):
			for j in range(V):
				d[i][j] = min(d[i][j], d[i][k] + d[k][j])

	return d #d[i][j]に頂点i, j間の最短距離を格納

d=warshall_floyd(C, 10)

ans=0
for _ in range(H):
	A=list(map(int, input().split()))
	for a in A:
		if a==-1:
			continue
		else:
			ans+=d[a][1]

print(ans)

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

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

	bool isOk = false;
	int max = n / 4;
	for (int i = 0; i <= max; ++i) {
		int sa = n - i * 4;
		if (sa % 7 == 0) {
			isOk = true;
			break;
		}
	}

	if (isOk) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
using namespace std;
#define REP(i, a, n) for(int i=a; i<n; i++)
#define ll long long

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

	bool flag = false;
	REP(i, 1, 3501) {
		REP(j, 1, 3501) {
			ll x = (ll)N*i*j;
			ll y = (ll)4 * i*j - N*(i + j);
			if (y <= 0 || x < y) continue;

			if (x%y == 0) {
				flag = true;
				cout << x/y << " " << i << " " << j << endl;
				break;
			}
		}
		if (flag) break;
	}
	return 0;
}

Measured memory_bytes: 256
m, d = map(int, input().split())
cnt = 0
for i in range(1, m+1):
    for j in range(10, d+1):
        d1 = j % 10
        d10 = j // 10
        if d1 >= 2 and d10 >= 2 and d1 * d10 == i:
            cnt += 1
print(cnt)

Measured memory_bytes: 3060
import java.util.Scanner;

class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int x = scan.nextInt();
        int a = x/3600;
        int b = (x-3600*a)/60;
        int c = x%60;
        System.out.println(a+":"+b+":"+c);
    }
}


Measured memory_bytes: 26332
n = int(input())
digit = len(str(n))

cnt = 0
for i in range(1, digit):
    if i % 2 == 1:
        cnt += 10**i - 10**(i - 1)

if digit % 2 == 1:
    cnt += n - 10**(digit - 1) + 1
    
print(cnt)

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

#define ld long double
#define ll long long
#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define MP make_pair
ll MOD = 1e9+7;
//ll MOD = 998244353;
ll INF = 1e18;
void chmin(ll &a, ll b) { if (a > b) a = b; }
void chmax(ll &a, ll b) { if (a < b) a = b; }
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;}
void ans(bool x, ll y, ll z){
  if(x) cout<<y<<endl;else cout<<z<<endl;}   


int main(){
  ll i,j,o;
  ll result=0,buf=0,buf1=0,buf2=0,buf3=0,buf4=0;
  bool judge = true;
  ll n;cin>>n;
  vector<ll>a(n+1);
  a[0]=2;a[1]=1;
  for(i=2;i<=n;i++){
    a[i]=a[i-2]+a[i-1];
  }
  cout<<a[n]<<endl;


  return 0;
}

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

int main(){
	
	int num;
	
	std::cin >> num;  //dataset
	
	double xa,ya,ra;
	double xb,yb,rb;
	
	for(int i=0; i<num; ++i){
		std::cin >> xa >> ya >> ra >> xb >> yb >> rb;
		
		double length;  //a-b length;
		
		length = hypot(std::abs(xa-xb), std::abs(ya-yb));
		
		if(length > ra+rb){
			std::cout << 0 << std::endl;
		}else if(length + rb < ra){
			std::cout << 2 << std::endl; 
		}else if(length + ra < rb){
			std::cout << -2 << std::endl; 
		}else{
			std::cout << 1 << std::endl; 
		}
	}	
	return 0;
}

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

int main() {
  string a,b,c;
  cin >> a >> b >> c;
  if(a[a.size()-1] == b[0] && b[b.size()-1] == c[0]) {
    cout << "YES"<< endl;
  } else {
    cout << "NO\n";
  }
}
  

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
// const ll INF = 1LL<<60;
const long long INF = 1LL<<60; // 仮想的な無限大の値


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

  vector<ll> H(N);
  rep(i,N) cin>>H[i];

  vector<ll> S(N+1, 0);
  rep(i, N) S[i+1] = max(S[i], H[i]);

  ll ans = 0;
  rep(i, N) if (H[i] >= S[i+1]) ans ++;

  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3596
import collections

N, M = list(map(int, input().split()))

a = []
for i in range(N):
    tmp = list(map(int, input().split()))
    a += tmp[1:]

c = collections.Counter(a)
ans = 0
for _ in c.values():
    if _ == N:
        ans += 1

print(ans)


Measured memory_bytes: 3316
#include <iostream>
#include<algorithm>
#include<string>
#include<vector>
#define _USE_MATH_DEFINES
#include <math.h>
#include <iomanip>
#include <stdio.h>
#include <numeric>
#include <cmath>
#include <limits>
using namespace std;


int main()
{
	int n, d, sum=0,cnt=0;
	cin >> n >> d;
	int n_rows = n;     // 行数
	int n_cols = d;     // 列数
	int value = 0;      // 初期値
	int x[10][10];
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < d; j++) {
			cin >> x[i][j];
		}
	}

	for (int i = 0; i < n; i++) {
		for (int j = i + 1; j < n; j++) {
			for (int k = 0; k < d; k++) {
				sum += pow(abs(x[i][k] - x[j][k]), 2);
			}
			if (ceil(pow(sum, 0.5)) == floor(pow(sum, 0.5)))cnt++;
		sum = 0;
		}
	}
	cout << cnt << endl;
}

Measured memory_bytes: 512
#include<cstdio>
#include<cmath>
#include<string>
#include<iostream>
#include<algorithm>
#include<utility>
#include<vector>
#include<map>
#include<set>
#include<limits>
#include<bitset>
#include<array>
#include<numeric>
#include<iomanip>
#include<functional>

using namespace std;
typedef long long int ll;

#define C(I) cout<<(I)<<endl

ll n,m,a,b,c,x,y,aa[100010],ba[100010];
bool r,br,ar;
string s;
char ca,cb;


int main(){
    
    cin>>a>>b>>c;
    C((a<=c and c<=b) ? "Yes":"No");
    
    
}


Measured memory_bytes: 768
#define DEB
#include<bits/stdc++.h>
#define REP(i,m) for(int i=0;i<(m);++i)
#define REPN(i,m,in) for(int i=(in);i<(m);++i)
#define ALL(t) (t).begin(),(t).end()
#define CLR(a) memset((a),0,sizeof(a))
#define pb push_back
#define mp make_pair
#define fr first
#define sc second

using namespace std;


#ifdef DEB
#define dump(x)  cerr << #x << " = " << (x) << endl
#define prl cerr<<"called:"<< __LINE__<<endl
template<class T> void debug(T a,T b){ for(;a!=b;++a) cerr<<*a<<' ';cerr<<endl;}
#else
#define dump(x) ;
#define prl ;
template<class T> void debug(T a,T b){ ;}
#endif

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

typedef long long int lint;
typedef pair<int,int> pi;

namespace std{
  template<class S,class T>
  ostream &operator <<(ostream& out,const pair<S,T>& a){
    out<<'('<<a.fr<<','<<a.sc<<')';
    return out;
  }
}

//const int INF=5e8;
int main(){
  string s;cin>>s;
  cout<<s.substr(0,4)<<" "<<s.substr(4)<<endl;
  return 0;
}




Measured memory_bytes: 256
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
use std::io::Read;
#[allow(dead_code)]
fn getline() -> String {
    let mut ret = String::new();
    std::io::stdin().read_line(&mut ret).ok().unwrap();
    ret
}
fn get_word() -> String {
    let mut stdin = std::io::stdin();
    let mut u8b: [u8; 1] = [0];
    loop {
        let mut buf: Vec<u8> = Vec::with_capacity(16);
        loop {
            let res = stdin.read(&mut u8b);
            if res.unwrap_or(0) == 0 || u8b[0] <= b' ' {
                break;
            } else {
                buf.push(u8b[0]);
            }
        }
        if buf.len() >= 1 {
            let ret = String::from_utf8(buf).unwrap();
            return ret;
        }
    }
}

#[allow(dead_code)]
fn get<T: std::str::FromStr>() -> T { get_word().parse().ok().unwrap() }

fn calc(a: &[i64], mut sgn: i64) -> i64 {
    let mut sum = 0;
    let mut tot = 0;
    let n = a.len();
    for i in 0 .. n {
        sum += a[i];
        if sum * sgn <= 0 {
            tot += (sum - sgn).abs();
            sum = sgn;
        }
        sgn *= -1;
    }
    tot
}

fn solve() {
    let n = get();
    let a: Vec<i64> = (0 .. n).map(|_| get()).collect();
    let mut tot = calc(&a, 1);
    tot = min(tot, calc(&a, -1));
    println!("{}", tot);
}

fn main() {
    // In order to avoid potential stack overflow, spawn a new thread.
    let stack_size = 104_857_600; // 100 MB
    let thd = std::thread::Builder::new().stack_size(stack_size);
    thd.spawn(|| solve()).unwrap().join().unwrap();
}


Measured memory_bytes: 8572
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef unsigned long long int ulli;
#define vec(s) vector
;
#define vvec(s) vector<vector
> ;
typedef vector<lli> vi;
typedef vector<vi> vvi;
typedef pair<lli,lli> pii;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define YN(x) cout<<(bool x?"Yes":"No")<<endl;
#define out(s) cout<<s<<endl;
#define pb(s) push_back(s);
#define sp " ";
#define INF 10000000000
#define all(s) s.begin(),s.end()
void vout(vector<int> v){
    for(int i=0;i<v.size();i++)
    cout<<v.at(i)<<endl;
}
int main(){
    lli n,ans=0;
    cin>>n;
    vi a(n),sum(100001,0);
    rep(i,n) cin>>a[i];
    sort(all(a));
    lli prev=a[0];
    lli cnt=0;
    rep(i,n){
        if(prev==a[i]) cnt++;
        else{
            sum[prev]=cnt;
            cnt=1;
            prev=a[i];
        }
        if(i==n-1){
            sum[prev]=cnt;
        }
    }
    if(sum.size()==1) ans=sum[0];
    else if(sum.size()==2) ans=sum[0]+sum[1];
    else{
    for(int i=1;i<sum.size()-2;i++){
        ans=max(ans,sum[i-1]+sum[i]+sum[i+1]);
    }
    }
    out(ans);
}

Measured memory_bytes: 1792
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp5
{

    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            String S = Console.ReadLine();
            String[] line = S.Split(' ');
            long[] H = new long[N];
            int[] e = new int[N];
            bool end = false;

            for(int i=0; i<N; i++)
            {
                e[i] = 0;
                H[i] = long.Parse(line[i]);
            }

            for(int i=0; i<N; i++)
            {
                if(i >= 1)
                {
                    if(H[i] < H[i - 1] && e[i - 1] == 0)
                    {
                        H[i - 1]--;
                        e[i - 1]++;
                        i = i - 2;
                    }
                }
            }

            for(int i=0; i<N; i++)
            {
                if (i >= 1 && H[i] < H[i-1])
                {
                    end = true;
                    break;
                }
            }

            if(end == false)
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }


        }
    }
}

Measured memory_bytes: 27484
#include<bits/stdc++.h>
#define st first
#define nd second
#define pb push_back
#define ppb pop_back
#define umax(x,y) x=max(x,y)
#define umin(x,y) x=min(x,y)
#define ll long long
#define ii pair<int,int>
#define iii pair<ii,int>
#define iiii pair<ii,ii>
#define sz(x) ((int) x.size())
#define orta ((bas+son)>>1)
#define all(x) x.begin(),x.end()
#define dbgs(x) cerr<<(#x)<<" --> "<<(x)<<" "
#define dbg(x) cerr<<(#x)<<" --> "<<(x)<<endl;getchar()
#define pw(x) (1<<(x))
#define inf 2000000000
#define MOD 1000000007
#define N 200005
#define MAX 5000000
#define LOG 100
#define KOK 333
using namespace std;

int n,m;
char a[N],b[N];

int main() {

//	freopen("input.txt","r",stdin);

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

	scanf("%s %s",a+1,b+1);

	ll lcm=1ll*n*m/__gcd(n,m);

	if(lcm==max(n,m)) {

		if(n>m) {

			for(int i=1;i<=m;i++) {

				if(a[(i-1)*n/m+1]!=b[i]) {

					printf("-1");

					return 0;

				}

			}

		}
		else {

			for(int i=1;i<=n;i++) {

				if(b[(i-1)*m/n+1]!=a[i]) {

					printf("-1");

					return 0;

				}

			}

		}

	}

	vector<ll> v1,v2;

	int inc1=lcm/n;
	int inc2=lcm/m;

	for(int i=1;i<=n;i++) {

		v1.pb(1ll*(i-1)*inc1+1);

	}

	for(int i=1;i<=m;i++) {

		v2.pb(1ll*(i-1)*inc2+1);

	}

	int tut=-1;

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

		while(tut+1<m && v1[i]>=v2[tut+1]) tut++;

		if(tut+1 && v1[i]==v2[tut]) {

			if(a[i+1]!=b[tut+1]) {

				printf("-1");

				return 0;

			}

		}

	}

	printf("%lld",lcm);

}

Measured memory_bytes: 2676
import java.util.*

fun main(args: Array<String>) {
  val sc = Scanner(System.`in`)
  val x = sc.nextInt()
  val y = sc.nextInt()

  val ax = Math.abs(x)
  val ay = Math.abs(y)
  if (ax == ay && x != y) {
    println(1)
    return
  }
  var abs = Math.abs(ax - ay)

  if (x == 0) {
    if (y > 0) {
      println(y)
    } else {
      println(ay + 1)
    }
  }
  if (y == 0) {
    if (x > 0) {
      println(ax + 1)
    } else {
      println(ax)
    }
  }

  if (x > 0 && y > 0 && x < y) {
    // 10 20
    println(abs)
  }
  if (x > 0 && y > 0 && x > y) {
    // 20 10
    println(abs + 2)
  }
  // if (x > 0 && y < 0 && x < y) {
  // }
  if (x > 0 && y < 0 && x > y) {
    if (ax < ay) {
      // 10 -20
      println(abs + 1)
    } else {
      // 20 -10
      println(abs + 1)
    }
  }

  if (x < 0 && y > 0 && x < y) {
    if (ax < ay) {
      // -10 20
      println(abs + 1)
    } else {
      // -20 10
      println(abs + 1)
    }

  }
  // if (x < 0 && y > 0 && x > y) {
  // }
  if (x < 0 && y < 0 && x < y) {
    // -20 -10
    println(abs)
  }
  if (x < 0 && y < 0 && x > y) {
    // -10 -20
    println(abs + 2)
  }


}


Measured memory_bytes: 36308
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
using vl = vector<ll>;

/* short */
#define pb push_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) begin(v), end(v)
#define RALL(v) rbegin(v), rend(v)

/* REPmacro */
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define FORR(i, a, b) for(int i = (a); i >= (b); i--)
#define REP(i, n) for(int i = 0; i < (n); i++)
#define FOREACH(x, a) for(auto x : a)

/* exchange */
#define CHMIN(a, b) (a) = min((ll)(a), (ll)(b))
#define CHMAX(a, b) (a) = max((ll)(a), (ll)(b))

/* function */
#define IN(x) cin >> x
#define DEBUG(x) cerr << (x) << " "
#define LN() cerr << "\n"
#define PRINT(x) cout << (x) << endl
#define BR cout << endl

/* const */
const int ARRAY = 100005;
const int INF = 1001001001; // 10^9
const ll LINF = 1001001001001001001; // 10^18
const int MOD = 1e9 + 7;

ll ret = 0;
string s;
ll N, M, Q;

ll a[51];
ll b[51];
ll c[51];
ll d[51];
ll arr[11];

void eval(ll k) {
  if (k == N) {
    ll val = 0;
    REP(i, Q) {
      if ((arr[b[i]-1] - arr[a[i]-1]) == c[i]) val += d[i];
    }
    CHMAX(ret, val);
  } else {
    ll m = (k == 0) ? 1 : arr[k-1];
    FOR(i, m, M+1) {
      arr[k] = i;
      eval(k+1);
    }
  }
}

int main(void){
  IN(N);
  IN(M);
  IN(Q);
  
  REP(i, Q) {
    IN(a[i]);
    IN(b[i]);
    IN(c[i]);
    IN(d[i]);
  }

  eval(0);

  PRINT(ret);

}


Measured memory_bytes: 3640
#include<math.h>
#include<cmath>
#include<bitset>
#include<stdio.h>
#include<string>
#include<map>
#include<algorithm>
#include<vector>
#include<iostream>
#include<utility>
using namespace std;
int main(){
  char s;
  int INF=(1<<29);
  int dp[110][110],h,w,a[110][110],i,j;
  scanf("%d %d\n",&h,&w);
  for(i=0;i<=h+1;i++){
    for(j=0;j<=w+1;j++){
      a[i][j]=1,dp[i][j]=INF;
    }
  }
  for(i=1;i<=h;i++){
    for(j=1;j<=w;j++){
      scanf("%c",&s);
      if(s=='.'){
        a[i][j]=0;
      }
    }
    scanf("\n");
  }
  dp[1][1]=a[1][1];
  for(i=1;i<=h;i++){
    for(j=1;j<=w;j++){
      if(i==1 && j==1){
        continue;
      }
      if(a[i][j]==1 && a[i-1][j]==0){
        dp[i][j]=min(dp[i-1][j]+1,dp[i][j]);
      }
      else{
        dp[i][j]=min(dp[i-1][j],dp[i][j]);
      }
      if(a[i][j]==1 && a[i][j-1]==0){
        dp[i][j]=min(dp[i][j-1]+1,dp[i][j]);
      }
      else{
        dp[i][j]=min(dp[i][j-1],dp[i][j]);
      }
    }
  }
  printf("%d\n",dp[h][w]);
  return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
typedef long long ll;
#define ALL(l)  (l).begin(),(l).end()
#define rep(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using namespace std;

//const ll mod =  1000000007;
//const ll maxn = 1000000000;

//---------------------------------------------------------------------------------------------------
using vi = vector<int>; // intの1次元の型に vi という別名をつける
using vll = vector<ll>; // intの1次元の型に vi という別名をつける
using vvll = vector<vll>; // intの2次元の型に vvi という別名をつける
using vs = vector<string>; // stringの1次元の型に vs という別名をつける
using pll = pair<ll, ll>; // これ以降 pii という型名はpair<ll, ll> と同じ意味で使える
//---------------------------------------------------------------------------------------------------



int main() {
   int l,r,d,ans=0;
   cin>>l>>r>>d;
   for(int i=l ;i<=r;i++){
       if(i%d==0)ans++;
   }
   cout<<ans<<endl;
}



Measured memory_bytes: 3636
#include<bits/stdc++.h>
#define ll long long
#define clr(x,i) memset(x,i,sizeof(x))
using namespace std;
const int N=100005;
const ll mod=998244353;
inline int read()
{
    int x=0,f=1; char ch=getchar();
    while(ch<'0'||ch>'9') {if(ch=='-') f=-1; ch=getchar();}
    while(ch>='0'&&ch<='9') {x=x*10+ch-'0',ch=getchar();}
    return x*f;
}

void solve()
{
	string s; cin >> s;
	int len = s.size() - 1;
	if(s[len] == 's') s += "es";
	else s += "s";
	cout << s << endl;
}
int main()
{
	int T=1;
	while(T--) solve();
}

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

#include <algorithm>
#include <iomanip>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>

int main() {

    long long int n;
    cin >> n;

    string s, t;
    cin >> s >> t;

    for ( long long int i = 0; i < n; i++ ) {
        cout << s[i] << t[i];
    }

    cout << endl;

    return 0;

}


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        int[] l = new int[n];
        for (int i = 0; i < n; i++) {
            l[i] = sc.nextInt();
        }
        Arrays.sort(l);
        int ans = 0;
        for (int i = n - 1; i > n - 1 - k; i--) {
            ans += l[i];
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 23380
using System;
using System.Linq;
namespace AtCoder_Begginer_Contest1
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            string[] p = Console.ReadLine().Split();
            int[] P = new int[N];
            int ans = 0;
            int rate = 200001;
            for (int i = 0; i < N; i++)
            {
                P[i] = int.Parse(p[i]);
            }
            for (int i = 0; i < N; i++)
            {
                if (P[i] < rate) ans++;
                rate = Math.Min(rate, P[i]);
            }
            Console.WriteLine(ans);
        }
    }
}

Measured memory_bytes: 29020
import java.util.Scanner;

public class Main {
	static Scanner sc = new Scanner(System.in);

	//３文字目以降の探索
	//引数のnはターゲットの看板のどこを探索しているか
	//引数のpadは隙間
	static boolean paddingcheck(String tar,String str,int n,int pad){
		boolean f=false;
		for(int i=2;i<tar.length();i++){
			if(n+i*pad>=str.length()){f=false;break;}//
			if(tar.charAt(i)==str.charAt(n+i*pad))f = true;
			else {
				f = false;
				break;
			}
		}

		return f;
	}
	//２つの引数の文字列で看板が作れるかどうか判定するクラスメソッド
	static boolean search(String tar , String str){
		boolean f = false;
		for(int j=0;j<str.length();j++){
			if(tar.equals(str))return true;
			if(tar.charAt(0)==str.charAt(j)){
				int cnt=0;
				for(int i=j+1;i<str.length();i++){
					cnt++;
					if(str.length()<j+cnt)continue;
					if(tar.charAt(1)==str.charAt(i)){
						if((j+tar.length()-1*cnt)>str.length())break;//
						f = paddingcheck(tar,str,j,cnt);
						if(f==true) return f;
					}
				}
			}
		}		
		return f;
	}
	
	void doIt(){//クラス変数scに対しての操作を決めるメソッド
		int n = sc.nextInt();
		int ans = 0;
		String tar = sc.next();
		for(int i=0;i<n;++i){
			String s = sc.next();
			if(search(tar,s))ans++;
		}
		System.out.println(ans);
	}

	public static void main(String[] args) {
		new Main().doIt();
	}

}

Measured memory_bytes: 20816
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Kein Yukiyoshi
 */

#include "bits/stdc++.h"
#define int long long
#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 ALL(obj) begin(obj), end(obj)
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define LOWER_BOUND(A, key) distance(A.begin(), lower_bound(ALL(A), key))
#define UPPER_BOUND(A, key) distance(A.begin(), upper_bound(ALL(A), key))

using namespace std;
using ll      = long long;
const int MOD = (int)(1e9 + 7);
const int INF = (int)(1e13 + 7);

int bpm(int x, unsigned int y) {
  if (x == 0) return 0;
  if (y == 0) return 1;
  int ans   = 1;
  int digit = (int)((log((double)y) / log((double)2) / 1 + 1));
  x %= MOD;
  for (unsigned int i = 0; i < digit; i++) {
    if (((y >> i) & 1u) == 1) ans = ans * x % MOD;
    x = x * x % MOD;
  }
  return ans;
}

class CXYetAnotherDieGame {
public:
  static void solve(std::istream &cin, std::ostream &cout) {
    int x;
    cin >> x;
    cout << 2 * (x / 11) + (int)(ceil((x % 11) / (double)6)) << endl;
  }
};


signed main() {
  CXYetAnotherDieGame solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}


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

namespace Contest
{
    class Scanner
    {
        private string[] line = new string[0];
        private int index = 0;
        public string Next()
        {
            if (line.Length <= index)
            {
                line = Console.ReadLine().Split(' ');
                index = 0;
            }
            var res = line[index];
            index++;
            return res;
        }
        public int NextInt()
        {
            return int.Parse(Next());
        }
        public long NextLong()
        {
            return long.Parse(Next());
        }
        public string[] Array()
        {
            line = Console.ReadLine().Split(' ');
            index = line.Length;
            return line;
        }
        public int[] IntArray()
        {
            var array = Array();
            var result = new int[array.Length];
            for (int i = 0; i < array.Length; i++)
            {
                result[i] = int.Parse(array[i]);
            }

            return result;
        }
        public long[] LongArray()
        {
            var array = Array();
            var result = new long[array.Length];
            for (int i = 0; i < array.Length; i++)
            {
                result[i] = long.Parse(array[i]);
            }

            return result;
        }
    }

    class Program
    {
        private int A, B;
        private void Scan()
        {
            var sc = new Scanner();
            A = sc.NextInt();
            B = sc.NextInt();
        }

        public void Solve()
        {
            Scan();
            if ((A * B) % 2 == 1)
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
        }

        static void Main() => new Program().Solve();
    }
}

Measured memory_bytes: 13140
#include <bits/stdc++.h>
#include <math.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++)
using ll = long long;
using vec = vector<int>;
using vec2 = vector<vector<int>>;
ll inf = pow(2,62);

int main(){
    ll k;cin >> k;
    ll o = 7;
    ll count = 1;
    if(k %2 == 0 || k%5 == 0){
        cout << -1 << endl;
    }else{

        while(o % k != 0){
            o = o * 10 +  7;
            count++;
            o = o%k;

        }
        cout << count << endl;
    }

}

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

using namespace std;

typedef long long ll;
typedef unsigned int ui;
typedef pair<int, int> pi;

#define fi first
#define se second

int read() {
  int res = 0, w = 1; char c = getchar();
  while (!isdigit(c) && c != '-') c = getchar();
  if (c == '-') c = getchar(), w = -1;
  while (isdigit(c)) res = (res << 1) + (res << 3) + c - '0', c = getchar();
  return res * w;
}

const int Mod = 998244353;

int add(int a, int b) { return (a += b) >= Mod ? a - Mod : a; }

int sub(int a, int b) { return (a -= b) < 0 ? a + Mod : a; }

int mul(int a, int b) { return 1ll * a * b % Mod; }

int fast_pow(int a, int b) {
  int res = 1;
  for (; b; b >>= 1, a = mul(a, a))
    if (b & 1) res = mul(res, a);
  return res;
}

const int N = 3e6 + 10;

int fac[N], inv[N];

void init(int n = N - 1) {
  fac[0] = inv[0] = 1;
  for (int i = 1; i <= n; i++) fac[i] = mul(fac[i - 1], i);
  inv[n] = fast_pow(fac[n], Mod - 2);
  for (int i = n - 1; i >= 1; i--) inv[i] = mul(inv[i + 1], i + 1);
}

int C(int a, int b) { return a >= b ? mul(fac[a], mul(inv[b], inv[a - b])) : 0;}

int main() {
#ifdef dream_maker
//  freopen("tst.in", "r", stdin);
#else
  //freopen(".in", "r", stdin);
  //freopen(".out", "w", stdout);
#endif
  init();
  int n = read(), m = read(), ans = 0;
  for (int i = 0; i <= m; i++) if ((3 * m - i) & 1 ^ 1) {
    ans = add(ans, mul(C(n, i), C(((3 * m - i) >> 1) + n - 1, n - 1)));
  }
  ans = sub(ans, mul(n, C(m - 1 + n - 1, n - 1)));
  cout << ans << endl;
  return 0;
}


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

N = int(input())

lst = []
for _ in range(N):
    X, L = map(int, input().split())
    lst.append([X - L ,X + L])

lst.sort(key = lambda x: x[1])

count = 0
tmp = - 10 ** 18
for i in lst:
    if tmp <= i[0]:
        count += 1
        tmp = i[1]

print (count)

Measured memory_bytes: 21284
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define sz 100005
#define all(x) x.begin(),x.end()
#define l_b lower_bound
#define u_b upper_bound
#define pb push_back
#define MOD 1000000007
void fastio(void);

int main(){
    fastio();
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif

    char c; cin>>c;
    if(c<='Z')
        cout<<'A'<<endl;
    else
        cout<<'a'<<endl;

    return 0;
}

void fastio(void){
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}

Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
const int N = 1e6+100;
const int mod = 1e9+7;
typedef long long ll;
const int INF = 0x3f3f3f3f;
const ll llINF = 0x3f3f3f3f3f3f3f3f;
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define fep(i,a,b) for(int i=(a);i>=(b);i--)
inline bool read(ll &num) {
    char in;bool IsN=false;
    in=getchar();
    if(in==EOF) return false;
    while(in!='-'&&(in<'0'||in>'9')) in=getchar();
    if(in=='-'){ IsN=true;num=0;}
    else num=in-'0';
    while(in=getchar(),in>='0'&&in<='9'){
            num*=10,num+=in-'0';
    } 
    if(IsN) num=-num;
    return true;
}
ll a[N];
int main(){
    //freopen("1.in", "r", stdin);
    ll n;
    cin>>n;
    n--;
    cout<<n*(n+1)/2<<endl;
    return 0;
}

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

#define M 1046527
#define NIL (-1)
#define L 14

char H[M][L];

//?????????????????°????????????
int getChar(char ch)
{
    if( ch == 'A' ) return 1;
    else if(ch == 'C') return 2;
    else if(ch == 'G') return 3;
    else if(ch == 'T') return 4;
    else return 0;
}

//?????????????????°??????????????????key???????????????
long long getKey(char str[])
{
    long long sum = 0, p = 1, i;
    for( i = 0; i < strlen(str); i++ ){
        sum += p*(getChar(str[i]));
        p *= 5;
    }
    return sum;
}

int h1(int Key){ return Key % M; }
int h2(int Key){return 1 + (Key % (M - 1));}

int find(char str[])
{
    long long key, i, h;
    key = getKey(str);
    for( i = 0; ; i++ ){
        h = (h1(key) + i * h2(key)) % M;
        if(strcmp(H[h], str) == 0) return 1;
        else if( strlen(H[h]) == 0 ) return 0;
    }
    return 0;
}

int insert(char str[])
{
    long long key, i, h;
    key = getKey(str);
    for( i = 0; ; i++ ){
        h = (h1(key) + i * h2(key)) % M;
        if( strcmp(H[h], str) == 0 ) return 1;
        else if (strlen(H[h]) == 0){
            strcpy(H[h], str);
            return 0;
        }
    }
    return 0;
}

int main()
{
    int i, n, h;
    char str[L], com[9];
    for( i = 0; i < M; i++ ) H[i][0] = '\0';
    scanf("%d", &n);
    for( i = 0; i < n; i++ ){
        scanf("%s %s", com, str); //?????????????????\???scanf????????¨

        if( com[0] == 'i' ){
            insert(str);
        }else{
            if( find(str) ){
                puts("yes");
            }else{
                puts("no");
            }
        }
    }
    return 0;
}

Measured memory_bytes: 16908