akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
using ll = long long;

int		main(void)
{
	string s;

	cin >> s;
	ll result = 0;

	for (int tmp = 0; tmp < (1 << s.size() - 1); tmp++)
	{
		bitset<9> plus(tmp);
		ll sum = 0;

		for (int i = 0; s[i]; i++)
		{
			sum += s[i] - '0';
			if (i == s.size() - 1 || plus.test(i))
			{
				result += sum;
				sum = 0;
			}
			else
				sum *= 10;
		}
	}
	cout << result << endl;
}


Measured memory_bytes: 256
#include <cstdio>

using namespace std;
const int Max_N(405);
const int Max_M(100050);

int N, M, S, Head[Max_N], Total, To[Max_M << 1], Next[Max_M << 1], Pos[Max_M << 1], done[Max_N][Max_N];
bool GG[Max_N];

inline void Add_Edge(int s, int t, int p)
{
	++Total, To[Total] = t, Next[Total] = Head[s], Head[s] = Total, Pos[Total] = p;
}

void dfs(int u, int e)
{
	if (GG[S] |= (u == S))
		return;
	if (done[S][u] != -1)
	{
		if (done[S][u] != e)
			GG[S] = true;
		return;
	}
	done[S][u] = e;
	for (int i = Head[u];i;i = Next[i])
		if (Pos[i] < e)
			dfs(To[i], Pos[i]);
}

int main()
{
	scanf("%d%d", &N, &M);
	for (int i = 1, x, y;i <= M;++i)
		scanf("%d%d", &x, &y), Add_Edge(x, y, i), Add_Edge(y, x, i);
	for (S = 1;S <= N;++S)
	{
		for (int u = 1;u <= N;++u)
			done[S][u] = -1;
		for (int i = Head[S];i;i = Next[i])
			dfs(To[i], Pos[i]);
	}
	int Ans(0);
	for (int x = 1;x <= N;++x)
		for (int y = x + 1;y <= N;++y)
		{
			if (GG[x] || GG[y] || done[x][y] != -1 || done[y][x] != -1)
				continue;
			for (int u = 1;u <= N;++u)
				if (done[x][u] != -1 && done[y][u] != -1 && done[x][u] != done[y][u])
					goto loop;
			++Ans;
			loop :
			;
		}
	printf("%d", Ans);
	return 0;
}

Measured memory_bytes: 3200
///////////////////////////////////////////
//                                       //
//      Gagan_Sharma : DTU               // 
//                                       //                   
///////////////////////////////////////////
#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 int        long long
// #define mp      make_pair
#define eb         emplace_back
#define pb         push_back
#define ss         second
#define ff         first
#define IOS        ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define mod        998244353
#define MOD        (1000*1000*1000+7)
#define MN         LLONG_MIN
#define MX         LLONG_MAX
#define v1d        vector<int>
#define v2d        vector<vector<int>>
#define vip        vector<pair<int,int> >
#define v1s        vector<string>
#define pa         pair<int,int>
#define mxpq(T)    priority_queue <T>
#define mnpq(T)    priority_queue<T,vector<T>,greater<T>>
#define print(v)   for(auto i:v)cout<<i<<" ";cout<<"\n";
#define p2d(v)     for(auto a:v){for(auto b:a)cout<<b<<" ";cout<<endl;}
#define p1d(v)     for(auto a:v)cout<<a<<" ";cout<<endl;
#define ppd(v)     for(auto a:v)cout<<a.ff<<" "<<a.ss<<endl;
#define endl       '\n'
#define input(b,n) for(int i=0;i<n;i++)cin>>b[i+1];
#define Sort(v)    sort(v.begin(),v.end())
#define RSort(v)   sort(v.rbegin(),v.rend())
#define all(v)     v.begin(),v.end()
int gcd(int a,int b){return b?gcd(b,a%b):a;}
//string s = bitset<64>(a).to_string();
 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
#define fbo find_by_order // iterator to the kth element
#define ook order_of_key  //number of items that are strictly smaller than our item k
// #define T pair<int, int>
// #define ordered_set tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>
 
void read(int n=12){
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cout<<setprecision(n)<<fixed;
}
 
//____________________________________________________________________________________
 
 
void solve(){
  int n;cin>>n;
  v2d dp(n+2,v1d(3,0));
  int a,b,c;
  for(int i=1;i<=n;i++){
  	cin>>a>>b>>c;
    dp[i][0] = max(dp[i-1][1]+a, dp[i-1][2]+a);
    dp[i][1] = max(dp[i-1][0]+b, dp[i-1][2]+b);
    dp[i][2] = max(dp[i-1][0]+c, dp[i-1][1]+c);
  }
 int ans = max(dp[n][0], dp[n][1]);
  ans = max(ans, dp[n][2]);
  cout<<ans;
  
}
 
int32_t main(){
    read();
    int t = 1;
    // cin>>t;
    while(t--){
        solve();
    }
    
 
 
    return 0;
}  


Measured memory_bytes: 5760
def main():
  A, B, K = [int(x) for x in input().split()]
  for i in range(A, min(B + 1, A + K)):
    print(i)
  for i in range(max(A + K, B - K + 1), B + 1):
    print(i)


if __name__ == "__main__":
  main()


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#include <cmath>
#include <numeric>
using namespace std;
#define rep(i,a,b) for(int64_t i=(a); i<(b); ++i) // a ≦ i < b 
#define Rrep(i,a,b) for(int64_t i=(a);i>=(b);--i) // reverse repeat. a から b まで減少．
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend() //逆イテレータ
#define INF 100000000000000
#define MOD 1000000007LL
#define RANGE(a,b,c) (a).begin()+(b),(a).begin()+(c) // [b,c) イテレータ
using PII = pair<int64_t, int64_t>;
using VI = vector<int64_t>;
using VVI = vector<VI>;
using VS = vector<string>;
using VP = vector<PII>;
using i64 = int64_t;

template<typename T>
void invec(vector<T> &A){rep(i, 0, A.size()) cin >> A[i];}

struct edge {int to, cost;};
vector<vector<edge>> G;
VI d; // d[i] = 頂点 s から i への最短距離
// dfs(頂点， 親，深さ)
void dfs(int v, int p, i64 dep){
    d[v] = dep;
    for (edge &e: G[v]){
        if (e.to == p) continue;
        dfs(e.to, v, dep + e.cost);
    }
}

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

int N, Q, K; cin >> N;
G.resize(N+1);
rep(i, 0, N-1){ 
    int a;
    edge e; cin >> a >> e.to >> e.cost;
    G[a].push_back(e);
    swap(a, e.to);
    G[a].push_back(e); 
}

cin >> Q >> K;

// K からの最短経路.DFS
d.assign(N+1, INF);

dfs(K, -1, 0);

rep(_, 0, Q) {
    int x, y; cin >> x >> y;
    cout << d[x] + d[y] << "\n";
}


}
// 書いて考える．場合分け
// 境界，出力文字列 チェック．行末にスペース入れない．
// 可読性優先．高速化次点．
// まずは全探索，分割統治，次にDP
// 制限を見る．境界に注意．求めたい量の変域．動かせる量．
// 偶奇，逆から，ソート，出現回数，出現位置，DP， 余事象，包除
// データ構造． 問題の特徴量．単調性，二分探索
// 存在判定：構成方法，入力の特徴
// gcd, lcm ,素因数分解．
// 例外を十分に含む一般化．想像力の限界
// 小さい系から例示
// 代数的処理．前処理によるクエリ高速化．
// 始めは過剰に例示・場合分けしてもいい．各場合を確実に対処．
// 自明な例から処理，除外．
// 小数のときは，精度の設定する．doubel 変数に数値を入力するときは 123. とする．
// テストケース作成は数表あり
// 実行エラー：vector添え字超え．0割り．



Measured memory_bytes: 12800
while True:
    H,W=map(int,input().split())
    i=1
    if H==0 and W==0:
        break
    while i<=H:
            if int(i%2)==1:
                j=0
                while j<W:
                    print('#',end='')
                    j+=1
                    if j>=W:
                        break
                    print('.',end='')
                    j+=1
                i+=1
                print()
            else:
                k=0
                while k<W:
                    print('.',end='')
                    k+=1
                    if k>=W:
                        break
                    print('#',end='')
                    k+=1
                i+=1
                print()
    print()


Measured memory_bytes: 7000
#include <iostream>
#include <stdio.h>
#include <bits/stdc++.h>
#include <math.h>
#define ll long long
using namespace std;

struct Node{
    int p;
    int t;
};

int main(){
    int n;
    cin>>n;
    bool data[n+1];
    struct Node num[20][20];
    int color[n+1];
    int q[n+1];
    for (int i=1; i<=n; i++){
        int a;
        cin>>a;
        q[i]=a;
        for (int j=0; j<a; j++){
            cin>>num[i][j].p>>num[i][j].t;
            //cout<<num[i][j].t;
        }
    }
    vector<int> pp;
    
    // {0, 1, ..., n-1} の部分集合の全探索
    for (int bit = 0; bit < (1<<n); ++bit){
        for (int i=1; i<=n; i++) color[i]=2;
        bool ans=true;
        int count=0;
        for (int i=0; i<=n; i++){
            data[i]=false;
        }

        for (int i = 0; i < n; ++i) {
            if (bit & (1<<i)) { // i が bit に入るかどうか
                count+=1;
                data[i+1]=true;
                color[i+1]=1;
                //cout<<data[i+1];
            }
            else color[i+1]=0;
        }
        //cout<<endl;
        for (int i=1; i<=n; i++){
            if (data[i]==false) continue;
            for (int j=0; j<q[i]; j++){
                if (color[num[i][j].p]!=2 && color[num[i][j].p]!=num[i][j].t){
                    ans=false;
                    //cout<<i<<j<<endl;
                }
                else color[num[i][j].p]=num[i][j].t;
            }
        }
        if (ans) {
            //cout<<"oo"<<endl;
            pp.push_back(count);
        }
        
    }
    int l=pp.size();
    //cout<<l<<endl;
    int max=0;
    for (int i=0; i<l; i++){
        if (max<pp[i]) max=pp[i];
    }
    cout<<max<<endl;
    
}

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

#define rep(i,n) for(int i=0; i<(n); i++)
#define rep2(i,x,n) for(int i=x; i<(n); i++)
#define all(x) x.begin(),x.end()
typedef long long ll;
ll mod = 1000000007;
ll inf = 1e18;
int main(){

    ll a,b,n;
    cin >> a >> b >> n;

    if(n<b){
        cout << a*n/b << endl;
    }else{
        cout << a*(b-1)/b << endl;
    } 
    
    return 0;
}

Measured memory_bytes: 3644
n, k = map(int, input().split())
port = list(map(int, input().split()))
visited = [1]
flag = [False for i in range(n)]
current = 1

t = k

while flag[port[current-1]-1] == False and t > 0:
    visited.append(port[current-1])
    flag[port[current-1]-1] = True
    current = port[current-1]
    t -= 1

if t > 0:
    s = visited.index(port[current-1])
    bubun = visited[s:]
    g = (k-s) % len(bubun)
    print(bubun[g])
else:
    print(current)


Measured memory_bytes: 32376
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repo(i,n) for(int i = 1; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define np next_permutation
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define pi acos(-1.0)
const ll INF = 1LL<<61;
template<class T>bool chmax(T &a, const T &b) { 
  if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) {
  if (b<a) { a=b; return 1; } return 0; }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
ll jou(ll N, ll P){if(P==0) return 1;
  if(P%2==0){ll t = jou(N, P/2);return t*t % mod;
  }return (N * jou(N, P-1)) % mod;}  //jou(n,mod-2)で逆元
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'大文字'+=32;    で小文字に
//  cout << fixed << setprecision (20);   小数点以下2０桁まで
//実行時間制約2秒では２×10^8回くらいまで計算できる




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

  ll ans=1;
  for(ll i=2;i<=997;i++){
    bool sosu=true;
    for(ll j=2;j*j<=i;j++){
      if(i%j==0) {
        sosu=false;
        break;
      }
    }
    if(sosu) {
      ll cnt=0;
      repo(j,n+1){
        ll k=j;
        while(k%i==0){
          cnt++;
          k/=i;
        }
      }
      if(cnt==0) continue;
      ans*=cnt+1;
      ans%=mod;
    }
  }

  cout << ans << endl;
}

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

int main() {
  int n, m;
  cin >> n >> m;
  vector<int> nums(n);
  for (int i = 0; i < m; i++)
    cin >> nums.at(i);

  int sum = std::accumulate(nums.begin(), nums.end(), 0);

  int r;
  if (n - sum >= 0) {
    r = n - sum;
  }
  else {
    r = -1;
  }

  cout << r << endl;
}


Measured memory_bytes: 7132
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;



int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	int n, i, j, k, ct;
	cin >> n;

	vector<int> a(n);
	ct = 0;
	for (i = 0; i < n; i++) {
		cin >> a[i];
		if (a[i] != i + 1) ct++;
	}

	if (ct <= 2) cout << "YES\n";
	else cout << "NO\n";


	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long ll;
#define INF 0x3f3f3f3f
#define pb push_back
#define eb emplace_back
#define xx first
#define yy second
using namespace std;
const int sz=1001, mod=1e9+7;

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    int n,i,x;
    cin>>n;
    int a[n];
    for(i=0;i<n;i++)cin>>a[i];
    map<int,int> mp;
    mp[a[0]]++;
    for(i=1;i<n;i++){
        auto it = mp.lower_bound(a[i]);
        if(it==mp.begin()){
            mp[a[i]]++;
        }else{
            --it;
            int x=it->first,y=it->second;
            mp.erase(it);
            if(y!=1) mp[x]=y-1;
            mp[a[i]]++;
        }
    }
    int res=0;
    for(auto x:mp)res+=x.yy;
    cout<<res;
}


Measured memory_bytes: 5248
#include <bits/stdc++.h>
using ll = long long;
#define FOR(i, k, n) for(ll i = (k); i < (n); i++)
#define FORe(i, k, n) for(ll i = (k); i <= (n); i++)
#define FORr(i, k, n) for(ll i = (k)-1; i > (n); i--)
#define FORre(i, k, n) for(ll i = (k)-1; i >= (n); i--)
#define REP(i, n) FOR(i, 0, n)
#define REPr(i, n) FORre(i, n, 0)
#define ALL(x) (x).begin(), (x).end()
#define ALLr(x) (x).rbegin(), (x).rend()
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;

const int INF = 1001001001;

int main(void){
  ll n;
  cin >> n;
  vector<ll> a(n);
  REP(i, n) cin >> a[i];

  ll sum = 0;
  ll r = 0, ans = 0;
  REP(l, n){
    while(r < n && (sum^a[r]) == (sum+a[r])){
      sum += a[r++];
    }
    ans += r-l;
    if(l == r) r++;
    else sum -= a[l];
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1792
#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<int,ii>
#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) (1ll<<(x))
#define inf 2005000
#define MOD 1000000007
#define N 1000005
#define M 1000005
#define LOG 60
#define KOK 4000000
using namespace std;

bitset<10001> b;
int a[105];
int n;

int main() {

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

	scanf("%d",&n);

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

		scanf("%d",&a[i]);

	}

	b[0]=1;

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

		b|=(b<<a[i]);

	}

	int ans=0;

	for(int i=10000;i>=0;i--) {

		if(b[i] && i%10>0) {

			ans=i;

			break ;

		}

	}

	printf("%d",ans);

}

Measured memory_bytes: 256
#define Q(x)(x)*(x)
N,i,M;double X[30],Y[30],Z[30],cx,cy,cz,d,m;double D(i){return sqrt(Q(X[i]-cx)+Q(Y[i]-cy)+Q(Z[i]-cz));}int L(){for(m=i=0;i<N;i++)if(D(i)>m)m=D(i),M=i;return M;}main(t){for(;scanf("%d",&N),N;printf("%f\n",D(L()))){for(i=0;i<N;i++)scanf("%lf%lf%lf",X+i,Y+i,Z+i);for(cx=cy=cz=d=0.5;d>1e-8;d/=2)for(t=0;t<100;t++)i=L(),cx+=(X[i]-cx)*d,cy+=(Y[i]-cy)*d,cz+=(Z[i]-cz)*d;}exit(0);}

Measured memory_bytes: 0
#include <iostream>
#include <vector>
#include <map>
#include <string>
#include <utility>
#include <queue>
#include <stack>
#include <cmath>
#include <numeric>

#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
#define ll long long
using namespace std;
int day[12]={31,28,31,30,31,30,31,31,30,31,30,31};
int main(){
    string s;
    cin>>s;
    int n;
    cin>>n;
    rep(i,0,s.size()){
        if(i%n==0)cout<<s[i];
    }
    cout<<endl;
}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;


public class Main
{

	public static void main(String[] args)throws Exception
	{
		Scanner sc = new Scanner(System.in);
		
		Double a = sc.nextDouble();

		Double f= Math.pow(a/3, 3);
		System.out.printf("%.12f",f);
	}

}


Measured memory_bytes: 24276
#include<bits/stdc++.h>
using namespace std;
signed main(){
  int b1,b2,b3;
  cin>>b1>>b2>>b3;
  if(b1==1 && b2==1){
    cout<<"Open"<<'\n';
  }
  else if(b3==1){
    cout<<"Open"<<'\n';
  }
  else{
    cout<<"Close"<<'\n';
  }
  return(0);
}


Measured memory_bytes: 3080
#include <iostream>
#include <string.h>
#include <cstring>
#include <math.h>
#include <algorithm>
#include <functional>
#include <stack>
#include <queue>
#include <vector>
#include <map>
using namespace std;

#define cio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define ll long long
#define ii pair < int, int >
#define iii pair < int, ii >
#define INF 987654321
#define LINF 987654321987654321

int main()
{
	cio;
	char c;
	cin >> c;

	if (c >= 'A' && c <= 'Z')
		cout << 'A';
	else
		cout << 'a';
}

Measured memory_bytes: 2992
N, M = list(map(int, input().split()))
H = list(map(int, input().split()))
AB = [list(map(int, input().split())) for i in range(M)]
# print(N, M, H, AB)


dictionary = {}
for A, B in AB:
    if dictionary.get(A) is None:
        dictionary[A] = []
    if dictionary.get(B) is None:
        dictionary[B] = []

    dictionary[A].append(H[B - 1])
    dictionary[B].append(H[A - 1])
# print(dictionary)

count = 0
for i, heights in dictionary.items():
    # print(i, type(i), H[i - 1], heights)
    if H[i - 1] > max(heights):
        count += 1

import itertools

# paths = list(itertools.chain.from_iterable(AB))
# print(paths)
for i in range(1, N + 1):
    if dictionary.get(i) is None:
        count += 1

print(count)


Measured memory_bytes: 43320
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

int main(void)
{
    char s[101],t[101];

    scanf("%s %s",s,t);

    for (int i = 0; i < strlen(t); i++)
    {
        printf("%c",t[i]);
    }

    for (int i = 0; i < strlen(s); i++)
    {
        printf("%c",s[i]);
    }

    return 0;
}

Measured memory_bytes: 128
from collections import  deque
import sys
import bisect
import math
import itertools
from queue import deque
from math import gcd

INF = float('inf')
mod = 10**9+7
eps = 10**-7

def inp(): return int(sys.stdin.readline())
 
def inp_list(): return list(map(int, sys.stdin.readline().split()))

def lcm(x, y): return (x * y) // gcd(x, y)

N, M = inp_list()
A = inp_list()

ans = N - sum(A)
if ans < 0:
    print(-1)
    exit()
print(ans)


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

int main() {
    int N;
    cin >> N;
    int x = N;
    int total = 0;
    while (x) {
        total += x % 10;
        x /= 10;
    }
    if (N % total == 0) {
        cout << "Yes" << endl;
        return 0;
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a, b, c;
  cin >> a >> b >> c;
  
  set<int> S;
  S.insert(a);
  S.insert(b);
  S.insert(c);
  
  if(S.size() == 3){
    cout << 3 << endl;
  }
  if(S.size() == 2){
    cout << 2 << endl;
  }
  if(S.size() == 1){
    cout << 1 << endl;
  }


}
 

Measured memory_bytes: 3636
#include <iostream>
#include <cstring>
#include <cstdio>
#define ll long long
using namespace std;

inline int read(){
	int sum=0,f=1;char c=getchar();
	while(c>'9'||c<'0'){if(c=='-') f=-1;c=getchar();}
	while(c<='9'&&c>='0'){sum=sum*10+c-'0';c=getchar();}
	return f*sum;
}

const int N=5005;
const int Mod=1000000007;
int n,m,a[N];
ll f[N][N];

inline ll fpow(ll a,ll b){
	ll ret=1;
	while(b){if(b&1) ret=ret*a%Mod;a=a*a%Mod;b>>=1;}
	return ret;
}

signed main(){
	n=read();m=read();ll inv=fpow(2,Mod-2);
	for(int i=1;i<=n;i++) a[i]=read();
	for(int i=1;i<=n;i++)
		for(int j=1;j<=n;j++){
			if(i==j) continue;
			if(a[i]>a[j]) f[i][j]=1;
		}
	for(int i=1;i<=m;i++){		
		int x=read(),y=read();
		f[x][y]=f[y][x]=(f[x][y]+f[y][x])%Mod*inv%Mod;
		for(int j=1;j<=n;j++){
			if(j==x||j==y) continue;			
			f[x][j]=f[y][j]=(f[x][j]+f[y][j])%Mod*inv%Mod;
			f[j][x]=f[j][y]=(f[j][x]+f[j][y])%Mod*inv%Mod;
		}
	}
	ll ans=0;
	for(int i=1;i<=n;i++)
		for(int j=i+1;j<=n;j++) ans=(ans+f[i][j])%Mod;
	printf("%lld\n",ans*fpow(2,m)%Mod);
	return 0;
}


Measured memory_bytes: 118528
def pow_mod(n)
  mod = 10 ** 9 + 7
  n.times.inject(1){|s,i| s * 2 % mod }
end
N = gets.to_i
L = Array.new(N,0)
gets.split.map(&:to_i).each do |diff|
  L[diff] += 1
end
valid = N.times.all? do |i|
  if N.odd?
    (i.zero? && L[i] == 1) || (i.even? && L[i] == 2) || (i.odd? && L[i].zero?)
  else
    (i.odd? && L[i] == 2) || (i.even? && L[i].zero?)
  end
end

puts valid ? pow_mod(N / 2) : 0

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

const int MOD = 1000000007;
int x[10],y[10];
double dis = 0;
int cnt=0;

double dist(int i , int j){
    double dx = x[i]-x[j];
    double dy = y[i]-y[j];
    return pow(dx*dx+dy*dy,0.5);
}

int main (){
    cout << fixed << setprecision(7);
    int n;  cin >> n;   for(int i=1;i<=n;i++) cin >> x[i] >> y[i];
    vector <int> v(n);

    rep(i,n) {
        v.at(i)=i+1;
    }

   do{
        rep(i,n-1){
             dis+= dist(v[i],v[i+1]);
        }
        
    }  while( next_permutation(v.begin(),v.end()) );

     int Factorial = 1;
    for(int i = 2; i <= n; i++) Factorial *= i;


    double ans = dis / Factorial ;
    cout << ans << endl;
    

    
}

Measured memory_bytes: 256
#include <iostream>
#include <string.h>
#include <set>
#include <vector>
#include <queue>
#include <cmath>
#include <math.h>
#include <algorithm>
#include <map>
#include <stack>
#include <iomanip>
#include <functional>
#include <limits.h>
using namespace std;
#define ll long long int
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,n) for(ll i=1;i<=n;i++)
#define N 1000
#define kr 1000000007
ll binarys(ll low,ll high,ll a[],ll x)
{
    while (high-low>1) {
        ll mid=low+(high-low)/2;
        if(a[mid]>x)
            high=mid;
        else
            low=mid;
    }
    if(a[high]<=x)
        return high;
    else if(a[low]<=x)
        return low;
    else
        return -1;
}
int main()
{
    ios_base::sync_with_stdio(0);
        ll n;
        cin>>n;
        ll a[n];
        ll s=0;
        rep(i, n)
        {
            cin>>a[i];
            s+=a[i];
        }
        if(s%10!=0)
            cout<<s;
        else
        {
            sort(a, a+n);
            ll r=0;
            rep(i, n)
            {
                if(a[i]%10!=0)
                {s-=a[i];
                    r=1;
                    break;}
            }
            if(r==1)
            cout<<s<<endl;
            else
                cout<<0<<endl;
        }
}


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

#define INF 1e9
using namespace std;

#define REPR(i, n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ALL(a)  (a).begin(),(a).end()

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

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

int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }

typedef long long ll;

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

void Ans(bool can) {
    if (can) cout << "Yes" << endl;
    else cout << "No" << endl;
    exit(0);
}

int main() {
    string S, T;
    cin >> S;
    cin >> T;
    vector<int> s_tbl(26, -1);
    vector<int> t_tbl(26, -1);
    REP(i, S.size()) {
        int s = S[i]-'a';
        int t = T[i]-'a';
        // tableにあるなら変換
        if (s_tbl[s]!=-1) {
            // 変換結果がtと一致しないならout
            if (s_tbl[s] != t) Ans(false);
        }
        else s_tbl[s]=t;
        if (t_tbl[t]!=-1) {
            if (t_tbl[t] != s) Ans(false);
        }
        else t_tbl[t]=s;
    }
    Ans(true);

    return 0;
}


Measured memory_bytes: 776
#include<bits/stdc++.h>
using namespace std;
#define int long long 
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define F first
#define S second
int const M=2e5+10;
vector<int>adj[M];
int cnt[M],q[M];
main()
{
	int n,m,a,b;
	cin>>n>>m;
	int tail=0,head=0;
	for(int i=1;i<=m;i++)cin>>a>>b,adj[a].pb(b),cnt[b]++;
	for(int i=0;i<n;i++)
	{
		//sort(adj[i].begin(),adj[i].end());
		if(cnt[i]==0)
			q[head++]=i;
	}
	int tmp=0;
	while(head>tail)
	{
		tmp++;
		int now=q[tail++];
		for(int i=0;i<adj[now].size();i++)
		{
			int u=adj[now][i];
			cnt[u]--;
			if(cnt[u]==0)
				q[head++]=u;
		}
	}
	if(tmp==n){
		for(int i=0;i<head;i++)
			cout<<q[i]<<endl;
	}
	else cout<<"NO";
}

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

using namespace std;

int main(){
    int a , b; cin >> a >> b;
    
    int ans[3];
    ans[0] = a + b;
    ans[1] = a - b;
    ans[2] = a * b;
    sort(ans , ans + 3);
    
    cout << ans[2] << endl;
}


Measured memory_bytes: 256
use std::io;
use std::process;


fn read_str() -> String {
   let mut s = String::new();
   io::stdin().read_line(&mut s).ok();
   s.trim().parse().ok().unwrap()
}

fn main() {
   let s = read_str();
   let t = read_str();
   for i in 0..s.len() {
      let mut found = true;
      for j in 0..t.len() {
        if (i+j) >= s.len() {
	   found = false;
	   break;
	}
	if t.chars().nth(j) == Some('_') {
	   continue;
	}
	if s.chars().nth(i+j) != t.chars().nth(j) {
	   found = false;
	   break;
	}
      }
      if found {
          println!("Yes");
	  process::exit(0);
      }
   }
   println!("No");
}


Measured memory_bytes: 1056
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <deque>
#include <queue>
#include <set>
#include <functional>
#include <cmath>


//マクロ
/*動かない・・・
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define REP(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _roverload3(_1,_2,_3,name,...) name
#define _rrep(i,n) repi(i,0,n)
#define rrepi(i,a,b) for(int i=int(a);i<int(b);++i)
#define RREP(...) _roverload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
//*/
#define REP(i,n) for(int i=0; i<(int)(n); ++i)
#define REPS(i,n) for(int i=1; i<=(int)(n); ++i)
#define RREP(i,n) for(int i=(int)(n)-1; i>=0; --i)
#define RREPS(i,n) for(int i=(int)(n); i>0; --i)
#define FOR(i,s,e) for(int i=(int)(s); i<(int)(e); ++i)
#define RFOR(i,s,e) for(int i=(int)(e)-1; i>=(int)(s); --i)
//*/
#define All(a) (a).begin(),(a).end()
#define dump(x)  cerr << #x << " = " << (x) << endl;

//定数
#define INF 1e12
#define MOD (int)(1e9+7)

typedef long long ll;
typedef unsigned long long ull;
/*
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
//*/
using namespace std;
using Graph = vector<vector<int>>;

//とりあえず書いておく変数
int dx[4] = { 1,0,-1,0 };
int dy[4] = { 0,1,0,-1 };

//今回の変数
string s, t, u;
int a, b;

//使用する関数
template<class T>bool chmax(T &a, const T &b) {
	if (a < b) { a = b; return 1; }
	return 0;
}
template<class T>bool chmin(T &a, const T &b) {
	if (a > b) { a = b; return 1; }
	return 0;
}

ll calc(ll a) {
	if (a == 1)return 1;
	return calc(a / 2) * 2 + 1;
}

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

	cin >> s >> t;
	cin >> a >> b;
	cin >> u;

	if (s == u) {
		a--;
	}
	if (t == u) {
		b--;
	}
	cout << a << " "<< b << endl;
}

Measured memory_bytes: 256
#include<algorithm>
#include<iostream>
#include<iomanip>
#include<cstring>
#include<cstdio>
#include<cmath>
using namespace std;
#define ll long long
#define mod 998244353
ll n,m,k,f[500005],inv[500005],ra[500005],le[500005],ans;
ll ksm(ll x,ll y){
	ll anss=1,t=x;
	while(y){
		if(y&1) anss=anss*t%mod;
		t=t*t%mod;
		y>>=1;
	}
	return anss;
}
ll jug(ll x){
	return (x&1)?mod-1:1;
}
ll C(ll n,ll m){
	return f[n]*inv[m]%mod*inv[n-m]%mod;
}
int main(){
	scanf("%lld%lld",&n,&m);
	k=max(n,m);
	f[0]=1;
	for(ll i=1;i<=k;i++) f[i]=f[i-1]*i%mod;
	inv[k]=ksm(f[k],mod-2);
	for(ll i=k-1;i>=0;i--) inv[i]=inv[i+1]*(i+1)%mod;
	ra[0]=1;
	for(ll i=1;i<=k;i++) ra[i]=ra[i-1]*(n+1)%mod;
	le[0]=1;
	for(ll i=1;i<=k;i++) le[i]=le[i-1]*(m+1)%mod;
	for(ll i=0;i<=min(n,m);i++){
//		cout<<jug(i)<<' '<<C(n,i)<<' '<<C(m,i)<<' '<<ra[m-i]<<' '<<le[n-i]<<endl;
		ans=(ans+jug(i)*C(n,i)%mod*C(m,i)%mod*ra[m-i]%mod*le[n-i]%mod*f[i])%mod;
	}
	printf("%lld",ans);
}

Measured memory_bytes: 19452
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <cstdlib>
#include <queue>
#include <stack>
#include <map>
#include <set>
const int inf = 0x3f3f3f3f;
typedef long long ll;
const ll INF_LL  = 1e18;
using namespace std;
int main(){
	ios::sync_with_stdio(false);
	int a,b;
	cin>>a>>b;
	if(a>=b){
		if(a>b) cout<<2*a-1;
		else cout<<2*a;}
	else {
		if(b>a)cout<<2*b-1;
		else cout<<2*b;
	}
return 0;
}


Measured memory_bytes: 256
O = list(input())
E = list(input())
ans =[]

if len(O)>len(E):
  for i in range(len(E)):
    ans.append(O[i])
    ans.append(E[i])
  ans.append(O[-1])
  print("".join(ans))
else:
  for i in range(len(E)):
    ans.append(O[i])
    ans.append(E[i])
  print("".join(ans))  

Measured memory_bytes: 3064
//In the name of God

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

typedef long long ll;
typedef pair <int , int> pii;

const int N = 1e5+10 , mod = 1e9+7;

int dp[101][N] , a[N] , ps[101][N];

int32_t main(){
   ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
   cout << fixed << setprecision(9);
   int n , k;
   cin >> n >> k;
   for(int i = 1 ; i <= n ; i++)
      cin >> a[i];
   dp[0][0] = 1;
   for(int i = 0 ; i <= k ; i++)
      ps[0][i] = 1;
   for(int i = 1 ; i <= n ; i++)
      for(int j = 0 ; j <= k ; j++){
         dp[i][j] = ps[i - 1][j];
         if(j - a[i] > 0)
            dp[i][j] -= ps[i - 1][j - a[i] - 1];
         dp[i][j] += mod;
         dp[i][j] %= mod;
         ps[i][j] += dp[i][j];
         ps[i][j] %= mod;
         ps[i][j + 1] = ps[i][j];
      }
   cout << dp[n][k];
   return 0;
}


Measured memory_bytes: 79616
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()
#define F first
#define S second
#define forn(i, n) for (int i = 0; i < (int)n; i++)
#define pb push_back
#define fastIO ios::sync_with_stdio(0), cin.tie(0);
#define endl '\n'
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int, int> pii;
int n, m;
bool ok(int i, int j) {
    return i >= 0 && i < n && j >= 0 && j < m;
}
int main() {
#ifdef LOCAL
    // freopen("in.txt", "r", stdin);
    // freopen("out.txt", "w", stdout);
#else
    fastIO;
#endif
    int n;
    cin >> n;
    set<int> st;
    forn(i, n) {
        int v;
        cin >> v;
        st.insert(v);
    }
    cout << sz(st) << endl;
    return 0;
}

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

string name(int64_t n) {
  if (n == 0) return "";
  n--;
  return name(n/26) + string(1, 'a'+n%26);
}

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

  int64_t n;
  cin >> n;

  cout << name(n) << endl;
  return 0;
}

Measured memory_bytes: 3584
s = input()

r = 0
dict_r = {0: 1}
r10 = 1
for i in range(len(s)):
    d = int(s[-i - 1])
    r = (r + d * r10) % 2019
    r10 = (r10 * 10) % 2019

    dict_r[r] = dict_r.get(r, 0) + 1


answer = sum(v * (v - 1) // 2 for v in dict_r.values())
print(answer)


Measured memory_bytes: 9356
#include<iostream>
 
using namespace std;
 
int main()
{
	int N;
	cin >> N;
	for(int i = 0;i < 26; i++)
	{
		for(int j = 0;j < 15;j++)
		{
			if(N == 4 * i + 7 * j)
			{
				printf("Yes"); 
				return 0;
			}
		}		 
	}
	printf("No");
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define foi(i,k,n) for (int i = (int)k; i < (int)n; ++i)

using namespace std;
using ll = long long;
using ii = pair<int,int>;

const double pi = acos(-1.0);

int main() {
  ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
  int n,m; cin >> n >> m;
  int s = 0;
  while (m--) {
    int x; cin >> x;
    s += x;
  }
  if (s <= n) {
    cout << n - s << '\n';
  } else {
    cout << -1 << '\n';
  }
  return 0;
}


Measured memory_bytes: 3668
package main

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

var n, q int
var A []int

// 割り当て
func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Scan()
	n, _ = strconv.Atoi(sc.Text())
	A = make([]int, n)
	for i := 0; i < n; i++ {
		sc.Scan()
		A[i], _ = strconv.Atoi(sc.Text())
	}

	sc.Scan()
	q, _ = strconv.Atoi(sc.Text())
	for i := 0; i < q; i++ {
		sc.Scan()
		m, _ := strconv.Atoi(sc.Text())
		if isSolve(0, m) {
			fmt.Println("yes")
		} else {
			fmt.Println("no")
		}
	}
}

func isSolve(i, m int) bool {
	if m == 0 {
		return true
	}
	if n <= i {
		return false
	}
	return isSolve(i+1, m) || isSolve(i+1, m-A[i])
}



Measured memory_bytes: 1092
#include <string>
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <utility>
#include <vector>
#include <iomanip>


using namespace std;

typedef unsigned long long ull;
int main(void) {
	string str;
	cin >> str;
	for(int i = str.size() - 1; i >= 0; i--){
		cout << str[i];
	}
	cout << endl;
}

Measured memory_bytes: 0
a = int(input())
p = list(map(int,input().split()))
count = 0

for i in range(a):
     for s in range(a):
         for t in range(a):
             if p[t]<p[s]<p[i] and p[t]+p[s]>p[i]:
                 count+=1
print(count)

Measured memory_bytes: 9064
#include<iostream>
#include<cstdlib>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
using namespace std;

typedef long long ll;

int main(){
  ll h,e;
  cin >> h;
  while(h!=1){
  	h/=2;
    e++;
  }
  cout << (ll)pow(2,e+1)-1 << endl;
}

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

int main()
{
	int A, B, C, D;
	cin >> A >> B >> C >> D;

	string ans = "No";
	int flag = 0;
	while( true ) {
		if( flag ) {
			A -= D;
			if( A <= 0 ) {
				break;
			}
		}
		else {
			C -= B;
			if( C <= 0 ) {
				ans = "Yes";
				break;
			}
		}
		flag = 1 - flag;
	}

	cout << ans << endl;

}


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

/* #pragma */
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")


/*alias*/
#define F first
#define S second

#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev
#define itn int

/*template*/
template<class T>inline bool amax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>inline bool amin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }

/* func */
int32_t GCD(int32_t a, int32_t b){return b ? GCD(b, a%b) : a;}
int64_t GCD(int64_t a, int64_t b){return b ? GCD(b, a%b) : a;}
int32_t LCM(int32_t a, int32_t b){return a * b / GCD(a, b);}
int64_t LCM(int64_t a, int64_t b){return a * b / GCD(a, b);}

/*struct*/
struct aaa {
	aaa() {
		cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(20);
	};
}aaaaaaa;

/* const */
constexpr int32_t INF = 1001001001;
constexpr int64_t LINF = 1001001001001001001ll;
constexpr int32_t MOD = 1e9 + 7; //10^9
constexpr int64_t EPS = 1e-9;
constexpr int32_t dx[] = { 1, 1, 0, -1, -1, -1, 0, 1 }, dy[] = { 0, 1, 1, 1, 0, -1, -1, -1 };
//constexpr int32_t dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
//Counterclockwise from the 6o'clock direction
//Take the x-axis downward and the y-axis right


//g++ -std=c++14 -Wall --pedantic-errors -o template template.cpp
//g++ -std=c++14 -Wall --pedantic-errors template.cpp
//chcp 65001

/*global*/



//#define int int64_t
signed main()
{
	int n; cin >> n;
	vector<int> a(n);
	for(int i = 0, i_len = (int)n; i < i_len; ++i) cin >> a[i];
	vector<int> b(n);
	for(int i = 0, i_len = (int)n; i < i_len; ++i) b[i] = a[i];
	sort(b.begin(), b.end());

	for(int i = 0, i_len = (int)n; i < i_len; ++i){
		if(b[n-1] == a[i]){
			cout << b[n-2] << '\n';
		}
		else{
			cout << b[n-1] << '\n';
		}
	}
}

Measured memory_bytes: 3200
#include <iostream>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <math.h>
#include <vector>
#include <algorithm>
using namespace std;

int main(){
	int n;
	cin >> n;
	string s, t;
	cin >> s >> t;
	for(int i = 0; i< n; i++){
		if(s.substr(i, n) == t.substr(0, n - i)){
			cout << n + i << endl;
			return 0;
		}
	}
	cout << 2 * n << endl;
	return 0;
}

Measured memory_bytes: 256
S = gets.chomp.split('')
T = gets.chomp.split('')

# puts S.length - T.length

m = 10000
(S.length - T.length + 1).times do |f|
  c = 0
  T.length.times do |i|
    c+= 1 if T[i] != S[i+f]
  end
  m = c if c < m
end
puts m


Measured memory_bytes: 14356
import java.io.*;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc=new Scanner(new BufferedInputStream(System.in));
        int a=sc.nextInt();
        String b=sc.next();
        if(a<b.length())
            System.out.println(b.substring(0,a)+"...");
        else
            System.out.println(b);




    }
}


Measured memory_bytes: 38660
/*
    ##############################
    #  Author: Pratyush Gaurav   #
    #  College: NIT ROURKELA     #
    ##############################
*/
#include <bits/stdc++.h>

using namespace std;

typedef long long lli;
typedef long double ld;
typedef pair<lli, lli > plli;
typedef vector<lli> vlli;
typedef vector<plli > vplli;

#define scan(n) scanf("%lld",&n)
#define scan2(a,b) scanf("%lld %lld",&a,&b)
#define scan3(a,b,c) scanf("%lld %lld %lld",&a,&b,&c)
#define print(n) printf("%lld\n",n)
#define scanS(s) scanf("%s",&s)
#define printS(s) printf("%s",s)

#define ff first
#define ss second
#define rep(i,a) for(i = 0 ; i < a ; i++)
#define repr(i,a) for(i = a ; i >= 0 ; i--)
#define REP(i,a,b) for(i = a ; i <= b ; i++)
#define REPR(i,a,b) for(i = a ; i >= b ; i--)
#define mem(a,b) memset(a,b,sizeof(a))
#define opt ios_base::sync_with_stdio(false);cin.tie(NULL);
#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) ((a)*((b)/gcd(a,b)))
#define sqr(x) (x)*(x)
#define all(a) a.begin(),a.end()
#define pb push_back
#define popb pop_back

#define endl '\n'

const long long INF = 100000000000000000;
const long long MOD = 1000000007;
const long long MAXN = 100005;

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

void solve() {
    lli x1, y1, x2, y2 , x3, x4, y3, y4;
    cin >> x1 >> y1 >> x2 >> y2;
    lli i, j, d = sqr(x1 - x2) + sqr(y1 - y2);
    bool flag = true;
    REP(i, -1000, 1000) {
        REP(j, -1000, 1000) {
            if ((sqr(i - x1) + sqr(j - y1) == 2 * d) and (sqr(i - x2) + sqr(j - y2) == d) and ((y2 - y1)*(i - x2) - (j - y2)*(x2 - x1)) < 0) {
                cout << i << " " << j << " ";
                flag = false;
                break;
            }
        }
        if(!flag)
            break;
    }
    flag = true;
    REP(i, -1000, 1000) {
        REP(j, -1000, 1000) {
            if ((sqr(i - x1) + sqr(j - y1) == d) and (sqr(i - x2) + sqr(j - y2) == 2 * d and ((y2 - y1)*(i - x2) - (j - y2)*(x2 - x1)) < 0)) {
                cout << i << " " << j << " ";
                flag = false;
                break;
            }
        }
        if(!flag)
            break;
    }

}

int main()
{
    opt;
    lli t = 1;
    //cin >> t;

    while(t--)
        solve();
    return 0;
}

Measured memory_bytes: 384
import java.util.Scanner;

public class Main {

	public static final int BIG_NUM  = 2000000000;
	public static final int MOD  = 1000000007;

	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);
		int x = scanner.nextInt();
		int y = scanner.nextInt();

		System.out.println(gcd(Math.max(x, y),Math.min(x, y)));
	}

	public static int gcd(int a,int b){

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



Measured memory_bytes: 26264
package main

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

var sc = bufio.NewScanner(os.Stdin)

func Scan() string {
	sc.Scan()
	return sc.Text()
}
func iScan() int {
	n, _ := strconv.Atoi(Scan())
	return n
}
func fScan() float64 {
	n, _ := strconv.ParseFloat(Scan(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func SScan(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scan()
	}
	return a
}
func iSScan(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = iScan()
	}
	return a
}
func abs(x int) int {
	if x < 0 {
		x = -x
	}
	return x
}
func larger(a, b int) int {
	if a < b {
		return b
	} else {
		return a
	}
}
func smaller(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}
func max(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x < a[i] {
			x = a[i]
		}
	}
	return x
}
func min(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x > a[i] {
			x = a[i]
		}
	}
	return x
}
func sum(a []int) int {
	x := 0
	for _, v := range a {
		x += v
	}
	return x
}

var mod int = 1000000007

func main() {
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	n, a, b, c, d, e := iScan(), iScan(), iScan(), iScan(), iScan(), iScan()
	m := min([]int{a, b, c, d, e})
	ans := (n-1)/m + 5
	fmt.Println(ans)
}


Measured memory_bytes: 1772
from itertools import combinations
import sys
readline = sys.stdin.readline
write = sys.stdout.write
def solve():
    N, S = map(int, readline().split())
    if N == 0:
        return False
    ans = 0
    for p in combinations(range(10), N):
        if sum(p) == S:
            ans += 1
    write("%d\n" % ans)
    return True
while solve():
    ...



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

int point(int R, int S, int P, char t, string &hand, int i){
  if(t=='p'){
    hand.at(i) = 's';
    return S;
  }
  else if(t=='r'){
    hand.at(i) = 'p';
    return P;
  }
  else{
    hand.at(i) = 'r';
    return R;
  }
}

char resp(char s){
  if (s=='s'){
    return 'r';
  }
  else if(s=='r'){
    return 'p';
  }
  else{
    return 's';
  }
}

int point2(int R, int S, int P, char t, char s, string &hand, int i, int K){
  if (t==s){
    if (hand.at(i-K)!='o'){
      hand.at(i) = 'o';
      return 0;
    }
    else{
      return point(R,S,P,t,hand,i);
    }
  }
  else{
    return point(R,S,P,t,hand,i);
  }
}

int main(){
  int N, K, R, S, P;
  cin >> N >> K >> R >> S >> P;
  string T;
  cin >> T;
  string hand=T;
  int score = 0;
  char t, s;
  for (int i=0; i<N; i++){
    t = T.at(i);
    if(i-K<0){
      score += point(R,S,P,t,hand,i);
    }
    else{
      s = T.at(i-K);
      score += point2(R,S,P,t,s,hand,i,K);
    }
  }
  cout << score << endl;
}

Measured memory_bytes: 512
#include <cstdio>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

int main(void)
{
    int x,a;
    cin >>x >>a;

    if(x < a){
        printf("0\n");
    }else{
        printf("10\n");
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> vvl;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvec;
typedef vector<vector<bool>> vveb;
typedef vector<vector<string>> vves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pb push_back
#define pp pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
typedef long long int64;
//const int64 INF = 1LL << 58;
#define dame { puts("-1"); return 0;}
#define YES { cout << "YES" << endl; return 0; }
#define NO { cout << "NO" << endl; return 0; }
#define Yes { cout << "Yes" << endl; return 0; }
#define No { cout << "No" << endl; return 0; }
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
int dx[] = {0, 0, -1, 1};
int dy[] = {1, -1, 0, 0};

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

    int n;
    string s;
    cin >> n >>s;
    int counter=1;
    rep(i,n-1){
        if(s[i] != s[i+1]) counter++;
    }
    cout << counter << endl;
    return 0;
    
}

Measured memory_bytes: 512
#define _CRT_SECURE_NO_WARNINGS

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

typedef unsigned int uint;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<ii> vii;
typedef vector<vi> vvi;
typedef map<int, int> mii;
typedef pair<int, ii> edge;


#define sc(x)  scanf("%d",&x)
#define scl(x) scanf("%lld",&x)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define mem(arr,val) memset(arr,val,sizeof arr)
#define sz(v) (int)v.size()
#define rsz(v) v.resize
#define clr(v) v.clear()
#define rev(v) reverse(all(v))
#define lop(i,end) for(int i=0; i<end; i++)
#define rlop(i,start) for(int i=start-1; i>=0; i--)
#define loop(i,start,end) for(int i=start; i<end; i++)
#define rloop(i,start,end) for(int i=start-1; i>=end; i--)
#define PB push_back
#define pb pop_back
#define mP make_pair
#define f first
#define s second

const ll OO = (ll)(4e18) + 9;
const int MOD = (int)(1e9) + 7;
const int oo = 2147483647;
const double EPS = 1e-8;
const double PI = acos(-1.0);

//enum dir { D, R, U, L , dr, ur, dl, ul };
int dx[] = { 1, 0, -1, 0, 1, -1, 1, -1 };
int dy[] = { 0, 1, 0, -1, 1, 1, -1, -1 };

string abc = "abcdefghijklmnopqrstuvwxyz";
string vowels = "aeiouy"; //and sometimes "aeiouy"

template<typename X, typename Y> bool ckmin(X& a, Y b) { return a > b ? a = b, true : false; }
template<typename X, typename Y> bool ckmax(X& a, Y b) { return a < b ? a = b, true : false; }
bool cklex(string &a, string b) {
	if (b == "") return false;
	if (a == "") return a = b, true;
	if (sz(a) < sz(b)) return false;
	if (sz(b) < sz(a)) return a = b, true;
	if (a < b) return false;
	return a = b, true;
}

int dcmp(ld d1, ld d2) { return fabs(d1 - d2) <= EPS ? 0 : d1 > d2 ? 1 : -1; } //Compare Double Numbers
ll gcd(ll x, ll y) { return !y ? x : gcd(y, x%y); }
ll lcm(ll a, ll b) { return a * (b / gcd(a, b)); }
int conv_2_1(int r, int c, int nCol) { return (nCol*r) + c + 1; } //convert index from 2D array to 1D array. (Zero-indexed)
ii conv_1_2(int n, int nCol) { return{ n / nCol, n % nCol }; } //convert index from 1D array to 2D array (row, col). (Zero-indexed)
template<typename T> void inter(T X) { cout << X << endl; fflush(stdout); }



void _solveD_() {

}

void _solveC_() {

}

void _solveB_() {

}

void _solveA_() {
	string s;
	cin >> s;
	if (s.back() == 's') s += "es";
	else s += 's';
	cout << s << endl;
}

int main()
{
	//freopen("in.txt", "r", stdin);
	//freopen("out.txt", "w", stdout);
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	int t = 1, tt = 0;
	//cin >> t;
	while (tt++ != t) {
		_solveA_();
	}


	return 0;
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,o,n) for(long long i = o;i<n;i++)
#define oneforall ios::sync_with_stdio(false);cin.tie(0);
#define all(v) (v).begin(),(v).end()
#define ini(...) int __VA_ARGS__; in(__VA_ARGS__)
#define inl(...) long long __VA_ARGS__; in(__VA_ARGS__)
#define ins(...) string __VA_ARGS__; in(__VA_ARGS__)
#define int long long 
const long long inf=1e18;
void in(){} template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);}
void out(){cout << "\n";} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);}
typedef vector<int> vi;
typedef vector<long long> vl;
typedef long long ll;
typedef vector<pair<long, long > > vpll;
typedef vector<pair<int, int > > vpii;
#define FORR(x,arr) for(auto& x:arr)
#define ZERO(a) memset(a,0,sizeof(a))





//3111111111111111111111111111111
	


	void solve(){


		ini(n);
		ini(n1);
		out(n+n1/2);
		






	}























int32_t main() {
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall 
	oneforall

	solve();
	


	return 0;
}


Measured memory_bytes: 256