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

//      DEEP

using namespace std;
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define all(v) v.begin(),v.end()
#define pb push_back
#define endl '\n'
#define mp make_pair

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef pair<int,int> pi;
typedef pair<long long,long long> pll;
typedef set<int> si;
const ll mod = 1e9 + 7;
const ll modl=998244353;
const double pie=3.1415926535;
                                                    //power
ull power(ull x,ull y){
   if(y==0) return 1;
   else{
     if(y%2==0) return power(x*x,y/2);
     else return x*power(x*x,(y-1)/2);
   }
}

                        //                    Modular Exponentiation

ll mod_power(ll x, ll y, ll m)
{
    ll r = 1;     // Initialize result

    x = x % m; // Update x if it is more than or equal to m

    if (x == 0) return 0; // In case x is divisible by m;

    while (y > 0)
    {
        // If y is odd, multiply x with result
        if (y & 1)
            r = (r*x) % m;

        // y must be even now
        y = y/2;
        x = (x*x) % m;
    }
    return r;
}

                                                      //GCD
ll gcd(ll x,ll y){
   if(y==0)return x;
   return gcd(y,x%y);
}
                                              // SIEVE

/*
bool isPrime[100001];
void sieve(int N) {

        for(int i = 0; i <= N;++i) {
            isPrime[i]=true;
        }
        isPrime[0]=false;
        isPrime[1]=false;

        for(int i = 2; i * i <= N; ++i) {
             if(isPrime[i] == true) {
                 for(int j = i * i; j <= N ;j += i)
                     isPrime[j] = false;
            }
        }
    }
*/
void transpose(int xl,int xr,int yl,int yr){

}
int main(){
    boost;
    int TESTS=1;
    //cin>>TESTS;
    while(TESTS--){
      int n;
      cin>>n;
      map<string,int>M;
      for(int i=1;i<=n;i++){
        string s;
        cin>>s;
        M[s]++;
      }
      cout<<M.size()<<endl;
    }

  }












Measured memory_bytes: 19164
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> P;
typedef vector<ll> VI;
typedef vector<VI> VVI;
const ll MOD = 998244353;
const ll INF = 1e18;
#define REP(i,n) for(int i=0;i<n;i++)
#define ALL(v) v.begin(),v.end()

int main(){
	int n, k; cin >> n >> k;
	VI l(k), r(k);
	REP(i,n) cin >> l[i] >> r[i];
	VI dp(n); dp[0]=1; dp[1]=-1;
	ll now=0;
	for(int i=0;i<n;i++){
		now=(now+dp[i])%MOD;
		REP(j,k){
			int lp=i+l[j], rp=i+r[j]+1;
			if(lp<n)
				dp[lp]=(dp[lp]+now)%MOD;
			if(rp<n)
				dp[rp]=(dp[rp]-now+MOD)%MOD;
		}
	}
	cout << now << endl;
	return 0;
}

Measured memory_bytes: 4804
#include <iostream>
using namespace std;
typedef long long int LLI;
int main()
{
	int a, b, c, min = 30000;
	cin >> a >> b >> c;
	if( min > a + b )
		min = a + b;
	if( min > a + c )
		min = a + c;
	if( min > c + b )
		min = c + b;
	cout << min;
	return 0;
}

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

static class Extensions
{
    public static int ToInt(this string s) => int.Parse(s);
    public static long ToLong(this string s) => long.Parse(s);
    public static char ToChar(this string s) => char.Parse(s);
    public static double ToDouble(this string s) => double.Parse(s);
    public static int[] ToIntArray(this string s) => s.Replace(',', ' ').Split(' ').Select(x => x.ToInt()).ToArray();
    public static long[] ToLongArray(this string s) => s.Replace(',', ' ').Split(' ').Select(x => x.ToLong()).ToArray();
    public static double[] ToDoubleArray(this string s) => s.Replace(',', ' ').Split(' ').Select(x => x.ToDouble()).ToArray();
    public static Queue<T> ToQueue<T>(this IEnumerable<T> seq) => new Queue<T>(seq);
    public static Stack<T> ToStack<T>(this IEnumerable<T> seq) => new Stack<T>(seq);
    public static HashSet<T> ToHashSet<T>(this IEnumerable<T> seq) => new HashSet<T>(seq);
}
static class MyMath
{
    static public long GCD(long a, long b) => (a < b) ? GCD(b, a) : ((b == 0) ? a : GCD(b, a % b));
    static public long LCM(long a, long b) => (a > b) ? (a / GCD(a, b) * b) : (b / GCD(a, b) * a);
    static private readonly long _m = 1000000000 + 7;
    static public long Mod(long val) => (val % _m + _m) % _m;
    static private long ExtGCD(long a, long b, ref long x, ref long y) => (b == 0) ? (a + (x = 1) * 0 + (y = 0) * 0) : (ExtGCD(b, a % b, ref y, ref x) + (y -= a / b * x) * 0);
    static private long ModInverseInner(long a, long dummy1 = 0, long dummy2 = 0) => ExtGCD(a, _m, ref dummy1, ref dummy2) * 0 + Mod(dummy1);
    static public long ModInverse(long a) => ModInverseInner(a, 0, 0);
}

class Program
{
    static string[] ReadLines(int n) => Enumerable.Range(0, n).Select(s => Console.ReadLine()).ToArray();

    static void Main()
    {
        var nd = Console.ReadLine().ToIntArray();
        int N = nd[0];
        int D = nd[1];

        var pointList = ReadLines(N).Select(line => line.ToIntArray()).ToArray();

        int ans = 0;

        for (int i = 0; i < pointList.Length; i++)
        {
            for (int j = i + 1; j < pointList.Length; j++)
            {
                var p1 = pointList[i];
                var p2 = pointList[j];
                long distSqr = p1.Zip(p2, (x1, x2) => (long)(x1 - x2) * (long)(x1 - x2)).Sum();

                if (Math.IEEERemainder(Math.Sqrt(distSqr), 1) == 0)
                {
                    ans++;
                }
            }
        }

        Console.WriteLine(ans);
    }
    
}

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

#define LL long long
#define fi first
#define se second
#define mp make_pair
#define pb push_back

using namespace std;

LL gcd(LL a,LL b){return b?gcd(b,a%b):a;}
LL lcm(LL a,LL b){return a/gcd(a,b)*b;}
LL powmod(LL a,LL b,LL MOD){LL ans=1;while(b){if(b%2)ans=ans*a%MOD;a=a*a%MOD;b/=2;}return ans;}
const int N = 2e5 +11;
int main(){
	ios::sync_with_stdio(false);
	int a,b,c;
	cin>>a>>b>>c;
	if((c>a&&b>c)||(b<c&&c<a))cout<<"Yes";
	else cout<<"No";	
	return 0;
}

Measured memory_bytes: 256
n,k=map(int,input().split())
xy=[list(map(int,input().split())) for _ in range(n)]

x_index=set([])
y_index=set([])

for (x,y) in xy:
    x_index.add(x)
    y_index.add(y)
    
####座標圧縮

x_index=list(x_index)
y_index=list(y_index)

x_index.sort()
y_index.sort()
ans=0
for xl in range(len(x_index)-1):
    for xr in range(xl+1,len(x_index)):
        for yl in range(len(y_index)-1):
            for yr in range(yl+1,len(y_index)):
                cnt=0
                for (x,y) in xy:
                    if x_index[xl]<=x and x<=x_index[xr] and y_index[yl]<=y and y<=y_index[yr]:
                        cnt+=1
                if cnt==k:
                    tmp=(x_index[xr]-x_index[xl])*(y_index[yr]-y_index[yl])
                    if ans==0:
                        ans=tmp
                    else:
                        ans=min(ans,tmp)
print(ans)






    


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

const int N = 3e3 + 7;

vector <int> ad[N];
int a[N], n, ord[N];
bool w[N];

int main() {
	cin >> n;
	for (int i = 1; i <= n; i++)
		cin >> a[i], ord[i] = i;
	for (int i = 1; i < n; i++) {
		int v, u;
		cin >> v >> u;
		ad[v].push_back(u);
		ad[u].push_back(v);
	}
	sort (ord + 1, ord + n + 1, [](int v, int u) {
		return a[v] < a[u];		
	});
	vector <int> res;
	for (int i = 1; i <= n; i++) {
		int v = ord[i];
		for (auto u: ad[v])
			if (a[u] >= a[v])
				continue;
			else
				w[v] |= 1 ^ w[u];
		if (w[v])
			res.push_back(v);
	}
	sort (res.begin(), res.end());
	for (auto u: res)
		cout << u << " ";
	return 0;
}

Measured memory_bytes: 512
#include <iostream>

using namespace std;

int main() {
    string s;
    cin >> s;
    int n = 0;
    for (int i = 0; i < s.length(); i++) {
        if (s[i] == '+') {
            ++n;
        } else {
            --n;
        }
    }
    cout << n << "\n";
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void){

	long N,x;
    long a[100000];
    long i;
    long eat;
    long sum,o;
    
    scanf("%ld %ld",&N,&x);
    
    for(i=0;i<N;i++){    
    	scanf("%ld",&a[i]);        
    }
        
    for(i=0;i<N-1;i++){    

		sum=a[i]+a[i+1];
        o=sum-x;
    
    	if(o>0){
        	eat+=o;
        
        	if(a[i+1]>o){
				a[i+1]-=o;
            }
        	else{
            	a[i+1]=0;
            }            
        }
    }
    
    printf("%ld\n",eat);
        
    return 0;
        
}


Measured memory_bytes: 896
#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;
int main(){

  int a,l,x,i=0;
  double M[100000],c,d,e,f;

  while(scanf("%d%d%d",&a,&l,&x) != EOF){
    
    c=(double)((2*x*l)+(x*x))/4;
    e=l*l-(double)(a*a)/4;
    d=sqrt(c);
    f=sqrt(e);
    M[i]=((double)a/2)*f+l*d;
    
    i++;
  }
  

  for(int j=0 ; j < i ; j++){
    printf("%.10f\n",M[j]);
  }
    
	

  return 0;

}

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

int main() {
	int A , B;
  	cin >> A >> B;
  	int kaibun_number = 0;
  	int a , b ;
  	// a と b は後で比べるために最初のA と B を残しておくためのコピー
	a = A;
  	b = B;
  	int A2, B2;
    // A2 と　B2 は5桁の先頭3桁を切り出した数
  	A2 = A / 100;
  	B2 = B / 100;
	// 回分は A2からB2までの個数なので B2 から A2 を引いて 1 足した数
  	kaibun_number = B2 - A2 + 1;
    // ただし、A2（先頭）とB2（末尾）の回文は、A と B に含まれていない可能性があるので
    // A2の回文がAより小さい場合とB2の回文がBより大きい場合はkaibun_numberから引く必要がある
    int AM , AS , BM , BS;
	// Aの5桁目をAM、Aの4桁目をAS、Bの5桁目をBM、Bの4桁目をBSとする
  	AM = A / 10000;
	A = A % 10000;
	AS = A / 1000;
	BM = B / 10000;
	B = B % 10000;
	BS = B / 1000;
  	//もし、もともとのAの値（つまりa）が、A2 * 100 + AS * 10 + AMより大きかったら
  	// kaibun_numberにA2を含めてはいけないので、kaibun_numberから1引く必要がある
	if(a > A2 * 100 + AS * 10 + AM){
 		kaibun_number -= 1;
	}
  	//もし、もともとのBの値（つまりb）が、B2 * 100 + BS * 10 + BMより小さかったら
  	// kaibun_numberにA2を含めてはいけないので、kaibun_numberから1引く必要がある
	if(b < B2 * 100 + BS * 10 + BM){
 		kaibun_number -= 1;
	}
  	cout << kaibun_number << endl;
}


Measured memory_bytes: 256
import itertools
N,M=map(int,input().split())
edges=set()
for _ in range(M):
  a,b =map(int,input().split())
  edges.add((a,b))
  edges.add((b,a))
  
  
answer=0


for p in itertools.permutations(range(1,N+1)):
  if p[0] !=1:
    continue
  bl=True
  for i in range(N-1):
    if(p[i],p[i+1]) not in edges:
      bl =False
      break
  if bl:
    answer +=1
    
    
print(answer)

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

#define lli long long int
#define REP(i,s,l) for(lli i=s;i<l;i++)
#define DEBUG 0
#define INF (1LL<<50)
#define MOD 1000000007

int main()
{
    string a, b;
    char an, bn;
    cin >> a >> b;

    if(a.length()>b.length()) cout << "GREATER" << endl;
    else if(a.length()<b.length()) cout << "LESS" << endl;
    else{
        for(lli i=0; i<a.length(); i++){
            an = a[i];
            bn = b[i];
            if((an-'0')>(bn-'0')){
                cout << "GREATER" << endl;
                break;
            }
            else if((an-'0')<(bn-'0')){
                cout << "LESS" << endl;
                break;
            }
            else if(i==a.length()-1){
                cout << "EQUAL" << endl;
                break;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<functional>
#include<math.h>
using namespace std;
#define N (1000000000+7)
#define M (998244353)
#define INF 1e16
typedef long long ll;
typedef pair<ll,ll> P;
 
vector<ll>g[10010];
bool visited[10010];
int main(void){
    ll S;
    cin>>S;
    ll x1 = 0,y1 = 0;
    ll x2 = 1,y2 = 1000000000;
    if(S<=1000000000){
        cout<<x1<<" "<<y1<<" "<<x2<<" "<<" "<<y2<<" "<<0<<" "<<S<<endl;
    }
    else{
        ll c = 0;
        if(S%1000000000==0)c=S/1000000000;
        else c = S/1000000000 + 1;
        cout<<x1<<" "<<y1<<" "<<" "<<x2<<" "<<" "<<y2<<" "<<c<<" "<<c*1000000000-S<<endl;
    }
    return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define rep(i,x,y) for(int i=x;i<y;i++)
#define range(a) (a).begin(),(a).end()
#define print(A,x,n) rep(i,0,n){cout<<(i ? " ":"")<<A[i]x;}cout<<endl;
#define pprint(A,y,m,n) rep(j,0,m){print(A[j],y,n);}
const long mod=1e9+7;
const int size=1e5;
const int inf=1e9;
int main(){
	string s,t; cin>>s>>t;
	int dp[s.size()+1][t.size()+1]={};
	rep(i,1,s.size()+1)rep(j,1,t.size()+1){
		if(s[i-1]==t[j-1]) dp[i][j]=dp[i-1][j-1]+1;
		else dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
	}
	string ans="";
	int a=s.size(),b=t.size();
	int lgh=dp[s.size()][t.size()];
	while(lgh){
		if(s[a-1]==t[b-1]){
			ans=s[a-1]+ans;
			a--; b--;
			lgh--;
		}else{
			if(dp[a-1][b] > dp[a][b-1]) a--;
			else b--;
		}
	}cout<<ans<<endl;
}

Measured memory_bytes: 35456
N = int(input())
x = []
y = []
for i in range(N):
    x1,y1=[int(i) for i in input().split()]
    x.append(x1)
    y.append(y1)

count = 0

for i in range(N):
    count += y[i] - x[i] + 1 

print(count)

Measured memory_bytes: 3060
N, M = map(int, input().split())
X = [int(v) for v in input().split()]
if N >= M:
    print(0)
else:
    Xs = list(sorted(X))
    Xd = [Xs[i + 1] - Xs[i] for i in range(M - 1)]
    Xds = list(sorted(Xd)) #区間の数はM-1になってるから、これから大きい順に落としてN個の区間にする
    if N > 1:
        Xdsl = Xds[:-(N - 1)]
    else:
        Xdsl = Xds

    print(sum(Xdsl))


Measured memory_bytes: 13840
/* 
Hey there stalker....
 
█▀▀▄░░░░░░░░░░░▄▀▀█
░█░░░▀▄░▄▄▄▄▄░▄▀░░░█
░░▀▄░░░▀░░░░░▀░░░▄▀
░░░░▌░▄▄░░░▄▄░▐▀▀
░░░▐░░█▄░░░▄█░░▌▄▄▀▀▀▀█ 
░░░▌▄▄▀▀░▄░▀▀▄▄▐░░░░░░█
▄▀▀▐▀▀░▄▄▄▄▄░▀▀▌▄▄▄░░░█
█░░░▀▄░█░░░█░▄▀░░░░█▀▀▀
░▀▄░░▀░░▀▀▀░░▀░░░▄█▀
░░░█░░░░░░░░░░░▄▀▄░▀▄
░░░█░░░░░░░░░▄▀█░░█░░█
░░░█░░░░░░░░░░░█▄█░░▄▀
░░░█░░░░░░░░░░░████▀
░░░▀▄▄▀▀▄▄▀▀▄▄▄█▀
 
Like what you see?
*/
#include <bits/stdc++.h>
using namespace std;
 
#define fastIO ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
#define endl '\n'
#define ld long double
#define lli long long int
#define p_b push_back
#define m_p make_pair
#define fs first
#define sc second
#define all(x) x.begin(),x.end()
#define fr(i,a,n) for(lli i=a; i<n; i++)
#define fre(i,a,n) for(lli i=a; i<=n; i++)
const lli mod = 1e9 + 7;
/*****************************************************/
lli w[105],v[105],dp[105][100002]={-1};
lli F(lli n,lli W)
{
    if(n==0 || W==0)
        return 0;
    if(w[n]>W)
    {
        if(dp[n-1][W]!=-1)
            return dp[n-1][W];
        else
        {
            lli a=F(n-1,W);
            dp[n-1][W]=a;
            return a;
        }
    }
    else
    {
        lli a;
        if(dp[n-1][W]!=-1)
            a=dp[n-1][W];
        else 
        {
            a=F(n-1,W);
            dp[n-1][W]=a;
        }
        lli b;
        if(dp[n-1][W-w[n]]!=-1)
            b=v[n]+dp[n-1][W-w[n]];
        else
        {
            b=v[n]+F(n-1,W-w[n]);
            dp[n-1][W-w[n]]=b-v[n];
        }
        return max(a,b);
    }
}
int main()
{
    fastIO
    lli i,j,n,we;
    cin>>n>>we;
    for(i=1;i<=n;i++)
    {
        cin>>w[i]>>v[i];
    }
    fr(i,0,105)
    {
        fr(j,0,100002)
            dp[i][j]=-1;
    }
    cout<<F(n,we);
    //cerr<< '\n' << "Time elapsed :" << clock() * 1000.0 / CLOCKS_PER_SEC << " ms\n" ;
    return 0; 
} 


Measured memory_bytes: 82304
#include <cstdio>
#include <cstdint>
#include <cstdlib>
#include <vector>
#include <algorithm>

int testcase_ends() {
  size_t n;
  scanf("%zu", &n);
  if (n == 0) return 1;

  std::vector<int> a(n);
  for (auto& ai: a) scanf("%d", &ai);
  std::sort(a.begin(), a.end());

  int res = 1e7;
  for (size_t i = 1; i < n; ++i)
    res = std::min(res, std::abs(a[i]-a[i-1]));

  printf("%d\n", res);
  return 0;
}

int main() {
  while (!testcase_ends()) {}
}



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

using namespace std;

const int MAXN = 110;

int N, M;
char S[MAXN][MAXN];
int dp[MAXN][MAXN];

int main() {
   ios_base::sync_with_stdio(false); cin.tie(nullptr);
   cin >> N >> M;
   for (int i = 1; i <= N; ++i) {
      cin >> (S[i] + 1);
   }
   for (int i = 1; i <= N; ++i) {
      for (int j = 1; j <= M; ++j) {
         dp[i][j] = MAXN + MAXN;
      }
   }
   dp[1][1] = (S[1][1] == '#');
   for (int i = 1; i <= N; ++i) {
      for (int j = 1; j <= M; ++j) {
         if (i + 1 <= N) {
            dp[i + 1][j] = min(dp[i + 1][j], dp[i][j] + bool(S[i][j] == '.' && S[i + 1][j] == '#'));
         }
         if (j + 1 <= M) {
            dp[i][j + 1] = min(dp[i][j + 1], dp[i][j] + bool(S[i][j] == '.' && S[i][j + 1] == '#'));
         }
      }
   }
   cout << dp[N][M] << "\n";
   return 0;
}


Measured memory_bytes: 384
#define _CRT_SECURE_NO_WARNINGS
#include "stdio.h"
 
 
int main()
{
	int N, D,a=1,i;
	scanf("%d %d", &N, &D);
	if (N == 0) {
		a = 1;
	}else {
		for (i = 1; i <= N; i++) {
			a *= 100;
		}
	}
	if(D==100){
		D=101;
	}
		a = a * D;
 
	printf("%d\n", a);
 
    return 0;
}

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

namespace ConsoleApplication12
{
    class Program
    {
        static void Main(string[] args)
        {
            string strInputWord = Console.ReadLine();

            int intResultData = new int();

            while (true)
            {
                string strInputText = Console.ReadLine();

                if(strInputText == "END_OF_TEXT")
                {
                    break;
                }

                else
                {
                    foreach(string word in strInputText.Split(' '))
                    {
                        if (word.ToLower() == strInputWord.ToLower())
                        {
                            intResultData += 1;
                        }
                    }
                }
            }

            Console.WriteLine(intResultData);
        }
    }
}



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

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define MOD 1000000007

#define rep(i, n) for(ll (i) = 0LL;(i) < (ll)(n);(i)++)
#define rep2(i, s, e) for(ll (i) = (ll)(s);(i) < (ll)(e);(i)++)
#define repi(i, n) for(ll (i) = 0LL;(i) <= (ll)(n);(i)++)
#define repi2(i, s, e) for(ll (i) = (ll)(s);(i) <= (ll)(e);(i)++)
#define per(i, n) for(ll (i) = (ll)(n) - 1LL;(i) >= 0LL;(i)--)
#define per2(i, s, e) for(ll (i) = (ll)(s) - 1LL;(i) >= (ll)(e);(i)--)
#define peri(i, n) for(ll (i) = (ll)(n);(i) >= 0LL;(i)--)
#define peri2(i, s, e) for(ll (i) = (ll)(s);(i) >= (ll)(e);(i)--)
#define iter(i, it) for(auto &(i): (it))

template<typename T, typename U> ostream& operator<<(ostream &s, const pair<T, U> m) {
    cout << "(" << m.first << ", " << m.second << ")";
    return s;
}
template<typename T, typename U> ostream& operator<<(ostream &s, const map<T, U> m) {
    ll c = 0;
    cout << "{ ";
    iter(i, m) cout << i << (c++ == m.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const vector<T> &v) {
    cout << "{ ";
    rep(i, v.size()) cout << v[i] << (i == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const list<T> &v) {
    ll c = 0;
    cout << "{ ";
    iter(i, v) cout << i << (c++ == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}

int main(void) {
    ll N;
    ll gcd;
    cin >> N;
    cin >> gcd;
    rep(i, N - 1) {
        ll temp;
        cin >> temp;
        gcd = __gcd(temp, gcd);
    }
    cout << gcd << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <vector>
#include <map>
#include <bitset>
#include <string.h>
#include <cmath>
#include <queue>
#include <algorithm>
#define N 10005
#define P pair<int,int>
#define ll long long
#define mk(a, b) make_pair(a, b)
#define mem(a, b) memset(a, b, sizeof(a))
using namespace std;
int inf = 0x3f3f3f3f;
int  n, m;
struct ac{
	int e, l, c;
	bool operator < (const ac &x) const{
		return x.l < l;
	}
};
vector<ac> g[N];
bool vis[N];
int dis[N], mon[N];
void Dijkstra() {
	mem(dis, inf);
	mem(mon, inf);
	mem(vis, false);
	dis[1] = 0;
	mon[1] = 0;
	priority_queue<ac, vector<ac> >que;
	que.push((ac){1, 0, 0});
	while (!que.empty()) {
		ac first = que.top();
		que.pop();
		int e = first.e;
		int l = first.l;
		int c = first.c;
		// if (vis[e])	continue;
		if (dis[e] < l || vis[e])	continue;
		vis[e] = true;
		for (int j = 0; j < g[e].size(); ++j) {
			ac t = g[e][j];
			if (vis[t.e])	continue;
			if (l + t.l < dis[t.e]) {
				dis[t.e] = l + t.l;
				mon[t.e] = t.c;
				que.push((ac){t.e, dis[t.e], mon[t.e]});
			}else if (l + t.l == dis[t.e]) {
				mon[t.e] = min(mon[t.e], t.c);
			}
		}
	}

}
int main(){
// #ifndef ONLINE_JUDGE
//     freopen("in.txt", "r", stdin);
// #endif
	ios::sync_with_stdio(false);
	while (cin >> n >> m, n + m) {
		for (int i = 0; i < m; ++i) {
			int s, e, l, c;
			cin >> s >> e >> l >> c;
			g[s].push_back((ac){e, l, c});
			g[e].push_back((ac){s, l, c});
		}

		Dijkstra();
		int ans = 0;
		for (int i = 1; i <= n; ++i) {
			ans += mon[i];
			// cout << mon[i] << " ";
		}
		cout << ans << endl;
		for (int i = 1; i <= n; ++i) {
				g[i].clear();
		}
	}

	return 0;
}



Measured memory_bytes: 5164
#include <bits/stdc++.h>
#define INF 1e+9
#define MOD (int)1e9+7
#define debug(x) cerr << #x << ": " << x << "\n";
using namespace std;
using ll = long long;
using P = pair<int, int>;

template <size_t N>
class unionFindTree{
    private:
        int par[N];
        int rank[N];
    public:
        unionFindTree(){
            for(int i = 0; i < (int) N; i++){
                par[i] = i;
                rank[i] = 0;
            }
        }
        void init(){
            for(int i = 0; i < (int) N; i++){
                par[i] = i;
                rank[i] = 0;
            }
        }
        int find(int x){
            if(par[x] == x){
                return x;
            }else{
                return par[x] = find(par[x]);
            }
        }
        void unite(int x, int y){
            x = find(x);
            y = find(y);
            if(x == y) return;

            if(rank[x] < rank[y]){
                par[x] = y;
            }else{
                par[y] = x;
                if(rank[x] == rank[y]) rank[x]++;
            }
        }
        bool same(int x, int y){
            return find(x) == find(y);
        }
};

P x[100000], y[100000];
unionFindTree<100000> uf;
struct edge{
    int from, to, cost;
};

int main(void){
    int N; cin >> N;
    int inx, iny;
    for(int i = 0; i < N; i++){
        cin >> inx >> iny;
        x[i].first = inx; x[i].second = i;
        y[i].first = iny; y[i].second = i;
        // debug(i);debug(inx);debug(iny);debug(x[i].first);
    }
    sort(x, x + N); sort(y, y + N);

    // for(int i = 0; i < N; i++){
    //     debug(x[i].first); debug(x[i].second);
    // }
    // for(int i = 0; i < N; i++){
    //     debug(y[i].first); debug(y[i].second);
    // }

    vector<edge> es;
    for(int i = 0; i < N - 1; i++){
        edge e1 = {x[i].second, x[i+1].second, abs(x[i].first - x[i+1].first)};
        edge e2 = {y[i].second, y[i+1].second, abs(y[i].first - y[i+1].first)};
        es.push_back(e1); es.push_back(e2);
    }
    sort(begin(es), end(es), [](edge e1, edge e2){return e1.cost < e2.cost;});

    ll res = 0;

    // for(int i = 0; i < N; i++){
    //     debug(es[i].from); debug(es[i].to); debug(es[i].cost);
    // }

    for(auto e: es){
        if(uf.same(e.from, e.to)) continue;
        uf.unite(e.from, e.to);
        res += e.cost;
    }

    cout << res << '\n';
    return 0;
}

Measured memory_bytes: 7284
#include <iostream>
#include <algorithm>
#include <map>
#include <string>
#include <cmath>

#define mod 1000000007

using namespace std;
 
int main(void){
	
	int N, alice=0, bob=0;
	
	cin >> N;
	
	int a[N];
	
	for(int i=0; i<N; i++)
		cin >> a[i];
	
	sort(a, a+N);
	reverse(a, a+N);
	
	for(int i=0; i<N; i++){
		if(i%2 == 0)
			alice += a[i];
		else
			bob += a[i];
	}
	
	cout << alice - bob;
	
	return 0;
}

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

int main(){
 
  string S, T;
  cin >> S;
  cin >> T;
  
  for(int i = 0; i < S.size(); i++){
    
    if(S.at(i) != T.at(i)){
      
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}

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

#ifdef _DEBUG
    #include "/home/v-o_o-v/deb.h"
    #define deb(x...)cerr << "[" << #x << "] = [";_print(x);
#else
    #define deb(x...)
#endif

#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());


int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
   
    int n;
    cin >> n;
    int x = 1;
    while(x * 2 <= n)x *= 2;
    cout << x << '\n';
    return 0;
}
// Write Here


Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(long long i=0;i<x;i++)
#define repn(i,x) for(long long i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
vector<pair<string,P> >vec;
// vector<vector<int>> data(3, vector<int>(4));

void solve(long long N, long long K, vector<long long> H){
	SORT(H);
	ll c = 0;
	rep(i, N-K) {
		c += H[i];
	}
	cout << c << endl;
}

int main(){	
	long long N;
	long long K;
	scanf("%lld",&N);
	vector<long long> H(N-1+1);
	scanf("%lld",&K);
	for(int i = 0 ; i <= N-1 ; i++){
		scanf("%lld",&H[i]);
	}
	solve(N, K, H);
	return 0;
}



Measured memory_bytes: 3328
//#pragma GCC optimize "trapv"
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef unsigned long long int ulli;
typedef long double ld;
#define S 1000001
#define M 1000000007
#define nl cout<<"\n";
#define er  cout<<"\n***********\n";
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define test lli t;  cin>>t; while(t--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define Y cout<<"YES\n";
#define N cout<<"NO\n";
#define print(x)                 cout<<#x<<": "<<x<<endl;
#define print2(x, y)             cout<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl;
#define print3(x, y, z)          cout<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl;
#define print4(a, b, c, d)       cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl;
#define print5(a, b, c, d, e)    cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl;
#define print6(a, b, c, d, e, f) cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl;

int main()
{
    fast
    // test
    {
        lli l,r,d,ct=0;
        cin>>l>>r>>d;
        for(lli i=l;i<=r;i++)
        {
            if(i%d==0)
            ct++;
        }
        cout<<ct;
    }
}
//a+b=a?b+2?(a&b)
//__builtin_popcount(number)
//cout<<fixed<<setprecision(8)<<output<<"\n";




Measured memory_bytes: 3612
#include<bits/stdc++.h>
using namespace std ;
typedef long long ll ;


void solve(){
	
	int r,c ;
	cin>>r>>c ;

	char grid[r][c] ;

	for(int i=0;i<r;i++){
		for(int j=0;j<c;j++){
			cin>>grid[i][j] ;
		}
	}

	int dp[r][c] ;

	memset(dp,0,sizeof(dp)) ;

	dp[0][0]=1 ;

	for(int i=0;i<r;i++){
		for(int j=0;j<c;j++){

				if(i!=0)
					dp[i][j]+=dp[i-1][j]%1000000007 ;
				if(j!=0)
					dp[i][j]+=dp[i][j-1]%1000000007 ;

				if(grid[i][j]=='#')
					dp[i][j]=0 ;
			}
	}

	cout<<dp[r-1][c-1]%1000000007 ;
	
}	

int main(){


	
	int y ;

	y=1 ;
	//cin>>y ;

	while(y--)
	{	
		solve() ;
	}

}

Measured memory_bytes: 8480
#include <bits/stdc++.h>
using namespace std;
 
struct edge {int /*from,*/to,cost;};
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> VI;
typedef vector<long long int> VL;
typedef vector<edge> VE;
//static const int INF = 2147483647;
//static const long long INF = 9223372000000000000;
//static const long long INF = 9223372000000000000/2;
//static const long long INF = 9223372000000000000/2145;
static const int INF = 1000010000;
static const int NIL = -1;
static const int MOD = 1000000007;
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define np next_permutation
#define pq priority_queue
#define itn int
#define scnaf scanf
#define reutnr return
#define scamf scanf
//int dx4[4] = {0,1,0,-1}, dy4[4] = {-1,0,1,0};
//int dx5[5] = {-1,0,0,0,1}, dy5[5] = {0,-1,0,1,0};
//int dx8[8] = {-1,0,1,1,1,0,-1,-1}, dy8[8] = {1,1,1,0,-1,-1,-1,0};
//int dx9[9] = {-1,0,1,1,1,0,-1,-1,0}, dy9[9] = {1,1,1,0,-1,-1,-1,0,0};
//#define int ll

int n,c;
vector<pair<P,int> > tv;
P s[60];

void debug(){
    for(int j=0;j<tv.size();j++){
        printf("%d %d %d  ",tv[j].fi.fi,tv[j].fi.se,tv[j].se);
    }
    printf("\n");
}

bool isPoss(int m){
    for(int i=0;i<n;i++){
        bool rullonz = true;
        int a=NIL,c;
        for(int j=0;j<m;j++){
            if(s[j].fi<tv[i].fi.fi || s[j].se==tv[i].se && s[j].fi<=tv[i].fi.fi){
                if(s[j].fi>a) a = s[j].fi,c = j;
                rullonz = false;
            }
        }
        if(rullonz) return false;
        s[c].fi = tv[i].fi.se;
        s[c].se = tv[i].se;
    }
    return true;
}

void clearing(){
    for(int i=0;i<60;i++){
        s[i].fi = s[i].se = 0;
    }
}

signed main(){
    scanf("%d%d",&n,&c);
    for(int i=0;i<n;i++){
        int a,b,x;
        scanf("%d%d%d",&a,&b,&x);
        x--;
        tv.pb(mp(mp(a,b),x));
    }

    sort(all(tv));
    //debug();

    int ans = INF;
    for(int i=30;i>=1;i--){
        if(isPoss(i)) ans = i;
        clearing();
    }

    printf("%d\n",ans);
    return 0; 
}

Measured memory_bytes: 1912
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <string>
#include <map>
#include <queue>

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (a); i > (b); i--)
#define ALL(a) (a).begin(), (a).end()

int main() {
    int N, K, ans = 0;
    cin >> N >> K;
    REP(i, N) {
        int h;
        cin >> h;
        if (h >= K) ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 888
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int main(){
	int n,m;
	cin>>n>>m;
	int ml = 0,mr = n;
	for(int i = 0; i < m; i++){
		int l,r;
		cin>>l>>r;
		ml = max(l,ml);
		mr = min(r,mr); 
	}
	if(mr<ml)
		cout<<0<<endl;
	else 
		cout<<mr-ml+1<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<cstring>
#include<algorithm>
#include<cstdio>
using namespace std;
char s[205];
int main(){
    int n,t[105],m=0;
    char ch;
    scanf("%d",&n);
    getchar();
    while((ch=getchar())!='\n'){
        if(ch!=' ') t[m++]=ch-'A';
    }
    sort(t,t+m);
    m=unique(t,t+m)-t;
    if(m==3) printf("Three");
    else printf("Four");
}

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

namespace AtCoder.Abc
{
    class Question7
    {
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            // 文字列の入力
            //string s = Console.ReadLine();

            // 整数の入力
            long N = long.Parse(Console.ReadLine());

            // 文字列配列の入力
            //string[] inputStrArray = Console.ReadLine().Split(' ');

            // 整数配列の入力
            //var inputLongArray = Console.ReadLine().Split(' ').Select(i => long.Parse(i)).ToArray();

            int i;
            long[] d = new long[N];

            for (i = 0; i < N; i++)
            {
                d[i] = long.Parse(Console.ReadLine());
            }

            var cnt = d.Distinct().Count();



            string result = Convert.ToString(cnt);

            Console.WriteLine(result);

            Console.Out.Flush();
        }
    }
}


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

int main() {
	int A,B,count = 0;
	cin >> A >> B;
  	if(B == 1){
      cout << count << endl;
      return 0;
    }
  	count++;
  	int C = A;
	while(A < B){
      count++;
      A += C-1;
    }
  	cout << count << endl;
  	return 0;
}


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

int main() {
  
  string s;
  cin >> s;
  int size = s.size() - 1;
  int x;
  char y = s.at(size);
  x = y - '0';
  if(x == 2 || x == 4 || x == 5 || x == 7 || x == 9){
    cout << "hon" << endl;
  }
  else if(x == 0 || x == 1 || x == 6 || x == 8){
    cout << "pon" << endl;
  }
  else{
    cout << "bon" << endl;
  }
  
  
}



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

struct Card {
  char suit; 
  int value;
  int index;
};

void output(struct Card c[], int n){
  for(int i=0; i<n; i++){
    cout << c[i].suit << c[i].value << (i!=n-1 ? " " : "");
  }
  cout << endl;
}

void IsStable(struct Card c[], int n){
  for(int i = 0; i<n; i++){
    if((c[i].value == c[i+1].value) && (c[i].index > c[i+1].index)){
      cout << "Not stable" << endl;
      return;
    }
  }
  cout << "Stable" << endl;
  return;
}

void BubbleSort(struct Card c[], int n){
  for(int i=0; i<n; i++){
    for(int j=n-1; j>i; j--){
      if(c[j].value < c[j-1].value){
        swap(c[j],c[j-1]);
      }
    }
  }
  output(c, n);
  IsStable(c, n);
}

void SelectionSort(struct Card c[], int n){
  for(int i=0; i<n; i++){
    int minj = i;
    for(int j=i; j<n; j++){
      if(c[j].value < c[minj].value){ minj = j;}
    }
    swap(c[i], c[minj]);
  }
  output(c, n);
  IsStable(c, n);
}

int main(void){
  int n;
  cin >> n;
  Card c1[n], c2[n];
  for (int i=0; i<n; i++){
    cin >> c1[i].suit >> c1[i].value;
    c1[i].index = i;
  }

  for(int i=0; i<n; i++){
    c2[i] = c1[i];
  }

  BubbleSort(c1, n);
  SelectionSort(c2, n);
  return 0;
}



Measured memory_bytes: 3088
#include <bits/stdc++.h>
#define FOR(i,bg,ed) for(ll i=(bg);i<(ed);i++)
#define REP(i,n) FOR(i,0,n)
#define MOD 1000000007
//#define int long long
using namespace std;
typedef long long ll;
const int INF = 1e9;



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

    int Acnt = 0;
    REP(i,N) {
        string S;
        cin >> S;

        if (S == "A") {
            Acnt++;
        } else {
            if (Acnt <= 0) {
                cout << "NO" << endl;
                return 0;
            } else {
                Acnt--;
            }
        }
    }

    if (Acnt == 0) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
}

Measured memory_bytes: 3108
n = int(input())
input_list = [int(input()) for i in range(n)]
max_value = -2000000000
min_value = input_list[0]

for j in input_list[1:]:
    max_value = max(max_value, j - min_value)
    min_value = min(min_value, j)
print(max_value)



Measured memory_bytes: 15092
import sys
a=[1]*500000
for i in range(3,999,2):
 if a[i//2]:a[(i*i)//2::i]=[0]*len(a[(i*i)//2::i])
for e in map(int,sys.stdin):print([e-1,sum(a[:(e+1)//2])][e>3])


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

const int N = 22;
const int INF = N*N;

int n,m, d[N][N];
string a[N];

int main() {
    cin >> n >> m;
    for (int i = 0; i < n; i++) cin >> a[i];

    int ans = 0;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) if (a[i][j] == '.') {
            fill(d[0], d[n], INF);
            d[i][j] = 0;
            queue<pair<int,int>> q;
            q.emplace(i,j);
            while (!q.empty()) {
                auto u = q.front(); q.pop();
                int i,j; tie(i,j) = u;
                int di = 1, dj = 0;
                int iter = 4; while (iter--) {
                    int ni = i+di, nj = j+dj;
                    if (ni < 0 || nj < 0 || ni >= n || nj >= m || a[ni][nj] == '#' || d[ni][nj] < INF);
                    else {
                        if (d[ni][nj] == INF) {
                            d[ni][nj] = d[i][j] + 1;
                            q.emplace(ni,nj);
                            ans = max(ans, d[ni][nj]);
                        }
                    }
                    tie(di,dj) = make_pair(-dj,di);
                }
            }
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <algorithm>
#include <cmath>
using namespace std;

// Dragon Fantasy(2008)
class Point
{
public:
	int x, y;
	double d;
};

class LessDistance
{
public:
	bool operator() (const Point& lhs, const Point& rhs)
	{
		return lhs.d < rhs.d;
	}
};

const int cc[] = { 0, 1, 3, 7, 15, 31, 63, 127, 255, 511, 1023, 2047, 4095, 8191, 16383, 32767, 65535, 131071, 262143, 524287, 1048575 };

int n, dx, dy;

bool solve(int hx, int hy, int gc, double r, const vector<Point>& c)
{
	if (gc == cc[n])
		return true;

	bool yes = false;
	for (int i = 0; i < n; ++i) {
		if (gc & (1 << i))
			continue;
		double rr = r + sqrt(static_cast<double>((hx-c[i].x)*(hx-c[i].x) + (hy-c[i].y)*(hy-c[i].y)));
		double d = sqrt(static_cast<double>((dx-c[i].x)*(dx-c[i].x) + (dy-c[i].y)*(dy-c[i].y)));
		if (d <= rr)
			return false;
		yes |= solve(c[i].x, c[i].y, gc | (1 << i), rr, c);
		if (yes)
			break;
	}
	return yes;
}

int main()
{
	//freopen("2008.txt", "r", stdin);

	int hx, hy;
	while (scanf("%d %d %d %d %d", &n, &hx, &hy, &dx, &dy) != EOF) {
		if (n == 0 && hx == 0 && hy == 0 && dx == 0 && dy == 0)
			break;

		vector<Point> c(n);
		for (int i = 0; i < n; ++i) {
			scanf("%d %d", &c[i].x, &c[i].y);
			c[i].d = sqrt(static_cast<double>((dx-c[i].x)*(dx-c[i].x) + (dy-c[i].y)*(dy-c[i].y)));
		}
		sort(c.begin(), c.end(), LessDistance());

		if (solve(hx, hy, 0, 0.0, c))
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}
	return 0;
}

Measured memory_bytes: 920
a, b = map(int, input().split())
c = [1, 3, 5, 7, 8, 10, 12]
d = [4, 6, 9, 11]
e = [2]
if a in c and b in c:
  print("Yes")
elif a in d and b in d:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 3060
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<stack>
#include<queue>
#include<map>
#include<set>

using namespace std;

typedef long long ll;
typedef std::vector<int> VI;

#define FOR(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR1(i,n) for(int (i)=1;(i)<(n);(i)++)
#define eFOR(i,n) for(int (i)=0;(i)<=(n);(i)++)
#define eFOR1(i,n) for(int (i)=1;(i)<=(n);(i)++)
#define SORT(i) sort((i).begin(),(i).end())

int main() {

	int n, m;
	cin >> n >> m;
	ll ans = 1;
	if (n < m)swap(n, m);
	if (n - m > 1)ans = 0;
	else {
		eFOR1(i, m) {
			FOR(j, 2) {
				ans *= i;
				ans %= 1000000000 + 7;
			}
		}
		if (n - m == 1)ans *= n;
		else ans *= 2;
		ans %= 1000000000 + 7;
	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <array>
#include <algorithm>
#include <vector>
#include <string>
#include <set>
#include <cctype>
#include <map>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <ctype.h>


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

#define FOR(i,l,r) for(size_t i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)



using namespace std;

bool is_integer( float x ){
    return floor(x)==x;
}


int main() {
    int t[101];
    int p[101];
    int x[101];
    int n,m;
    int ans = 0;

    cin >> n;
    for(int i = 0; i < n; i ++) cin >> t[i];
    cin >> m;
    REP(i,m) cin >> p[i] >> x[i];

    REP(i,m){
        ans = 0;
        for(int j = 0; j < n; j ++){
            if(j+1 == p[i]) ans += x[i];
            else ans += t[j];
        }
        cout << ans << endl;
    }


    return 0;
}











Measured memory_bytes: 3616
#include <stdio.h>

int main()
{
    int a,b,c,d;

    scanf("%d %d %d %d",&a,&b,&c,&d);

    while(1)
    {        c -= b;

        if(c <= 0)
            break;
        a-=d;

        if(a<=0)
            break;


    }

    if(a <= 0)
        printf("No\n");
    if(c <= 0)
        printf("Yes\n");

    return 0;
}


Measured memory_bytes: 1632
#include <iostream>

using namespace std;

int main()
{
	long long x;
	cin >> x;
	if (x <= 6)
		cout << "1" << endl;
	else if(x > 6 && x <= 11)
		cout << "2" << endl;
	else
	{
		long long int n = x - (x / 11) * 11;
		if (n < 7 && n != 0)
			cout << (x / 11) * 2 + 1<< endl;
		else if (!n)cout << (x / 11) * 2 << endl;
		else cout << (x / 11)*2 + 2 << endl;
	}
    return 0;
}



Measured memory_bytes: 256
N = int(input())
A = list(map(int,input().split()))
L = []
for i in range(N):
  L.append(A[i]-i-1)
L.sort()
k = 0
if (N%2 == 0):
  k = (L[(N//2)-1]+L[N//2])/2
else:
  k = L[N//2]
ans = 0
for i in range(N):
  ans += abs(L[i]-k)
print(int(ans))

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

#define max 4

//qsort(d, n, sizeof(int), up_comp);
int up_comp(const void *a, const void *b){return *(int*)a - *(int*)b;}
int down_comp(const void *a, const void *b){return *(int*)b - *(int*)a;}

int main()
{
    int i, cnt=0;
    char s[max], t[max];
    
    scanf("%s %s", s, t);
    
    for (i=0; i<3; i++) {
        if (s[i]==t[i]) {
            cnt++;
        }
    }
    
    printf("%d", cnt);

    return 0;
}




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

int main() {
    string s, t, u;
    cin >> s >> t;

    int a, b;
    cin >> a >> b;

    cin >> u;

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

    }

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(void){
  int N, M;
  cin >> N >> M;
  vector<pair<ll, int> > drink;
  for(int i=0; i<N; i++) {
    ll a;
    int b;
    cin >> a >> b;
    drink.push_back(make_pair(a, b));
  }
  sort(drink.begin(), drink.end());
  int m = 0;
  ll ans = 0;

  for(int i=0; i<N; i++){
    int q = min(M-m, drink[i].second);
    m += q;
    ans += q*drink[i].first;
    if(m == M) break;
  }
  cout << ans << endl;
  
}

Measured memory_bytes: 2420
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <list>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <queue>
#include <iomanip>
#define INF 2147483647
 
using namespace std;

int gcd(int a, int b)
{
	int tmp, r;
	if (a < b) {
		tmp = a;
		a = b;
		b = tmp;
	}
	while (1) {
		r = a % b;
		if (r == 0) break;
		a = b;
		b = r;
	}

	return (b);
}

int lcm(int a, int b)
{
	int ans;

	ans = a * (b / gcd(a, b));

	return (ans);
}


int main(void)
{
	int n, ans, a;
	
	cin >> n;
	ans = 1;
	for (int i = 0; i < n; i++) {
		cin >> a;
		ans = lcm(a, ans);
	}

	cout << ans << endl;


	return (0);
}

Measured memory_bytes: 1160
s=input()
t=input()
len_t = len(t)
ans=len_t
change=0
for i in range(len(s)-len_t+1):
    ss=s[i:i+len_t]
    for j in range(len_t):
        if ss[j] != t[j]:
            change += 1
    ans=min(ans,change)
    change=0
print(ans)

Measured memory_bytes: 73100
#include<stdio.h>
int main(){
	int a,b,cnt;
	scanf("%d%d",&a,&b);
	for(a;a<=b;a++)
	{
		if(a%10==a/10000 && (a%100)/10==(a-a%1000-(a-a%10000))/1000) cnt++;
	}
	printf("%d",cnt);
	
}

Measured memory_bytes: 128
n = int(input())
p=[int(i)-1 for i in input().split()]
q=[int(i)-1 for i in input().split()]

fact = [1]*10
for i in range(2,10):
    fact[i] = fact[i-1]*i

index1 = 1
l = [i for i in range(n)]
while len(p)>0:
    i = p.pop(0)
    l.remove(i)
    cnt = len([k for k in l if k < i])
    index1 += cnt * fact[len(l)]


index2 = 1
l = [i for i in range(n)]
while len(q)>0:
    i = q.pop(0)
    l.remove(i)
    cnt = len([k for k in l if k < i])
    index2 += cnt * fact[len(l)]

print(abs(index1-index2))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define m1(x) memset(x,-1,sizeof(x))
const int INF = 1001001001;
const ll MOD = 1e9 + 7;
const double PI = 3.14159265358979;


int main(){
  int a, b, c, x;
  cin >> a >> b >> c >> x;
  a++;b++;c++;
  x /= 50;
  //10a + 2b+c = x
  int ans = 0;
  rep(i, a){
    rep(j, b){
      rep(k, c){
        if(10*i + 2*j + k == x) ans++;
      }
    }
  }
  cout << ans <<endl;
  
  
}

Measured memory_bytes: 3556
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define chmax(a, b) a = max(a, b);
#define chmin(a, b) a = min(a, b);
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define MOD 1000000007
//#define MOD 998244353
struct mint {
	int i;
	mint() : i(0) {}
	mint(int x) {
		i = int(x % MOD);
		if (i < 0) i += MOD;
	}
	template<class T> mint(T x) {
		i = int(x % MOD);
		if (i < 0) i += MOD;
	}
	mint operator+(const mint x) const {return i + x.i;}
	mint operator-(const mint x) const {return i - x.i;}
	mint operator*(const mint x) const {return (long long)i * x.i;}
	mint operator/(const mint x) const {return (long long)i * x.pow(MOD - 2).i;}
	mint inv() {return pow(MOD - 2);}
	template<class T> mint pow(T p) const {
		long long r = 1;
		long long t = i;
		for(; p > 0; p >>= 1) {
			if (p & 1) r = r * t % MOD;
			t = t * t % MOD;
		}
		return r;
	}
	template<class T1, class T2> static mint pow(T1 a, T2 b) {
		long long r = 1;
		long long t = (long long)(a % MOD);
		for(; b > 0; b >>= 1) {
			if (b & 1) r = r * t % MOD;
			t = t * t % MOD;
		}
		return r;
	}
	mint& operator+=(const mint x) {
		i = (i + x.i) % MOD;
		return *this;
	}
	mint& operator-=(const mint x) {
		i = i - x.i;
		if (i < 0) i += MOD;
		return *this;
	}
	mint& operator*=(const mint x) {
		i = (int)((long long)i * x.i % MOD);
		return *this;
	}
	mint& operator/=(const mint x) {
		i = (long long)i * x.pow(MOD - 2).i % MOD;
		return *this;
	}
};

std::ostream& operator<<(std::ostream& os, const mint& m) {
	return os << m.i;
}

struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < MOD);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
}comb(500010);

mint p(int n, int k) {
	return comb.fact[n]*comb.ifact[n-k];
}
int main() {
	int n, m;
	cin >> n >> m;
	mint ans = p(m, n);
	mint a = ans;
	for(int i = 1; i <= n; i++) {
		a += ((i&1) ? mint(-1) : mint(1)) * comb(n, i) * p(m-i, n-i);
	}
	ans *= a;
	cout << ans << endl;
}


Measured memory_bytes: 6992
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = (0); i < (n); ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define DEBUG(val) cout << #val << " : " << val << endl
#define MOD 1000000007

int main() {
  int h, w, a, b;
  cin >> h >> w >> a >> b;
  REP(t, b) {
    REP(i, a) cout << "0";
    REP(j, w - a) cout << "1";
    cout << endl;
  }
  REP(t, h - b) {
    REP(i, a) cout << "1";
    REP(j, w - a) cout << "0";
    cout << endl;
  }
}

Measured memory_bytes: 3632
import sys
sys.setrecursionlimit(10**6)

#a = int(input())
#b = list(map(int, input().split()))
n, d = map(int, input().split())
#s = input()
#s,t = input().split()
#a = [int(input()) for _ in range(n)]
#
readline = sys.stdin.readline
#n,m = [int(i) for i in readline().split()]
xy = [[int(i) for i in readline().split()] for _ in range(n)]

import math

ans = 0

for x,y in xy:
    dist = math.sqrt(pow(x,2) + pow(y,2))
    if dist <= d:
        ans += 1

print(ans)

Measured memory_bytes: 42396