akhauriyash/Code-Regression huggingface dataset:
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <algorithm>
#include <cassert>
#include <cfloat>
#include <complex>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define repLRE(i, l, r) for (ll i = (l); i <= (r); ++i)
#define rrepLRE(i, l, r) for (ll i = (l); i >= (r); --i)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define Lower_bound(v, x) \
  distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) \
  distance(v.begin(), upper_bound(v.begin(), v.end(), x))

using ll = long long;
using ull = unsigned long long;
using P = pair<ll, ll>;
using T = tuple<ll, ll, ll>;
using vll = vector<ll>;
using vP = vector<P>;
using vT = vector<T>;
using vvll = vector<vector<ll>>;
using vvP = vector<vector<P>>;
using dqll = deque<ll>;

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

/* Macros reg. ends here */

const ll INF = 1LL << 50;

ll lcm(ll n, ll m) { return (n / __gcd(n, m)) * m; }

int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cout << fixed << setprecision(15);

  ll h, w;
  cin >> h >> w;
  vector<string> mp(h);
  rep(i, h) cin >> mp[i];
  ll x = 0, y = 0;

  ll pre = -1;
  while (x < w || y < h) {
    bool rig = x + 1 < w && mp[y][x + 1] == '#';
    bool lef = x - 1 >= 0 && mp[y][x - 1] == '#';
    bool dow = y + 1 < h && mp[y + 1][x] == '#';
    bool upp = y - 1 >= 0 && mp[y - 1][x] == '#';
    bool chk = (pre == 0 && !upp) || (pre == 1 && !lef) || pre == -1;

    if (x == w - 1 && y == h - 1) {
      if (!chk) {
        puts("Impossible");
        return 0;
      } else
        break;
    }

    if (chk && rig && !dow) {
      x++;
      pre = 0;
    } else if (chk && !rig && dow) {
      y++;
      pre = 1;
    } else {
      puts("Impossible");
      return 0;
    }
  }

  puts("Possible");
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#define _USE_MATH_DEFINES
#include <math.h>
#include <cstring>
#include <numeric>
#include <algorithm>
#include <stdlib.h>
#include <functional>
#include <string>
#include <list>
#include <fstream>
#include <iomanip>
#include <array>
#include <map>
#include <queue>
#include <limits.h>
#include <set>
#include <stack>
#include <random>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <chrono>
#include <bitset>
#define rep(i,s,n) for(int i = (s); (n) > i; i++)
#define REP(i,n) rep(i,0,n)
#define RANGE(x,a,b) ((a) <= (x) && (x) <= (b))
#define DUPLE(a,b,c,d) (RANGE(a,c,d) || RANGE(b,c,d) || RANGE(c,a,b) || RANGE(d,a,b))
#define INCLU(a,b,c,d) (RANGE(a,c,d) && (b,c,d))
#define PW(x) ((x)*(x))
#define ALL(x) (x).begin(), (x).end()
#define MODU 1000000007
#define bitcheck(a,b)   ((a >> b) & 1)
#define bitset(a,b)      ( a |= (1 << b))
#define bitunset(a,b)    (a &= ~(1 << b))
#define MP(a,b) make_pair((a),(b))
#define Manh(a,b) (abs((a).first-(b).first) + abs((a).second - ((b).second))
#define pritnf printf
#define scnaf scanf
#define itn int

#include <nmmintrin.h>
#ifdef _MSC_VER

#define __builtin_popcount _mm_popcnt_u32
#define __builtin_popcountll _mm_popcnt_u64
#endif
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T &val) {
	std::fill((T*)array, (T*)(array + N), val);
}

struct Edge {
	int from, to, w;
};


int main() {

	int n;
	cin >> n;
	vector<int> num(n);
	vector<pii> st(n);
	map<int, int> ps;
	REP(i, n) {
		scnaf("%d", &num[i]);
		st[i] = { num[i],i };
	}
	sort(ALL(st));
	vector<int> ans(n);
	REP(i, n) {
		if (i < n / 2) {
			ans[st[i].second] = st[n / 2].first;
		}
		else {
			ans[st[i].second] = st[n / 2 - 1].first;
		}
	}

	REP(i, n) {
		printf("%d\n", ans[i]);
	}


	return 0;
}

Measured memory_bytes: 5376
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(),v.end()
#define puts(i) cout << i << endl
#define INF INT_MAX
#define INFL LLONG_MAX
typedef long long ll;
using namespace std;


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

  string a="ACL";
  rep(i,k-1){
    a+="ACL";
  }

  cout << a << endl;

}


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

namespace c
{
    class Program
    {
        public static int Main()
        {
            new Program().calc();
            return 0;
        }

        Scanner sc;

        public void calc()
        {
            sc = new Scanner();
            int w = sc.nextInt();
            int h = sc.nextInt();
            long ans = 0;


            int[] p = new int[w];
            int[] q = new int[h];
            for (int i = 0; i < w; i++)
            {
                p[i] = sc.nextInt();
            }
            for (int i = 0; i < h; i++)
            {
                q[i] = sc.nextInt();
            }
            Array.Sort(p);
            Array.Sort(q);
            int x = 0, y = 0;
            while (x < w && y < h)
            {
                if (p[x] <= q[y])
                {
                    ans += p[x] * (h + 1L - y);
                    x++;
                }
                else
                {
                    ans += q[y] * (w + 1L - x);
                    y++;
                }
            }
            while (x<w)
            {
                ans += p[x];
                x++;
            }
            while (y<h)
            {
                ans += q[y];
                y++;
            }
            Console.WriteLine(ans);
        }
    }


    class Scanner
    {
        string[] s;
        int i;

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

        public Scanner()
        {
            s = new string[0];
            i = 0;
        }

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

        public int nextInt()
        {
            return int.Parse(next());
        }

        public long nextLong()
        {
            return long.Parse(next());
        }

        public double nextDouble()
        {
            return double.Parse(next());
        }

    }
}

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

using namespace std;

using ll = long long;

int main() {
	int K, N;
	cin>>K>>N;
	vector<int> A(N);
	int max_d = INT_MIN;
	for (int i = 0;i < N;++i) {
		cin>>A[i];
	}

	for (int i = 1;i < N;++i) {
		max_d = max(max_d, A[i]-A[i-1]);
	}

	max_d = max(max_d, K-A[N-1]+A[0]);

	cout<<K-max_d<<endl;
	return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
const int MAXN = 100000;
const int INF  = 0x3f3f3f3f;
int main() {
    long long N,W;
    cin>>N>>W;
    long val[N];
    long weight[N];
    for(int i=0;i<N;i++){
        cin>>val[i]>>weight[i];
    }
    //cout<<"shue"<<endl;
    vector<long long>dp(MAXN+1, INF);
    dp[0]=0;
    for(int i=0;i<N;i++){
        for(int j=MAXN;j>=weight[i];j--){
            // if(weight[j]>W)
            //     dp[i]=max(dp[i], val[i]);
            // else
                dp[j]=min(dp[j], dp[j-weight[i]]+ val[i]);
        }
    }//cout<<dp[MAXN]<<"\n";
    long long ans=0;
    for(int i=MAXN;i>=0;i--){
        if(dp[i]<=W)
            ans=max(ans, (long long)i);
    }

    cout<<ans;
    return 0;
}


Measured memory_bytes: 1024
#include <vector>
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <limits.h>
#include <cmath>
#include <queue>
#include <map>
#include <iomanip>
#include <random>
#include <fstream>
#define rep(i, n) for (int i = 0; i < n; i++)
#define pi 3.14159265358979323846
using namespace std;
typedef long long ll;

ll gcd(ll a, ll b)
{
  ll r;
  while ((r = a % b))
  {
    a = b;
    b = r;
  }
  return b;
}

int main()
{

  int d; cin >> d;
  if (d==25){cout << "Christmas" << endl;}
  else if (d==24){cout << "Christmas Eve" << endl;}
  else if (d==23){cout << "Christmas Eve Eve" << endl;}
  else if (d==22){cout << "Christmas Eve Eve Eve" << endl;}

  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
	int x;
	
	public void solve(){
		Scanner sc = new Scanner(System.in);
		x = sc.nextInt();
		
		System.out.println(x*x*x);
	}
	
	public static void main(String[] args){
		Main obj = new Main();
		obj.solve();
	}
}

Measured memory_bytes: 17320
#coding: utf-8

n = int(input())

for i in range(1, n+1):
    x = i
    if x % 3 == 0:
        print(" " + str(x), end = '')
        continue
    

    for j in range(6):
        if int(x / (10**j)) % 10 == 3:
            print(" " + str(x), end = '')
            break
print("")


Measured memory_bytes: 5872
import java.util.*;
public class Main {
	static int n;
	static boolean[][][] vis=new boolean[301][301][301];
	static double[][][] dp=new double[301][301][301];
	public static double DP(int x,int y,int z) {
		if (vis[x][y][z]) return dp[x][y][z];
		vis[x][y][z]=true;
		double tot=x+y+z,lucky=n/tot;
		if (x>0) dp[x][y][z]+=x/tot*(lucky+DP(x-1,y,z));
		if (y>0) dp[x][y][z]+=y/tot*(lucky+DP(x+1,y-1,z));
		if (z>0) dp[x][y][z]+=z/tot*(lucky+DP(x,y+1,z-1));
		return dp[x][y][z];
	}
	public static void main(String[] args) {
		Scanner in=new Scanner(System.in);
		n=in.nextInt();
		int[] c=new int[3];
		for (int i=0;i<n;++i) {
			int x=in.nextInt();
			--x;
			++c[x];
		}
		System.out.printf("%.12f\n",DP(c[0],c[1],c[2]));
	}
}

Measured memory_bytes: 296616
N, K = map(int, input().split())
D = [Di for Di in input().split()]
for n in range(N, 1000000000):
    n = str(n)
    flag = True
    for i in range(len(str(n))):
        if n[i] in D:
            flag = False
            break
    if flag is True:
        print(n)
        exit()

Measured memory_bytes: 3060
#include <stdio.h>
// max1 >= max2
int main(int argc, char * argv[]) {
    int n, max1, max2, pos1, pos2;
    scanf("%d", &n);
    int a[n];
    scanf("%d", &a[0]);
    scanf("%d", &a[1]);
    if(a[0] >= a[1]){
        max1 = a[0];
        pos1 = 0;
        max2 = a[1];
        pos2 = 1;
    }else{
        max1 = a[1];
        pos1 = 1;
        max2 = a[0];
        pos2 = 0;
    }
    for(int i = 2;i < n;i++){
        scanf("%d", &a[i]);
        if(max1 < a[i]){
            max1 = a[i];
            pos1 = i;
        }else if(max2 < a[i]){
            max2 = a[i];
            pos2 = i;
        }
    }
    for(int i = 0;i < n;i++){
        if(pos1 != i){
            printf("%d\n", max1);
        }else{
            printf("%d\n", max2);
        }
    }
    return 0;
}

Measured memory_bytes: 2304
#include <iostream>
#include <vector>
#include <stdio.h>
#include <cmath>

using namespace std;

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

  int a[101], b[101];
  for (int i = 0; i < N; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < N; i++) {
    cin >> b[i];
  }

  int maxi = 0;
  for (int i = 0; i < N; i++) {
    int total = 0;
    for (int s = 0; s < N; s++) {
      if (s <= i) {
        total += a[s];
      }
      if (s >= i) {
        total += b[s];
      }
    }
    maxi = max(total, maxi);
  }

  printf("%d\n", maxi);

  return 0;
}



Measured memory_bytes: 256
#pragma region
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <queue> 
#include <stack>
#include <set>
#include <list>

using namespace std;
typedef long long ll;
//#define rep(i, s, e) for (int(i) = (s); (i) < (e); ++(i))
#define rep(i, e) for (int(i) = 0; (i) < (e); ++(i))
#define all(x) x.begin(),x.end()
#pragma endregion


int main()
{
	int x; cin >> x;
	if (x < 1200)cout << "ABC" << endl;
	else cout << "ARC" << endl;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define REP(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, a, b) for(int i=(a); i<(b); ++i)
#define FORR(i, a, b) for(int i=(b)-1; i>=(a); --i)

#define DEBUG(x) cout<<#x<<": "<<x<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";REP(i, v.size())cout<<' '<<v[i];cout<<'\n'
#define ALL(a) (a).begin(), (a).end()

#define CHMIN(a, b) a=min((a), (b))
#define CHMAX(a, b) a=max((a), (b))

const ll MOD=1000000007ll;
// const ll MOD=998244353ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

const double EPS=1e-11;
#define EQ0(x) (abs((x))<EPS)
#define EQ(a, b) (abs((a)-(b))<EPS)

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n, x[114], y[114], h[114];
	cin>>n;
	REP(i, n){
		cin>>x[i]>>y[i]>>h[i];
	}
	REP(c1, 101){
		REP(c2, 101){
			FOR(H, h[0], h[0]+201){
				bool ok=true;
				REP(i, n){
					if(h[i]){
						if(H!=h[i]+abs(x[i]-c1)+abs(y[i]-c2)){
							ok=false;
							i=n;
						}
					}
					else if(H>abs(x[i]-c1)+abs(y[i]-c2)){
						ok=false;
						i=n;
					}
				}
				if(ok){
					cout<<c1<<' '<<c2<<' '<<H<<'\n';
					return 0;
				}
			}
		}
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FIN ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

int main() {FIN
	
	int n, m, d = 0, a, i;
	cin >> n >> m;
	for (i = 0; i < m; i++) {
		cin >> a;
		d += a;
	}
	if (d <= n)
		cout << n - d << "\n";
	else
		cout << "-1\n";
	return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define GET_MACRO(_1,_2,_3,_4,_5,_6,_7,_8,NAME,...) NAME
#define pr(...) cerr<< GET_MACRO(__VA_ARGS__,pr8,pr7,pr6,pr5,pr4,pr3,pr2,pr1)(__VA_ARGS__) <<endl
#define pr1(a) (#a)<<"="<<(a)<<" "
#define pr2(a,b) pr1(a)<<pr1(b)
#define pr3(a,b,c) pr1(a)<<pr2(b,c)
#define pr4(a,b,c,d) pr1(a)<<pr3(b,c,d)
#define pr5(a,b,c,d,e) pr1(a)<<pr4(b,c,d,e)
#define pr6(a,b,c,d,e,f) pr1(a)<<pr5(b,c,d,e,f)
#define pr7(a,b,c,d,e,f,g) pr1(a)<<pr6(b,c,d,e,f,g)
#define pr8(a,b,c,d,e,f,g,h) pr1(a)<<pr7(b,c,d,e,f,g,h)
#define prArr(a) {cerr<<(#a)<<"={";int i=0;for(auto t:(a))cerr<<(i++?", ":"")<<t;cerr<<"}"<<endl;}
using namespace std;
using Int = long long;
using _int = int;
using ll = long long;
using Double = long double;
const Int INF = (1LL<<60)+1e9; // ~ 1.15 * 1e18
const Int mod = (1e9)+7;
const Double EPS = 1e-8;
const Double PI = 6.0 * asin((Double)0.5);
using P = pair<Int,Int>;
template<class T> T Max(T &a,T b){return a=max(a,b);}
template<class T> T Min(T &a,T b){return a=min(a,b);}
template<class T1, class T2> ostream& operator<<(ostream& o,pair<T1,T2> p){return o<<"("<<p.first<<","<<p.second<<")";}
template<class T1, class T2, class T3> ostream& operator<<(ostream& o,tuple<T1,T2,T3> t){
  return o<<"("<<get<0>(t)<<","<<get<1>(t)<<","<<get<2>(t)<<")";}
template<class T1, class T2> istream& operator>>(istream& i,pair<T1,T2> &p){return i>>p.first>>p.second;}
template<class T> ostream& operator<<(ostream& o,vector<T> a){Int i=0;for(T t:a)o<<(i++?" ":"")<<t;return o;}
template<class T> istream& operator>>(istream& i,vector<T> &a){for(T &t:a)i>>t;return i;}
//INSERT ABOVE HERE


signed main(){
  srand((unsigned)time(NULL));
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  int A, B, C;
  cin>>A>>B>>C;

  int ans = min(B/A, C);
  cout<<ans<<endl;
  

  return 0;
}


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

namespace D
{
    public class Program
    {
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            Solve();
            Console.Out.Flush();
        }

        public static void Solve()
        {
            var s = Console.ReadLine();
            var counts = new int[s.Length];
            var rl = new List<int>();
            Func<int, int, int> Dist = (from, to) => Math.Abs(from - to);
            for (var i = 0; i < s.Length - 1; i++)
            {
                if (s[i] == 'R' && s[i + 1] == 'L') rl.Add(i);
            }
            rl.Add(rl.Count * 2);

            for (var i = 0; i < s.Length; i++)
            {
                var r = rl[0];
                var dist = Dist(i, r);
                if (i <= r + 1)
                {
                    if (dist % 2 == 0) counts[r]++;
                    else counts[r + 1]++;
                    continue;
                }
                var nr = rl[1];
                var distNext = Dist(i, nr);
                if (s[i] == 'R')
                {
                    if (distNext % 2 == 0) counts[nr]++;
                    else counts[nr + 1]++;
                    rl.RemoveAt(0);
                }
                else
                {
                    if (dist % 2 == 0) counts[r]++;
                    else counts[r + 1]++;
                }
            }

            Console.WriteLine(string.Join(" ", counts));
        }
    }
}


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

int main() {
    string s;
    set<char> t;
    cin>>s;
    for (char c:s)
        t.insert(c);
    if (s.size()==t.size())
        puts("yes");
    else
        puts("no");
    return 0;
}

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

char buf[128];
int n, ans;

int main()
{
	scanf("%s", buf);
	n = strlen(buf);
	ans = 1000000;
	for (char what = 'a';what <= 'z';what++)
	{
		vector<int> wh; wh.push_back(-1);
		for (int i = 0;i < n;i++) if (buf[i] == what)
			wh.push_back(i);
		wh.push_back(n);
		int alt = 0;
		for (unsigned i = 1;i < wh.size();i++) alt = max(alt, wh[i]-wh[i-1]-1);
		ans = min(ans, alt);
	}
	printf("%d\n", ans);
	return 0;
}


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

using namespace std;

int n, a, b;
long long v[50];
long long cnk[51][51];

int main()
{
    for (int i = 0; i <= 50; i++) cnk[i][0] = 1, cnk[i][i] = 1;
    for (int i = 1; i <= 50; i++) for (int j = 1; j < i; j++) cnk[i][j] = cnk[i - 1][j] + cnk[i - 1][j - 1];
    cin >> n >> a >> b;
    for (int i = 0; i < n; i++)
    {
        cin >> v[i];
    }
    sort(v, v + n);
    reverse(v, v + n);
    if (a > b)
    {
        cout << 0 << "\n" << 0 << "\n";
        return 0;
    }
    long long summ = 0;
    for (int i = 0; i < a; i++) summ += v[i];
    printf("%.15f\n", (double)summ / a);
    long long ans = 0;
    int kek = 0, lol = 0;
    for (int j = 0; j < n; j++) if (v[j] == v[a - 1]) kek++, lol += (j <= a - 1);
    if (v[0] == v[a - 1])
    {
        for (int i = a; i <= b && i <= kek; i++) ans += cnk[kek][i];
        printf("%lld", ans);
        return 0;
    }
    printf("%lld", cnk[kek][lol]);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define lb long double 
#define pi acos(-1)
#define eps 1e-10
using namespace std;
struct Po{lb x,y;};
struct circ{Po a;lb r;}p1,p2;
void get(Po &x){scanf("%Lf %Lf",&x.x,&x.y);}
vector<Po> an;
Po operator -(Po x,Po y){return(Po){x.x-y.x,x.y-y.y};}
Po operator +(Po x,Po y){return (Po){x.x+y.x,x.y+y.y};}
Po operator *(Po x,lb y){return (Po){x.x*y,x.y*y};}
lb operator *(Po x,Po y){return x.x*y.y-x.y*y.x;}
lb operator ^(Po x,Po y){return x.x*y.x+x.y*y.y;}
Po operator /(Po x,lb y){return (Po){x.x/y,x.y/y};}
lb que(Po x){return sqrtl(x.x*x.x+x.y*x.y);}
Po zh(Po x,lb y){return (Po){x.x*cos(y)-x.y*sin(y),x.x*sin(y)+x.y*cos(y)};}
bool comp(const Po &a,const Po &b){if (fabs(a.x-b.x)<eps) return a.y<b.y;return a.x<b.x;}
int main(){
	get(p1.a);scanf("%Lf",&p1.r);
	get(p2.a);scanf("%Lf",&p2.r);
	lb dis=que(p1.a-p2.a);
	if (dis<fabs(p1.r-p2.r)-eps) return 0;
	lb s=acosl((p1.r-p2.r)/dis);
	Po yuan=(p2.a-p1.a)*(p1.r/dis);
	an.push_back(p1.a+zh(yuan,s));
	if (fabs(s)>eps&&fabs(s-pi)>eps) an.push_back(p1.a+zh(yuan,-s));
	if (dis>p1.r+p2.r-eps){
		s=acosl((p1.r+p2.r)/dis);
		an.push_back(p1.a+zh(yuan,s));
		if (fabs(s)>eps&&fabs(s-pi)>eps) an.push_back(p1.a+zh(yuan,-s));
	}
	sort(an.begin(),an.end(),comp);
	for (int i=0;i<an.size();i++) printf("%.10Lf %.10Lf\n",an[i].x,an[i].y);
	return 0;
}


Measured memory_bytes: 3616
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
using namespace std;
#define rep(i, a, b) for(int i = a; i < (b); ++i)
typedef long long ll;
typedef pair<int,int> P;
int main() {
    int n;
    cin >> n;
    vector<ll> a(n);
    vector<ll> b(n);
    vector<ll> c;
    rep(i,0,n) cin >> a[i];
    rep(i,0,n) cin >> b[i];
    ll sum=0;
    ll num=0;
    rep(i,0,n){
        if(b[i]>a[i]) {
            sum+=b[i]-a[i];
            num++;
        }
        if(a[i]>b[i]){
            c.push_back(a[i]-b[i]);
        }
    }
    sort(c.begin(),c.end(),greater<int>());
    if(sum>0){
        for(int i=0;i<c.size();i++){
            sum-=c[i];
            num++;
            if(sum<0) break;
        }
    }
    if(sum>0) cout << -1 << endl;
    else cout << num << endl;
    return 0;
}


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

#define froop1(a,n) for(int i = a;i < n;i++)
#define froop2(a,n) for(int i = a;i > n;i--)

#define ll long long

#define pq(name,type) priority_queue<type> name
#define vec(name,type,length,value) vector<type> name(length,value)
#define vec2(name,type,length,width,value) vector<vector<type>> name(length,vector<type>(width,value));

int main(){
	int N,M,count = 0,d;
	cin >> N >> M >> d;
  froop1(N,M + 1){
    if(i % d == 0) count++;
  }
  cout << count << endl;

return 0;
}


Measured memory_bytes: 3600
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
using namespace std;
typedef long long ll;
const ll B=1e6+7;
const ll mod=1e9+7,mod2=998244353,mod3=1e11+7;
ll t_mod(ll x,ll m){
  if(x>=0) return x%m;
  else{
    ll x2=x*(-1);
    x2/=m;
    x2+=2;
    return (x+m*x2)%m;
  }
}
vector<int> contain(string b,string a){
  int al=a.length(),bl=b.length();

  ll t=1,t2=1,t3=1;
  for(int i=0;i<al;i++) {
    t*=B;
    t%=mod;
    t2*=B;
    t2%=mod2;
    t3*=B;
    t3%=mod3;
  }

  ll ah=0,bh=0,ah2=0,bh2=0,ah3=0,bh3=0;
  for(int i=0;i<al;i++) {
    ah=(ah*B)%mod+a[i];
    ah%=mod;
    ah2=(ah2*B)%mod2+a[i];
    ah2%=mod2;
    ah3=(ah3*B)%mod3+a[i];
    ah3%=mod3;
  }
  for(int i=0;i<al;i++) {
    bh=(bh*B)%mod+b[i];
    bh%=mod;
    bh2=(bh2*B)%mod2+b[i];
    bh2%=mod2;
    bh3=(bh3*B)%mod3+b[i];
    bh3%=mod3;
  }

  vector<int> ret;
  for(int i=0;i+al<=bl;i++){
    if(ah==bh&&ah2==bh2&&ah3==bh3) {
      ret.push_back(i);
    }
    if(i+al<bl){
      bh=(bh*B)%mod+b[i+al]-b[i]*t;
      bh=t_mod(bh,mod);
      bh2=(bh2*B)%mod2+b[i+al]-b[i]*t2;
      bh2=t_mod(bh2,mod2);
      bh3=(bh3*B)%mod3+b[i+al]-b[i]*t3;
      bh3=t_mod(bh3,mod3);
    }
  }
  return ret;
}
int main(){
  string a,b;
  cin>>a>>b;
  if(a.length()<b.length()) return 0;
  vector<int> ans=contain(a,b);
  for(int i=0;i<ans.size();i++) cout<<ans[i]<<endl;
}



Measured memory_bytes: 9440
#include <iostream>
#include <vector>
#include <tuple>
#include <algorithm>
#include <numeric>
#include <string>
#include <math.h>

typedef long long ll;
using namespace std;

int main(){
    int n,q;
    cin >> n >> q;
    string s;
    cin >> s;
    vector<int> vs;
    for (auto ch : s){
        vs.push_back(ch-'A');
    }
    vector<int> t(q),d(q);
    for (int i=0; i<q; ++i){
        char ch;
        cin >> ch;
        t[i] = ch-'A';
        cin >> ch;
        d[i] = (ch=='R') ? 1 : -1;
    }
    reverse(t.begin(), t.end());
    reverse(d.begin(), d.end());
    
    int l=0, r=n-1;
    for(int i=0; i<q; ++i){
        // left end
        if(t[i] == vs[l] && d[i]<0){
            ++l;
        }else if(l>0 && t[i] == vs[l-1] && d[i]>0){
            --l;
        }
        
        //right end
        if (t[i] == vs[r] && d[i]>0){
            --r;
        }else if(r<n-1 && t[i] == vs[r+1] && d[i]<0){
            ++r;
        }
    }
    cout << r-l+1 << endl;
    
    return 0;
}


Measured memory_bytes: 3060
n,k=map(int,input().split())
if n>=k:
    if abs(n-(n//k)*k)<=abs(n-(n//k+1)*k):
        print(abs(n-(n//k)*k))
    else:
        print(abs(n-(n//k+1)*k))
else:
    if k-n<=n:
        print(k-n)
    else:
        print(n)

Measured memory_bytes: 38384
//
//  main.c
//  q_01
//
//  Created by k19104kk on 2020/08/29.
//  Copyright © 2020 AIT. All rights reserved.
//

#include <stdio.h>

int main(int argc, const char * argv[]) {
    long long d,t,s;
    scanf("%lld %lld %lld",&d,&t,&s);
    if (d<=t*s) {
        printf("Yes\n");
    } else {
        printf("No\n");
    }
    return 0;
}


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

#ifdef LOCAL
#define DEBUG(...) debug(#__VA_ARGS__, __VA_ARGS__);
#else
#define DEBUG(...) 6;
#endif

template<typename T, typename S> ostream& operator << (ostream &os, const pair<T, S> &p) {return os << "(" << p.first << ", " << p.second << ")";}
template<typename C, typename T = decay<decltype(*begin(declval<C>()))>, typename enable_if<!is_same<C, string>::value>::type* = nullptr>
ostream& operator << (ostream &os, const C &c) {bool f = true; os << "["; for (const auto &x : c) {if (!f) os << ", "; f = false; os << x;} return os << "]";}
template<typename T> void debug(string s, T x) {cerr << s << " = " << x << "\n";}
template<typename T, typename... Args> void debug(string s, T x, Args... args) {cerr << s.substr(0, s.find(',')) << " = " << x << " | "; debug(s.substr(s.find(',') + 2), args...);}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    string s;
    cin >> s;

    int ret = 0, cur = 0;
    for (char c : s) {
        if (c == 'R') cur++;
        else ret = max(ret, cur), cur = 0;
    }
    ret = max(ret, cur);

    cout << ret << "\n";

    return 0;
}


Measured memory_bytes: 3640
// Ver19.03
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define INF (1 << 29) * 2
#define LLINF 4545454545454545454
#define MOD 1000000007
#define ll long long
#define ull unsigned long long
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
int upll(const void *a, const void *b) { return *(ll *)a < *(ll *)b ? -1 : *(ll *)a > *(ll *)b ? 1 : 0; }
int downll(const void *a, const void *b) { return *(ll *)a < *(ll *)b ? 1 : *(ll *)a > *(ll *)b ? -1 : 0; }
void sortup(ll *a, int n) { qsort(a, n, sizeof(ll), upll); }
void sortdown(ll *a, int n) { qsort(a, n, sizeof(ll), downll); }

int main()
{
  int a, p;
  scanf("%d%d", &a, &p);
  printf("%d\n", (a * 3 + p) / 2);
  return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


#define SIZE 200005

enum Type{
    Zero,
    One,
};

struct Info{

	int ans_ZERO,ans_ONE;
};

char buf[SIZE];
int close_pos[SIZE];
int LOC;

Info formula();
Info or_expr();
Info and_expr();
Info term();


Info formula(){

    return or_expr();
}

Info or_expr(){

	Info ret;

	ret = and_expr();

	int ZERO = ret.ans_ZERO;
	int ONE = ret.ans_ONE;

	int pre_ZERO,pre_ONE;

	 while(buf[LOC] == '|'){

		 pre_ZERO = ZERO;
		 pre_ONE = ONE;

		 LOC++;
		 Info tmp = and_expr();

		 ret.ans_ZERO += tmp.ans_ZERO; //or連結で0にするには、全ての<and_expr>を0にする必要あり

		 //or連結で1にする場合
		 ZERO = pre_ZERO+tmp.ans_ZERO;
		 ONE = min(pre_ONE,pre_ZERO+tmp.ans_ONE);
	}

    ret.ans_ONE = ONE;

    return ret;
}

Info and_expr(){

	Info ret;

	ret = term();

	int ZERO = ret.ans_ZERO;
	int ONE = ret.ans_ONE;

	int pre_ZERO,pre_ONE;

	 while(buf[LOC] == '&'){

		 pre_ZERO = ZERO;
		 pre_ONE = ONE;

		 LOC++;
		 Info tmp = term();

		 ret.ans_ONE += tmp.ans_ONE; //and連結で1にするには、全ての<term>を1にする必要あり

		 //and連結で0にする場合
		 ZERO = min(pre_ZERO,pre_ONE+tmp.ans_ZERO);
		 ONE = pre_ONE+tmp.ans_ONE;
	}

	ret.ans_ZERO = ZERO;

	return ret;
}

Info term(){

    if(buf[LOC] == '?'){

    	LOC++;

    	Info ret;
    	ret.ans_ZERO = 1;
    	ret.ans_ONE = 1;

    	return ret;

    }else{ //(<or_expr>)

    	LOC++;
    	Info ret = or_expr();
    	LOC++;

    	return ret;
    }
}


int main(){

    scanf("%s",buf);

    Info ans = formula();

    LOC = 0;

    printf("%d %d\n",ans.ans_ZERO,ans.ans_ONE);

    return 0;
}



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


int main() {
	int a, b, s, cun = 0;
	string S;

	cin >> a >> b;
	cin >> S;
	if (S.size() == a + b + 1) {
		for (int i = 0; i < a + b + 1; i++) {
			if (i == a) {
				if (S[i] == '-') {
					cun++;
				}
			} else {
				s = S[i] - '0';
				if (0 <= s && s <= 9) {
					cun++;
				}
				s = -1;
			}
		}
	}

	if (cun == a + b + 1) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
import numpy as np

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

X = sorted(X)
X = np.array(X)
diff = np.diff(X)
diff = np.sort(diff)[::-1]

#print(X)
#print(diff)

if N >= M:
  ans = 0
elif N == 1:
  ans = np.sum(diff)
else:
  ans = np.sum(diff[N-1:])

print(ans)

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

int N;
vector<int> P;

bool solve() {
    vector<int> maxLeftP(N+1, 0), minRightP(N+1, N-1); // 左累積max、右累積min
    for (int i = 0; i < N; ++i) maxLeftP[i+1] = max(maxLeftP[i], P[i]);
    for (int i = N; i >= 1; --i) minRightP[i-1] = min(minRightP[i], P[i-1]);
    
    // 区間ごとに区切った時に、区間の外へと数字が逃げていかない条件
    // maxLeftP[i+1] = i は (1, 2, ..., i) の部分が最終的にその並び替えになっていることを意味する
    for (int i = 0; i < N-1; ++i) {
        // 連続して固定値のときはそこで途切れているはず
        if (P[i] == i && P[i+1] == i+1) { if (maxLeftP[i+1] != i) return false; }
        
        // 連続して固定値でないときは、i: 左へ行っているはず、i+1: 右へ行っているはず (つまり区切れる)
        if (P[i] != i && P[i+1] != i+1) { if (maxLeftP[i+1] != i) return false; }
    }
    
    for (int i = 1; i+1 < N; ++i) {
        // 増加している i は最後には右隣を pivot としているはずで、その場合はより大きい値が左には来れない
        if (P[i] > i) { if (maxLeftP[i] > P[i]) return false; }
        
        // 減少している i は最後には左隣を pivot としているはずで、その場合はより小さい値が右には来れない
        else if (P[i] < i) { if (minRightP[i] < P[i]) return false; }
    }

    return true;
}

int main() {
    cin >> N;
    P.resize(N);
    for (int i = 0; i < N; ++i) cin >> P[i], --P[i];
    if (solve()) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 3712
x,k,d = map(int, input().split())
if abs(x)/d > k:
  ans = abs(x) - k*d
else:
  if abs(x)%d <= d/2:
    if (k-(abs(x)//d)) % 2 == 1:
      ans = d-(abs(x)%d)
    else:
      ans = abs(x)%d
  else:
    if (k-(abs(x)//d)) % 2 == 1:
      ans = d-(abs(x)%d)
    else:
      ans = abs(x)%d
print(ans)

Measured memory_bytes: 9064
#include <algorithm>
#include <bitset>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <vector>

using namespace std;

#define FOR(i, j, n) for (int i = j; i < n; i++)
#define OUT(s) cout << s << endl;
#define IN(a) cin >> a;
#define PACK(a, n)                                                             \
  for (int i = 0; i < n; i++)                                                  \
    cin >> a[i];
#define LIST(a, n)                                                             \
  for (int i = 0; i < n; i++)                                                  \
    cout << "[" << i << "] " << a[i] << endl;

int main() {
  int N;
  IN(N);
  int H[N];
  PACK(H, N);

  int h = H[0];
  FOR(i, 1, N) {
    if (h > H[i]) {
      OUT("No");
      return 0;
    }
    if (h == H[i])
      continue;
    h = H[i] - 1;
  }

  OUT("Yes");
}

Measured memory_bytes: 640
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <numeric>
#include <queue>
#include <stack>
#include <map> 
#include <set>
#include <string>
#include <functional>
#include <list>
#include <random>
#include <time.h>
#include <iomanip>
#include <assert.h>
#include <numeric>
#include <new>
#include <sstream>
#include <complex>
#define BIT(nr) (1ULL << (nr))
#define int long long
#define ll long long
#define double complex<long double>
#define mod 1000000007
#define MAXN (int)1e+5 * 2+1
#define LL_MAX 9223372036854775807	//ない環境用
#define LL_HALFMAX 9223372036854775807 / 2	//ない環境用
#define MIN -(9223372036854775807 / 2)
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define mp make_pair
template<typename T1, typename T2> inline void chmin(T1 & a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }

using namespace std;

// 汎用的な二分探索のテンプレ(めぐる式)
int binary_search(function<bool(int)> isOk, int ng, int ok) {

	/* ok と ng のどちらが大きいかわからないことを考慮 */
	while (abs(ok - ng) > 1) {
		int mid = (ok + ng) / 2;

		if (isOk(mid)) ok = mid;
		else ng = mid;
	}
	return ok;
}

void solve(ostringstream& aout, long long N, long long M, std::vector<long long> A) {
	sort(ALLOF(A));
	vector<int> cum(N + 1, 0);

	int su = 0;
	rep(i, N) {
		su += A[i];
		cum[i + 1] = su;
	}

	// k以上の握手しかしない、ができるか？
	auto isOk = [&](int k) -> bool {
		// 右手は固定
		int num = 0;
		rep(right, N) {
			auto lit = lower_bound(ALLOF(A), k - A[right]);
			auto cnt = A.end() - lit;
			num += cnt;
		}
		if (num >= M) {
			return true;
		}
		return false;
	};

	int maxK = binary_search(isOk, LL_HALFMAX, 0);

	// 復元
	// 右手は固定
	int num = 0;
	int bigger = 0;

	rep(right, N) {
		auto lit = lower_bound(ALLOF(A), maxK - A[right] + 1);
		auto cnt = A.end() - lit;
		num += cnt;

		int ind = lit - A.begin();
		int cSum = (cum[N] - cum[ind]);
		bigger += cSum + A[right] * cnt;
	}
	int rest = M - num;

	int ans = bigger + rest * maxK;

	cout << ans << "\n";
}

void solve_TLE(ostringstream& aout, long long N, long long M, std::vector<long long> A) {

}

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

	cout << ansStream.str();
	return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vc = vector<char>;
using vs = vector<string>;
using vll = vector<long long>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using vvll = vector<vector<long long>>;
template<class T> inline bool chmax(T &a, T b) { if (a<b) {a=b; return 1;} return 0;}
template<class T> inline bool chmin(T &a, T b) { if (b<a) {a=b; return 1;} return 0;}

vector<pair<long long, int>> factor(long long x) {
    vector<pair<long long, int>> res;
    for (long long i = 2; i*i <= x; ++i) {
        int cnt = 0;
        while (x % i == 0) {
            x /= i;
            cnt++;
        }
        if (cnt) res.emplace_back(i, cnt);
    }
    if (x != 1) res.emplace_back(x, 1);
    return res;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    ll n, p;
    cin >> n >> p;

    auto f = factor(p);
    ll ans = 1;
    for (auto p : f) {
        ans *= (ll)pow(p.first, p.second/n);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
function bigAdd(x,y){
   var a=(x+"").split("").reverse().map(Number);
   var b=(y+"").split("").reverse().map(Number);
   var c=[];
   var max=Math.max(a.length,b.length);
   for(var i=0;i<max+1;i++)c[i]=0;
   for(var i=0;i<max;i++){
      var sum=0;
      if(a.length>i)sum+=a[i];
      if(b.length>i)sum+=b[i];
      c[i]+=sum;
   }
   for(var i=0;i<max;i++){
      if(c[i]>=10){
         c[i]-=10;
         c[i+1]++;
      }
   }
   if(c[c.length-1]==0)c.pop();
   var str=c.reverse().join("");
   return str;
}
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var Arr=(input.trim()).split("\n");
var n=Arr.shift()-0;
var arr=(Arr.shift()).split(" ").map(Number);
var last=arr.pop();
n--;
var dp=[];
for(var i=0;i<n;i++){
   dp[i]=[];
   for(var j=0;j<=20;j++){
      dp[i][j]=0;
   }
}
dp[0][arr[0]]=1;
for(var i=1;i<n;i++){
   var v=arr[i];
   for(var j=0;j<=20;j++){
      if(dp[i-1][j]!==0){
         if(j+v<=20)dp[i][j+v]=bigAdd(dp[i][j+v],dp[i-1][j]);
         if(j-v>=0)dp[i][j-v]=bigAdd(dp[i][j-v],dp[i-1][j]);
      }
   }
}
console.log(dp[n-1][last]);

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

int main() {
  int N, count = 1, temp;
  cin >> N;
  
  vector<int> Bnum(N);
  for (int i = 0; i < N; i++) {
   	cin >> Bnum[i]; 
  }
  
  int i = 0;
  int f = 0;
  while (Bnum[i] != 2){
     if (f++ == N){
       count = -1;
       break;
     }
     temp = Bnum[i];
     if (temp == 1){
       count = -1;
       break;
     }
     i = temp - 1;
     count++;
  }
  cout << count << endl;
}


Measured memory_bytes: 768
# http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_11_B&lang=ja
import sys
input = sys.stdin.readline

N = int(input())
G = [[a-1 for a in list(map(int, input().split()))[2:]] for _ in [0]*N]
visited = [0]*N
history = [[] for _ in [0]*N]

k = 0


def dfs(v=0, p=-1):
    global k
    visited[v] = 1
    k += 1
    history[v].append(k)

    for u in G[v]:
        if u == p or visited[u]:
            continue
        dfs(u, v)

    k += 1
    history[v].append(k)


for i in range(N):
    if not visited[i]:
        dfs(i)

for i, h in enumerate(history):
    print(i+1, *h)



Measured memory_bytes: 5720
#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 k,x;
cin >> k >> x;

if(500*k >= x) cout << "Yes" << endl;
else cout << "No" << endl;

return 0;
}

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

int main() 
{
	int k , x;
	cin >> k >> x;
	for(int i = max(-1000000,x-k+1) ; i <= min(1000000,k+x-1) ; i++)
		cout << i << " " ;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i <(n); ++i)
#define ALL(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int,int>;
static const double PI = acos(-1);



int main(){
  int a, b, c;
  cin >> a >> b >> c;
  int ok_5 = 0;
  int ok_7 = 0;
  if(a == 5) ++ok_5;
  if(b == 5) ++ok_5;
  if(c == 5) ++ok_5;
  if(a == 7) ++ok_7;
  if(b == 7) ++ok_7;
  if(c == 7) ++ok_7;

  if(ok_5 == 2 && ok_7 == 1) cout << "YES" << endl;
  else cout << "NO" << endl;
  


  return 0;
}

Measured memory_bytes: 3552
import fractions
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)
N = int(input())
array = list(map(int, input().split()))
t = 1
for i in array:
    t = lcm(t,i)
t -= 1
ans = 0
for k in range(N):
    ans += t % array[k]
print(ans)

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

long long H, W, col[409][409], cnts, B[160009], WW[160009]; string S[409]; vector<pair<int, int>> X[409][409];

void dfs(int px, int py) {
	if (col[px][py] >= 1) return;
	col[px][py] = cnts; if (S[px][py] == '#') B[cnts]++; if (S[px][py] == '.') WW[cnts]++;
	for (int i = 0; i < X[px][py].size(); i++) {
		dfs(X[px][py][i].first, X[px][py][i].second);
	}
}

int main() {
	cin >> H >> W;
	for (int i = 0; i < H; i++) cin >> S[i];

	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			int dx[4] = { 1, 0, -1, 0 }, dy[4] = { 0, 1, 0, -1 };
			for (int k = 0; k < 4; k++) {
				int sx = i + dx[k], sy = j + dy[k];
				if (sx < 0 || sy < 0 || sx >= H || sy >= W) continue;
				if (S[i][j] != S[sx][sy]) {
					X[i][j].push_back(make_pair(sx, sy));
				}
			}
		}
	}
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			if (col[i][j] != 0) continue;
			cnts++; dfs(i, j);
		}
	}
	long long ans = 0;
	for (int i = 1; i <= cnts; i++) ans += 1LL * B[i] * WW[i];
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 20352
#include <stdio.h>

int main(){
    int n, a[1000], v, i, j, k;
    scanf("%d\n",&n);
    for(i=0; i<n; i++) scanf("%d", &a[i]);

    for(k=0; k<n; k++){
        if(k!=n-1) printf("%d ", a[k]);
        else printf("%d\n", a[k]);
    }

    for(i=1; i<n; i++){
        v = a[i];
        j = i - 1;
        while(j>=0 && a[j] > v){
            a[j+1] = a[j];
            j--;
        }
        a[j+1] = v;
        for(k=0; k<n; k++){
            if(k!=n-1) printf("%d ", a[k]);
            else printf("%d\n", a[k]);
        }
    }

    return 0;
}



Measured memory_bytes: 1932
//100 B - Ringo's Favorite Numbers

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

int main(){
	int d , n;
	int a[100]={};
	cin >> d >> n;
	switch(d){
		case 0:
			a[0]=1;
			for(int i=1;i<100;++i){
				a[i]=a[i-1]+1;
			}
			if(n==100) cout << 101;
   			else cout << a[n-1];
			break;
		case 1:
			a[0]=100;
			for(int i=1;i<100;++i){
				a[i]=a[i-1]+100;
			}
			if(n==100) cout << 10100;
			else cout << a[n-1];
			break;
		case 2:
			a[0]=10000;
			for(int i=1;i<100;++i){
				a[i]=a[i-1]+10000;
			}
			if(n==100) cout <<1010000;
			else cout << a[n-1];
			break;
	}
	cout << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
const int N=1e5+10;
int n,a[N];
void Put(int p) {p&1?puts("First"):puts("Second");exit(0);}
void dfs(int p)
{
    int od=0,ov=0,g=0,mn=1e9;
    for(int i=1;i<=n;i++) a[i]&1?od++:ov++,mn=min(mn,a[i]);
    if(ov&1) Put(p);
    if(od>1||mn==1) Put(p^1);
    for(int i=1;i<=n;g=__gcd(g,a[i]),i++) if(a[i]&1) a[i]--;
    for(int i=1;i<=n;i++) a[i]/=g;
    dfs(p^1);
}
int main()
{
    cin>>n;
    for(int i=1;i<=n;i++) cin>>a[i];
    if(n==1) Put(a[1]-1);dfs(1);
}


Measured memory_bytes: 640
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
typedef long long ll;
#define pb push_back
#define mii map <int, int>
#define mll map <ll, ll>
#define pii pair <int, int>
#define pll pair <ll, ll>
#define vi vector <int>
#define vd vector <double>
#define vll vector <ll>
#define fi first
#define se second
#define si set <int>
#define sll set <ll>
#define spii set <pii>
#define vs vector <string>
#define vpii vector <pair <int,int> >
#define vpll vector <pair <long long,long long> >
#define vvi vector <vector <int> >
#define vvpii vector <vector <pii > >
#define forn(i, n) for (int i = 0; i < (n); i++)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define for1(i, n) for (int i = 1; i < (n); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(),(x).rend()


using namespace std;
const ll INFLL = 1e18;
const int MAXN = 1e6+100;
const ll INF = 1e9;
const ll mod1=1e9+7;
const ll mod2=2e9+11;

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
#ifdef LOCAL
    freopen("a.in","r",stdin);
#endif
    int n,m;
    cin>>n>>m;
    ll sum=0;
    vector <int> a(n);
    rep(i,n)
        cin>>a[i],sum+=a[i];
    int cnt=0;
    for (int i=0;i<n;i++)
    {
        if (a[i]>=(sum+4*m-1)/(4*m))
            cnt++;
    }
    if (cnt>=m)
        cout<<"Yes";
    else
        cout<<"No";







}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<iomanip>
#include<map>
using namespace std;
#define ll long long
int main(){
    int n;
    cin >> n;
    if(n==3){
      cout << "YES";
      return 0;
    }
    if(n==5){
      cout << "YES";
      return 0;
    }
    if(n==7){
      cout << "YES";
      return 0;
    }
    cout << "NO";
    return 0;
}


Measured memory_bytes: 256
// みなさん私はカーティキー・シャルマです。LNMIITで勉強しています。私は2年目で、コロナパンデミックが発
// 生しています。世界は終わりそうだ。だから私はそれを最大限に生きたいと思っています。それはつまり、コー
// ドを最大限に意味しているのです。私の好きなアニメは「キメツノヤイバ」で、私の一番の男の子はゼニツで、
// 私の一番の女の子はネズコです。私の好きな呼吸スタイルは息吹です。私の最高の悪魔の血の芸術は、
// ククシボによって使用される月の息です。ムーザンは亡くなり、今ではタンジローがポップの新しい魔王です。
#include <bits/stdc++.h>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <vector>
#include <string>
using namespace std;
typedef double  dbl;
typedef long long int lld;
#define PI 3.14159265358979323
#define foi(i,n) for(i = 0; i < n; i+=1)
#define fod(i,n) for(i=n-1; i >=0; i-=1)
#define MAX std::numeric_limits<lld>::max()
#define MIN std::numeric_limits<lld>::min()
#define FastIO  ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
int main ()
{
      FastIO
      lld n, m;
      lld l, r;
      cin >> n >> m;
      cin >> l >> r;
      lld start = l;
      lld end   = r;
      lld flag  = 1;
      for(lld i = 1; i < m; i += 1){
      	lld l, r;
      	cin >> l >> r;
      	if ((l >= start && l <= end) || (r >= start && r <= end) || (start >= l && end <= r)){
      		if (l >= start){
      			start = l;
      		}
      		if (r <= end){
      			end = r;
      		}
      	}
      	else{
      		flag = 0;
      	}
      }
      if (flag == 0){
      	cout << "0";
      }
      else{
      	cout << end-start+1;
      }
      return 0;
}

Measured memory_bytes: 384
#include<stdio.h>
#include<stdlib.h>
int main(){
    int N,L,i;
    int taste[201];
    int absmin;
    int loc;
    int ans;
    
    scanf("%d %d",&N,&L);
    for(i = 1; i <= N; i++) taste[i] = L+i-1;
    absmin = taste[1]; //初期化
    loc = 1;
    for(i = 2; i <= N; i++){
        if(abs(taste[i]) < abs(absmin)){
            absmin  = taste[i];
            loc = i;
        } 
    }

    for(i = 1; i <= N; i++){
        if(i == loc) continue;
        else ans += taste[i];
    }

    printf("%d\n",ans);
    //for(i = 1; i <= N; i++) printf("%d ",taste[i]);
    //printf("absmin is %d\n",absmin);
    return 0;
}

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

using namespace std;

int main(){
  vector<vector<int>> c(3,vector<int>(3));

  for(int i=0;i<3;i++){
    cin>>c.at(i).at(0)>>c.at(i).at(1)>>c.at(i).at(2);
  }

for(int i=1;i<3;i++){
  c.at(i).at(0) = c.at(i).at(0) -c.at(0).at(0);
  c.at(i).at(1) = c.at(i).at(1) -c.at(0).at(1);
  c.at(i).at(2) = c.at(i).at(2) -c.at(0).at(2);
}

if(c.at(1).at(0)==c.at(1).at(1)&&c.at(1).at(0)==c.at(1).at(2)){
  if(c.at(2).at(0)==c.at(2).at(1)&&c.at(2).at(0)==c.at(2).at(2)){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
}else{
  cout<<"No"<<endl;
}


 
}


Measured memory_bytes: 256
#include<stdio.h>
#define N 51
int main(){
    int n,i,j;
    double v[N],tmp,val_s;
    scanf("%d",&n);
    for( i = 1 ; i <= n ; i++){
        scanf("%lf",&v[i]);
    }
    for(i = 1 ; i <= n ; i++){
        for(j = i+1 ; j <= n ; j++){
            if(v[i] > v[j]){
                tmp = v[i];
                v[i] = v[j];
                v[j] = tmp;
            }
        }
    }
    val_s = v[1];
    for(i = 2 ; i <= n ; i++){
        val_s = (val_s + v[i])/2;
    }

    printf("%f",val_s);
    return 0;
}

Measured memory_bytes: 128
#include <cstdio>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <iterator>
#define loop(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define debug(x)  cout << #x << " = " << (x) << endl;

using namespace std;
using LL = long long;
using ULL = unsigned long long;

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

    bool ok = true;
    for (int i = 1; i <= 2; i++) {
        if (s[i] == s[0]);
        else ok = false;
    }
    if (ok) {
        cout << "Yes" << endl;
        return 0;
    }
    ok = true;
    for (int i = 2; i <= 3; i++) {
        if (s[i] == s[1]);
        else ok = false;
    }
    if (ok) {
        cout << "Yes" << endl;
        return 0;
    }
    cout << "No" << endl;
}


Measured memory_bytes: 504