akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i,n) for(int i=n; i>-1; --i)
#define ALL(a) (a).begin(),(a).end()
#define INIT(a,n,x); REP(i,(n)){ (a)[i]=(x); }
#define CINA(a,n); REP(i,(n)){ cin >> (a)[i]; }
#define INIT2(a,n,m,x); REP(i,(n)){ REP(j,(m)){(a)[i][j]=(x);} }
#define CINA2(a,n,m); REP(i,(n)){ REP(j,(m)){cin >> (a)[i][j];} }
#define LINY "YES\n"
#define Liny "Yes\n"
#define LINN "NO\n"
#define Linn "No\n"
#define umap unordered_map
//cout << setfill('0') << right << setw(4) << 12; // "0012"

ll min(ll x,ll y){return (x<y ? x:y);}
ll max(ll x,ll y){return (x>y ? x:y);}
int keta(ll x){ if(x<10){return 1;} else{return keta(x/10) + 1;}}
int keta_wa(ll x){ if(x<10){return x;} else{return keta_wa(x/10) + x%10;} }
int ctoi(char c){ return ( (c>='0' && c<='9')? c - '0': 0 );}
ll gcd(ll a,ll b){if(a<b)swap(a,b); return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){if(a<b){swap(a,b);} return a*b /gcd(a,b);}

int main(){
  int N,Q; cin>>N>>Q;
  string s; cin>>s;
  int cumu[N]; cumu[0] = 0;
  char c;
  char state = s[0];
  for(int i=1;i<N;i++){
    cumu[i] = cumu[i-1];
    c = s[i];
    if(c=='C'){
      if(state=='A'){
        ++cumu[i];
      }
    }
    state = c;
  }
  int l,r;
  REP(i,Q){
    cin >> l >> r;
    printf("%d\n",cumu[r-1]-cumu[l-1]);
  }
}

Measured memory_bytes: 1408
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		String line = sc.nextLine();

		String[] value = line.split(" ");
		int a = Integer.parseInt(value[0]);
		int b = Integer.parseInt(value[1]);
		System.out.println(a * b + " " + (a * 2 + b * 2));

	}

}



Measured memory_bytes: 26076
from itertools import*
n=int(input())
a=[[s for s in input().split()]for _ in range(n)]
for b in a:
 b[3],b[4]=b[4],b[3]
def f():
 for d,e in combinations(a,2):
  for p in([0,1,2,3,4,5],[1,5,2,0,4,3],[2,1,5,3,0,4],[3,0,2,5,4,1],[4,1,0,3,5,2],[5,1,4,3,2,0]):
   f=[d[i]for i in p]
   if f[0]==e[0]and f[5]==e[5]:
    f=f[1:5]+f[1:5]
    for k in range(4):
     if f[k:k+4]==e[1:5]:return'No'
 return'Yes'
print(f())


Measured memory_bytes: 5664
#include<bits/stdc++.h>
#define lln long long int
#define llu unsigned lln
#define sc(n) scanf("%d",&n);
#define scl(n) scanf("%lld",&n);
#define scd(n) scanf("%lf",&n);
#define pf(res) printf("%d\n",res);
#define pfl(res) printf("%lld\n",res);
#define pfd(res) printf("%lf\n",res);
#define maxii 100005
using namespace std;
typedef pair<int,int> pii;
typedef pair<lln,lln> pll;
 vector<int> vi[maxii];
 vector<int>:: iterator child;
typedef vector<lln> vl;
typedef vector<pii> vii;
typedef vector<pll> vll;


int arr[maxii];
int arr2[maxii];
bool check[maxii];

bool dfs(int node,int c)
{
    check[node]=true;
    arr2[node]=c;
    for(int child=0;child<vi[node].size();child++)
    {
        if(check[vi[node][child]]==false)
        {
            if(dfs(vi[node][child],c^1)==false)
            {
                return false;
            }
        }
        else if(arr2[node]==arr2[vi[node][child]])
        {
            return false;
        }
        //else if()
    }
    return true;
}

int main()
{
    string aarr[105];
    int n,l;
    cin>>n>>l;
    for(int i=0;i<n;i++)
    {
        cin>>aarr[i];
    }
    sort(aarr,aarr+n);
    for(int i=0;i<n;i++)
    {
        cout<<aarr[i];
    }
}





Measured memory_bytes: 5952
// https://atcoder.jp/contests/sumitrust2019/tasks/sumitb2019_c

#include "algorithm"
#include "cmath"
#include "functional"
#include "iomanip"
#include "iostream"
#include "numeric"
#include "queue"
#include "set"
#include "string"
#include "vector"
#define rep(i, to) for (ll i = 0; i < (to); ++i)
#define repf(i, from, to) for (ll i = from; i < (to); ++i)
#define repr(i, from) for (ll i = from - 1; i >= 0; --i)
#define all(vec) vec.begin(), vec.end()
#define fi first
#define se second
using namespace std;
typedef long long ll;
template <typename T>
using V = vector<T>;
using VL = V<ll>;
using VVL = V<VL>;
template <typename T, typename U>
using P = pair<T, U>;
using PL = P<ll, ll>;
using VPL = V<PL>;
template <typename T>
inline bool chmax(T& a, T b);
template <typename T>
inline bool chmin(T& a, T b);
void print_ints(vector<ll> v);
template <typename T>
void drop(T a);

const ll INF = 1e18;

void solve() {
  ll X;
  cin >> X;

  ll t = X / 100;
  ll r = X % 100;

  if (r <= 5 * t) drop(1);
  drop(0);
}

void solve2() {
  ll X;
  cin >> X;

  rep(c, X) {
    if (100 * c <= X && X <= 105 * c) drop(1);
  }

  drop(0);
}

void solve3() {
  ll X;
  cin >> X;

  VL dp(X + 1);
  dp[0] = 1;

  rep(i, X + 1) repf(price, 100, 106) {
    if (i - price >= 0 && dp[i - price]) dp[i] = 1;
  }

  cout << dp[X] << endl;
}

struct exit_exception : public std::exception {
  const char* what() const throw() { return "Exited"; }
};

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

  try {
    solve3();
  } catch (exit_exception& e) {
  }

  return 0;
}
#endif

template <typename T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}

template <typename T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}

void print_ints(vector<ll> v) {
  rep(i, v.size()) {
    if (i > 0) {
      cout << " ";
    }

    cout << v[i];
  }

  cout << endl;
}

template <typename T>
void drop(T res) {
  cout << res << endl;
  throw exit_exception();
}


Measured memory_bytes: 1024
#include <stdio.h>

int main(void)
{
        long long a, b, c, d;
        long long ans1, ans2, ans3, ans4;

        scanf("%lld%lld%lld%lld", &a, &b, &c, &d);
        ans1 = a * c;
        ans2 = a * d;
        ans3 = b * c;
        ans4 = b * d;
        if (ans1 < ans2)
                ans1 = ans2;
        if (ans1 < ans3)
                ans1 = ans3;
        if (ans1 < ans4)
                ans1 = ans4;
        printf("%lld\n", ans1);
        return (0);
}

Measured memory_bytes: 1732
#include <cstdio>
using namespace std;
int n;
int p;
int ans;
int minn[200005];
inline int min(int a,int b){
	return a<b?a:b;
}
int main(){
	minn[0]=0x3f3f3f3f;
	scanf("%d",&n);
	for (int i=1;i<=n;i++){
		scanf("%d",&p);
		minn[i]=min(minn[i-1],p);
		if (p==minn[i]){
			++ans;
		}
	}
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 896
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using bint = boost::multiprecision::cpp_int;

int main()
{
    int N, K;
    std::cin >> N >> K;
    std::vector<int> hs(N);
    for (int i = 0; i < N; i++) {
        std::cin >> hs.at(i);
    }
    std::vector<int> costs(N);
    costs.at(0) = 0;
    for (int i = 1; i < N; i++) {
        std::vector<int> cand{};
        for (int j = std::max<int>(0, i - K); j < i; j++) {
            cand.emplace_back(costs.at(j) + std::abs(hs.at(i) - hs.at(j)));
        }
        costs.at(i) = *std::min_element(cand.begin(), cand.end());
    }
    std::cout << costs.at(N - 1) << std::endl;
    return 0;
}

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

template <class T> struct ford_fulkerson {
  struct edge {
    int to;
    T cap;
  };
  static constexpr T inf = numeric_limits<T>::max();
  vector<edge> es;
  vector<vector<int>> g;
  vector<int> vis;
  int time;
  ford_fulkerson(int n) : g(n), vis(n), time(0) {}
  void add_edge(int from, int to, T cap) {
    assert(from != to);
    assert(cap >= 0);
    if (cap == 0) return;
    g[from].push_back(es.size()), es.push_back({to, cap});
    g[to].push_back(es.size()), es.push_back({from, 0});
  }
  T dfs(int v, int t, T f) {
    if (v == t) return f;
    vis[v] = time;
    for (int id : g[v]) {
      if (vis[es[id].to] == time or es[id].cap == 0) continue;
      T d = dfs(es[id].to, t, min(f, es[id].cap));
      if (d > 0) {
        es[id].cap -= d;
        es[id ^ 1].cap += d;
        return d;
      }
    }
    return 0;
  }
  T max_flow(int s, int t) {
    assert(s != t);
    T res = 0;
    while (true) {
      ++time;
      T f = dfs(s, t, inf);
      if (f == 0) return res;
      res += f;
    }
  }
};

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n, m;
  cin >> n >> m;
  vector<vector<int>> a(n, vector<int>(m));
  for (auto&& v : a) {
    for (auto&& e : v) {
      cin >> e;
      --e;
    }
  }
  for (int c = 0; c < m; ++c) {
    int s = 2 * n, t = s + 1;
    ford_fulkerson<int> ff(t + 1);
    for (int i = 0; i < n; ++i) {
      ff.add_edge(s, i, 1);
      ff.add_edge(n + i, t, 1);
    }
    for (int i = 0; i < n; ++i) {
      vector<bool> be(n);
      for (int j = c; j < m; ++j) {
        be[a[i][j] / m] = true;
      }
      for (int x = 0; x < n; ++x) {
        if (be[x]) {
          ff.add_edge(i, n + x, 1);
        }
      }
    }
    int f = ff.max_flow(s, t);
    assert(f == n);
    for (int i = 0; i < n; ++i) {
      for (int id : ff.g[i]) {
        if (id % 2 == 0 and ff.es[id].cap == 0) {
          assert(n <= ff.es[id].to and ff.es[id].to < 2 * n);
          int j = find_if(begin(a[i]) + c, end(a[i]), [&](int e) {
            return e / m == ff.es[id].to - n;
          }) - begin(a[i]);
          swap(a[i][c], a[i][j]);
          break;
        }
      }
    }
  }
  for (auto e : a) {
    for (int j = 0; j < m; ++j) {
      cout << e[j] + 1 << " \n"[j == m - 1];
    }
  }
  for (int j = 0; j < m; ++j) {
    vector<int> v;
    for (int i = 0; i < n; ++i) {
      v.push_back(a[i][j]);
    }
    sort(begin(v), end(v));
    for (int i = 0; i < n; ++i) {
      a[i][j] = v[i];
    }
  }
  for (auto e : a) {
    for (int j = 0; j < m; ++j) {
      cout << e[j] + 1 << " \n"[j == m - 1];
    }
  }
}


Measured memory_bytes: 804
#include<bits/stdc++.h>
using namespace std;
int main(){
	string S;
	int step=0;
	int fuck=0;
	cin>>S;
	for(int i=0;i<S.length();i++){
		if(step==0){
			if(S[i]=='C'){
				step=1;
			}
		}else{
			if(S[i]=='F'){
				cout<<"Yes"<<endl;
				return 0;
			}
		}
	}
	cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
//#include <bits/stdc++.h>
#include<vector>
#include<float.h>
#include<iomanip>
#include<algorithm>
#include<string>
#include<cstring>
#include<math.h>
#include<cmath>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include <cassert>
#include <cmath>
#include<cstdint>

#define INF 1e9
#define rep(i,n)for(int i=0;(i)<(int)(n);i++)
#define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
#define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
#define vec(type,n) vector<type>(n)
#define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))
#define ALL(a)  (a).begin(),(a).end()

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

vector<int>bitSearch(int bit,int n){
    vector<int>S;
    rep(i,n)if(bit&(1<<i))S.push_back(i);
    return S;
}

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




int main(){
    double n,m;cin>>n>>m;
    vector<double>a(n);
    double sum = 0;
    rep(i,n){
        cin>>a[i];
        sum += a[i];
    }
    sort(ALL(a),greater<double>());
    double ch = sum/4/m;
    double res = 0;
    rep(i,n){
        if(a[i]<ch)break;
        res++;
    }
    cout<<(res>=m?"Yes":"No");
}



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

int main(){
       int A, B;
       cin>>A>>B;
       if(A==B)cout<<"Draw"<<endl;
       else if(A==1)cout<<"Alice"<<endl;
       else if(B==1)cout<<"Bob"<<endl;
       else if(A>B)cout<<"Alice"<<endl;
       else cout<<"Bob"<<endl;
       return 0;
     }

Measured memory_bytes: 256
#include <cstdio>

using namespace std;
int main() {
	int k, s, ans = 0; //s表示总和数 k表示相加的数的最大取值  
	scanf("%d %d", &k, &s);
	for (int x = 0; x <= k; x++) {
		for (int y = 0; y <= k; y++) {
			int z = s - (x + y);
			if(z >= 0 && z <= k){
				ans++;
			}	
		}
	}
	printf("%d\n", ans);
	return 0;	
}

Measured memory_bytes: 128
#include<stdio.h>

#define MAX 100

static const int Wh=0;
static const int Gr=1;
static const int Bl=2; 
static const int INFTY=(1<<21);

int n;
int M[MAX][MAX];

int prim(void);

int main(void)
{
  int i,j;
  int e;
  
  scanf("%d",&n);

  for(i=0;i<n;i++)
    {
      for(j=0;j<n;j++)
	{
	  scanf("%d",&e);

	  M[i][j]=(e==-1)?INFTY:e;
	}

    }

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

  return 0;
}

int prim(void)
{
  int i;
  int u,v,minv;
  int d[MAX],p[MAX],color[MAX];

  for(i=0;i<n;i++)
    {
      d[i]=INFTY;
      p[i]=-1;
      color[i]=Wh;
    }

  d[0]=0;

  while(1)
    {
      minv=INFTY;

      u=-1;

      for(i=0;i<n;i++)
	{
	  if(minv>d[i]&&color[i]!=Bl)
	    {
	      u=i;
	      minv=d[i];
	    }

	}

      if(u==-1)
	{
	  break;
	}
      
      color[u]=Bl;
 
      for(v=0;v<n;v++)
	{
	  if(color[v]!=Bl&&M[u][v]!=INFTY)
	    {
	      if(d[v]>M[u][v])
		{
		  d[v]=M[u][v];

		  p[v]=u;

		  color[v]=Gr;
		}
	    }

	}

    }

  int sum=0;

  for(i=0;i<n;i++)
    {
      if(p[i]!=-1)
	{
	  sum+=M[i][p[i]];
	}
	  
    }

  return sum;
}



Measured memory_bytes: 2104
k=int(input())
seq = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

print(seq[k-1])

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n,i;
	cin >> n;
	string s,t;
	cin >> s >> t;
	for(i=n; i; i--)if(s.substr(n-i,i)==t.substr(0,i))break;
	cout << n*2-i << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
//make_tuple emplace_back next_permutation push_back make_pair second first setprecision


#if MYDEBUG
#include "lib/cp_debug.hpp"
#else
#define DBG(...) ;
#endif

using LL = long long;
constexpr LL LINF=334ll<<53;
constexpr int INF=15<<26;
constexpr LL  MOD=1E9+7;

namespace Problem{
using namespace std;
class Writer{
static ostringstream oss;
public:template<class T> void appendln(const vector<vector<T>> &ans,string spl=" ", string el="\n"){for(int i=0; i<(int)ans.size(); ++i){for(int j=0; j<(int)ans[i].size(); ++j){oss << ans[i][j];oss << (j==(int)ans[i].size()-1?el:spl);}}}
    template<class T> void appendln(const vector<T>& ans, string spl=" "){for(int i=0; i<(int)ans.size(); ++i){oss << ans[i] << (i==(int)ans.size()-1?"\n":spl);}}
    template<class T> void appendln(const T& answer){oss << answer << "\n";}
    template<class T> void append(const T& answer){oss << answer;}
    void appends(const string spl){oss.seekp((int)oss.tellp()-1);oss<<"\n";}
    template<class F, class... R>void appends(const string spl,const F& fi, const R&... rest){oss << fi << spl; appends(spl, rest...);}
    static void write(){cout << oss.str();}
    Writer(){static bool is_single =true;assert(is_single);is_single=false;};
};ostringstream Writer::oss;


class Solver{
public:
    LL n,a,b;
    Solver(LL n):n(n){};

    void solve(){
        cin>> a >> b;
        if(a+b>n+1 or a*b<n){
            cout << -1 <<"\n";
            return;
        }
        vector<vector<int>> ans(b);
        int sz = n;
        for(int i=0; i<a; ++i){
            ans[0].push_back(i);
            --sz;
        }
        for(int i=1; i<b; ++i){
            int tmp = min(a,sz-(b-1-i));
            for(int j=0; j<tmp; ++j){
                ans[i].push_back(n-sz+j);
            }
            sz-=tmp;
        }

        for(int i=(int)ans.size()-1; i>=0; --i){
            for(int j=0; j<(int)ans[i].size(); ++j){
                cout << ans[i][j]+1<<' ';
            }
        }
        cout <<"\n";
    }
};
}

int main(){
    std::cin.tie(0);
    std::ios_base::sync_with_stdio(false);
    long long n=0;
    std::cin >> n;
    Problem::Solver sol(n);
    sol.solve();
    Problem::Writer::write();
    return 0;
}



Measured memory_bytes: 13184
#include<bits/stdc++.h>
using namespace std;
int a[5];
int main(){
	for(int i=0;i<4;i++) scanf("%d",a+i);
	sort(a,a+4);
	if(a[0]==1&&a[1]==4&&a[2]==7&&a[3]==9) printf("YES");
	else printf("NO");
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(long long int i = 0; i < n; i++)
#define _rep(i, m, n) for(long long int i = m; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int N = 1000000;
const ll mod = 1000000007;
using Graph = vector<vector<int>>;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

ll gcd(ll A, ll B){
    if(B == 0)return A;
    return gcd(B, A % B);
}
ll lcm(ll A, ll B){
    return A * B / gcd(A, B);
}

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

int main(){
    int k; cin >> k;
    string s; cin >> s;
    int n = s.size();
    if(s.size() <= k){
        cout << s << endl;
    }else{
        string t = s.substr(0, k) + "...";
        cout << t << endl;
    }
    
}

Measured memory_bytes: 3628
INF = 1 << 30
H, W = map(int, raw_input().split())
G = [map(int, list(raw_input())) for _ in xrange(H)]
dp = [[0] * W + [INF] for _ in xrange(H)] + [[0] + [INF] * (W)]
for y in xrange(H):
    for x in xrange(W):
            dp[y][x] = min(dp[y-1][x], dp[y][x-1]) + G[y][x]
print dp[H-1][W-1]

Measured memory_bytes: 4300
#include"bits/stdc++.h"
using namespace std;

#define ll long long
#define INF INT_MAX/3
#define pi 2*acos(0.0)
#define eps 1e-14

const int MAX_N = (int)1e+3;
const int MAX_M = (int)1e+2;
ll n;

void input()
{
	scanf("%lld", &n);
}
void solve()
{
	ll ans = 0;
	ans = 2*(n / (ll)11);
	n = n % 11;
	if (n == 0) {
		;
	}
	else if (n <= 6) {
		ans++;
	}
	else {
		ans += 2;
	}

	cout << ans << endl;
}
int main() {
	input();
	solve();
	return 0;
}

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

int main() {
    ll N,x;
    cin >> N >>x;
    if(x==1 || x == 2*N-1){
        cout <<"No" << endl;
        return 0;
    }
    cout <<"Yes" << endl;
    if(x==N){
        for(int i=1;i<2*N;i++){
            cout <<i <<"\n";
        }
        return 0;
    }
    if(x<N){
        for(int i=0;i<(N-2);i++){
            cout << N*2-1-i << "\n";
        }
        cout << x << "\n";
        cout << 1 << "\n";
        for(int i=N;i<2*N;i++){
            if( N*2+1-i==x){
                continue;
            }
            cout << N*2+1-i <<"\n";
        }
        return 0;
    }

     for(int i=0;i<(N-2);i++){
            cout << i+1 << "\n";
        }
        cout << x << "\n";
        cout << 2*N-1 << "\n";
        for(int i=N;i<2*N;i++){
            if(i-1 ==x){
                continue;
            }
            cout << i-1 <<"\n";
        }




    return 0;
}

Measured memory_bytes: 3632
var
	n,i,l,r:Longint;
	a,v:array[1..100001]of Longint;
	ans:int64;
	fac:array[0..100001]of int64;
function power(a,b:int64):int64;
var s:int64;
begin
	if b=0 then power:=1
	else begin
		s:=power(a*a mod 1000000007,b div 2);
		if b mod 2=1 then s:=s*a mod 1000000007;
		power:=s;
	end;
end;
function C(a,b:int64):int64;
begin
	if(b<0)or(b>a)then begin
		C:=0;
		exit;
	end;
	C:=fac[a]*power(fac[a-b],1000000005)mod 1000000007*power(fac[b],1000000005)mod 1000000007;
end;
begin
	fac[0]:=1;
	for i:=1 to 100001 do fac[i]:=fac[i-1]*i mod 1000000007;
	read(n);
	for i:=1 to n+1 do begin
		read(a[i]);
		if v[a[i]]=0 then v[a[i]]:=i
		else begin
			l:=v[a[i]]-1;
			r:=n+1-i;
		end;
	end;
	for i:=1 to n+1 do writeln((C(n+1,i)-C(l+r,i-1)+1000000007)mod 1000000007);
end.


Measured memory_bytes: 2560
package main

import (
	"fmt"
)

func main() {
	var s string

	fmt.Scan(&s)

	if s == "Sunny" {
		fmt.Println("Cloudy")
	} else if s == "Cloudy" {
		fmt.Println("Rainy")
	} else {
		fmt.Println("Sunny")
	}
}


Measured memory_bytes: 512
import collections

n = int(input())
n_half = n//2
v = list(map(int, input().split()))
v_gusu = v[0::2]
v_odd = v[1::2]
ans = 0
c1 = collections.Counter(v)
c2 = collections.Counter(v_gusu)
c3 = collections.Counter(v_odd)

if c1.most_common()[0][1] == n:
    print(n_half)
    exit()

if c2.most_common()[0][0] == c3.most_common()[0][0]:
    print(min((n_half - c2.most_common()[1][1]) + (n_half - c3.most_common()[0][1]),(n_half - c2.most_common()[0][1]) + (n_half - c3.most_common()[1][1])))
    exit()
else:
    print((n_half - c2.most_common()[0][1]) + (n_half - c3.most_common()[0][1]))
    exit()

Measured memory_bytes: 32856
h,w,k=map(int, input().split())
s=[list(input()) for _ in range(h)]

ans=[[0]*w for i in range(h)]
cnt=1
for i in range(h):
    for j in range(w):
        if s[i][j]=="#":
            ans[i][j]=cnt
            cnt+=1

for i in range(h):
    for j in range(w):
        if ans[i][j]==0:
            if j!=0:
                ans[i][j]=ans[i][j-1]
for i in range(h):
    for j in range(w-1, -1, -1):
        if ans[i][j]==0:
            if j!=(w-1):
                ans[i][j]=ans[i][j+1]

# for i in range(h):
#     print(*ans[i])
# print()

for i in range(h):
    for j in range(w):
        if ans[i][j]==0:
            if i!=0:
                ans[i][j]=ans[i-1][j]

for i in range(h-1, -1, -1):
    for j in range(w):
        if ans[i][j]==0:
            if i!=(h-1):
                ans[i][j]=ans[i+1][j]

for i in range(h):
    print(*ans[i])



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


using namespace std;

void swap(string* a, string* b) 
{ 
    string t = *a; 
    *a = *b; 
    *b = t; 
} 
  


int partition(string arr[], int low,int high){
    string pivot = arr[high];
    int i = (low-1);
    for (int j = low; j <= high- 1; j++) 
    { 
        
        if (arr[j] <= pivot) 
        { 
            i++;    // increment index of smaller element 
            swap(&arr[i], &arr[j]); 
        } 
    } 
    swap(&arr[i + 1], &arr[high]); 
    return (i + 1); 
    
    
}



int quicksort(string arr[],int low,int high){
    if(low<high){
        
        int pi= partition(arr,low,high);
        quicksort(arr,low,pi-1);
        quicksort(arr,pi+1,high);
    }
}




int main() {
	
	int n,l;
	cin>>n>>l;
	
	string final;
	
	string word[n];
	
	for(int i=0;i<n;i++){
	    cin>>word[i];
	    }
	
	int k = sizeof(word)/sizeof(word[0]); 
	quicksort(word,0,k-1);
	
	for(int i=0;i<n;i++){
	    final = final + word[i];
	    //cout<<word[i]<<endl;
	    }
	
	cout<<final<<endl;
	// your code goes here
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string.h>
#include <algorithm>
#include <vector>
#include <queue>

using namespace std;
typedef long long ll;
const int INF=1000000;
int dp1[5005][5005]={};
int dp2[5005][5005]={};
int main() {
	int n,k;
	int a[5002];
	cin>>n>>k;
	for(int i=1;i<=n;++i)cin>>a[i];
	sort(a,a+n);
	dp1[0][0]=1;
	for(int i=1;i<=n;++i){
		for(int j=0;j<5000;++j){
			if(dp1[i-1][j]){
				dp1[i][min(5005,j+a[i])]=1;
				dp1[i][j]=1;
			}
		}
	}
	for(int i=0;i<=n;++i){
		for(int j=1;j<=5005;++j)dp1[i][j]+=dp1[i][j-1];
	}
	dp2[n+1][0]=1;
	for(int i=n;i>0;--i){
		for(int j=0;j<5000;++j){
			if(dp2[i+1][j]){
				dp2[i][min(5005,j+a[i])]=1;
				dp2[i][j]=1;
			}
		}
	}
	for(int i=1;i<=n+1;++i){
		for(int j=1;j<=5005;++j)dp2[i][j]+=dp2[i][j-1];
	}
	ll ans=0;
	for(int i=1;i<=n;++i){
		for(int j=0;j<k;++j){
			int h=k-j;
			if(dp1[i-1][j]-dp1[i-1][j-1]&&dp2[i+1][h-1]-dp2[i+1][max(h-a[i]-1,-1)]){
//				cout<<i<<" "<<j<<endl;
				ans++;
				break;
			}
		}
	}
	cout<<n-ans<<endl;
	return 0;
}


Measured memory_bytes: 195840
#与えられたn個の整数の最小値、最大値、合計値を求めるプログラム

n = int(input())
list = input().split()
min = 1000001; max = -1000001; add = 0

i = 0
while i < n:
    if min > int(list[i]):
        min = int(list[i])
    if max < int(list[i]):
        max = int(list[i])
    add = add + int(list[i])
    i += 1

print(min, max, add)


Measured memory_bytes: 6336
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#define MAXN 100000



int main() {
    char ch, a ,b;
    a = fgetc(stdin);
    b = fgetc(stdin);
    ch = fgetc(stdin);
    if (ch == '\n')
        std::cout << a << b;
    else
        std::cout << ch << b << a;
}


Measured memory_bytes: 256
/*
    Author:zeke

    pass System Test!
    GET AC!!
*/
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using ll = long long;
using ld = long double;
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define rep3(var, min, max) for (ll(var) = (min); (var) < (max); ++(var))
#define repi3(var, min, max) for (ll(var) = (max)-1; (var) + 1 > (min); --(var))
#define Mp(a, b) make_pair((a), (b))
#define F first
#define S second
#define Icin(s) \
    ll(s);      \
    cin >> (s);
#define Scin(s) \
    ll(s);      \
    cin >> (s);
template <class T>
bool chmax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T& a, const T& b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef vector<V> VV;
typedef vector<P> VP;
ll mod = 1e9 + 7;
ll MOD = 1e9 + 7;
ll INF = 1e18;
// cout << "Case #" << index << " :IMPOSSIBLE";
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    ll n;
    cin>>n;
    vector<bool> dp(1e6+100,false);
    V vec(n);
    map<ll,ll> mp;
    map<ll,ll> mp2;
    rep(i,n){
        cin>>vec[i];
        mp[vec[i]]++;
    }
    sort(all(vec));
    rep(i,n){
        ll index=2;
        if(mp2[vec[i]]==1){
            continue;
        }
        mp2[vec[i]]++;
        while(vec[i]*index<=1e6+10){
            dp[vec[i]*index]=true;
            index++;
        }
    }
    ll res=0;
    rep(i,n){
        if(dp[vec[i]]||mp[vec[i]]>=2){
        //    cout<<vec[i]<<endl;
            res++;
        }
    }
    cout<<n-res<<endl;
}


Measured memory_bytes: 29820
import sys

def main():
    input = sys.stdin.readline
    N = int(input())
    K = int(input())
    X = int(input())
    Y = int(input())

    if N <= K:
        return X * N
    else:
        return K * X + (N - K) * Y


if __name__ == '__main__':
    print(main())


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

using namespace std;
int main() {
	int n;
	while (cin >> n && n) {
		int sum = 0;
		int ln = 100000;
		int hn = 0;
		for (int i = 0; i < n; ++i) {
			int d;
			cin >> d;
			ln = min(d, ln);
			hn = max(hn, d);
			sum += d;
		}
		cout << (sum - hn - ln) / (n - 2) << endl;
	}
	return 0;
}


Measured memory_bytes: 3000
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using V = vector<int>;
using VV = vector<V>;
using VVV = vector<VV>;
using VL = vector<ll>;
using VVL = vector<VL>;
using VVVL = vector<VVL>;
template<class T> using VE = vector<T>;
template<class T> using P = pair<T, T>;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define REP(i,k,n) for(int i=(k);i<(n);i++)
#define all(a) (a).begin(),(a).end()
#define output(x,y) cout << fixed << setprecision(y) << x << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
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; }
const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
ll upper = MOD + MOD;
ll under = -upper;
ll UPPER = MOD * MOD;
ll UNDER = -UPPER;
const long double pi = 3.141592653589793;
const int N = 1010101;
V used(N, 0);
bool flag = true;
void prime_fact(ll x) {
	for (ll i = 2; i * i <= x; i++) {
		if (x % i != 0) continue;
		used[i]++;
		while (x % i == 0) {
			x /= i;
		}
	}
	if (x != 1) {
		used[x]++;
	}
}
int main() {
	int n;
	cin >> n;
	V a(n);
	rep(i, n) {
		cin >> a[i];
		prime_fact(a[i]);
	}
	int gcds = a[0];
	rep1(i, n - 1) {
		gcds = gcd(gcds, a[i]);
	}
	rep(i, N) {
		if (used[i] >= 2) flag = false;
	}
	if (flag) cout << "pairwise coprime" << endl;
	else if (gcds == 1) cout << "setwise coprime" << endl;
	else cout << "not coprime" << endl;
	return 0;
}

Measured memory_bytes: 11176
import math
a,b,x = list(map(int,input().split()))
if x/a > a*b/2:
    y = 2*b-(2*x)/a**2
    print(math.degrees(math.atan(y/a)))
else:
    y = (2*x)/(a*b)
    print(90-math.degrees(math.atan(y/b)))

Measured memory_bytes: 3060
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Comparator;
import java.util.NoSuchElementException;
import java.util.PriorityQueue;
import java.util.Queue;

public class Main {

	public static void main(String[] args) {
		PrintWriter out = new PrintWriter(System.out);
		FastScanner scan = new FastScanner();

		int n = scan.nextInt();
		int m = scan.nextInt();

		Queue<Integer> a = new PriorityQueue<Integer>(n, new Comp());

		for (int i = 0; i < n; i++) {
			a.add(scan.nextInt());
		}

		for (int i = 0; i < m; i++) {
			a.add((int) a.poll() / 2);
		}

		long result = 0;
		for (int i = 0; i < n; i++) {
			result += a.poll();
		}

		out.println(result);
		out.flush();
	}
}

class Comp implements Comparator<Object> {

	public int compare(Object obj1, Object obj2) {

		int num1 = (int) obj1;
		int num2 = (int) obj2;

		if (num1 < num2) {
			return 1;
		} else if (num1 > num2) {
			return -1;
		} else {
			return 0;
		}
	}
}

class FastScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}

	private int readByte() {
		if (hasNextByte())
			return buffer[ptr++];
		else
			return -1;
	}

	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}

	public boolean hasNext() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr]))
			ptr++;
		return hasNextByte();
	}

	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	public long nextLong() {
		if (!hasNext())
			throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}

	public int nextInt() {
		long nl = nextLong();
		if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
			throw new NumberFormatException();
		return (int) nl;
	}

	public double nextDouble() {
		return Double.parseDouble(next());
	}
}

Measured memory_bytes: 25684
S = input().split()
ope = []

for s in S:
  if s.isdigit():
    ope.append(s)
  else:
    a = int(ope.pop())
    b = int(ope.pop())
    if s == '+':
      ope.append(a + b)
    elif s == '-':
      ope.append(b - a)
    else:
      ope.append(a * b)
print(ope[0])


Measured memory_bytes: 5600
N,K = map(int,input().split())
P = list(map(int,input().split()))
goukei = 0
max = 0
startnum = 0
for i in range(K):
    goukei += P[i]

for i in range(N-K):
    goukei = goukei - P[i] + P[i+K]
    if goukei > max:
        max = goukei
        startnum = i+1
        
answer = 0
for i in range(startnum,startnum+K):
    n = P[i]
    answer += n*(n+1)/2/n
print(answer)

Measured memory_bytes: 25060
#include <stdio.h>
#include <string.h>
#define min(p,q)((p)<(q)?(p):(q))

char s[1010],t[1010];
int dp[1010][1010];
int main(){
	scanf("%s%s",s,t);
	int sn=strlen(s);
	int tn=strlen(t);
	for(int i=1;i<=sn;i++)dp[i][0]=i;
	for(int j=1;j<=tn;j++)dp[0][j]=j;
	for(int i=1;i<=sn;i++)for(int j=1;j<=tn;j++)dp[i][j]=min(min(dp[i-1][j]+1,dp[i][j-1]+1),dp[i-1][j-1]+(s[i-1]!=t[j-1]));
	printf("%d\n",dp[sn][tn]);
}


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

int main(){
  int n;
  cin>>n;
  int m=0;
  map<pair<int,int>,int> ma;
  int vec[n][2];
  for(int i=0;i<n;i++){
    cin>>vec[i][0]>>vec[i][1];
  }
  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
      if(i==j) continue;
      int a,b;
      a=vec[i][0]-vec[j][0];
      b=vec[i][1]-vec[j][1];
      pair<int,int> p=make_pair(a,b);
      ma[p]++;
      m=max(m,ma[p]);
    }
  }
  cout<<n-m<<endl;
}

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

int main()
{
    int N;
    int cnt = 0;
    cin >> N;
    vector<int> a(N);
    rep(i, 0, N)
    {
        cin >> a[i];
    }
    rep(i, 0, N)
    {
        if (i == a[a[i] - 1] - 1)
        {
            cnt++;
        }
    }

    cout << cnt / 2 << endl;
    return 0;
}


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

int main() {

    int a, b, c, d;

    scanf("%d %d %d %d", &a, &b, &c, &d);
    
    printf("%d",(a*b>=c*d ? a*b : c*d));


    return 0;

}


Measured memory_bytes: 128
def main():
    while True:
        a,b=map(int,input().split())
        
        if a==0 and b==0:
            break
        l=[]
        for i in range(a):
            l.append(int(input()))
        count=0
        
        for i in range(b):
            count+=l[i]
        anser=count
        
        for i in range(b,a):
            count+=l[i]
            count-=l[i-b]
            anser=max(anser,count)
        print(anser)
        
if __name__ == '__main__':
    main()



Measured memory_bytes: 9608
#include <iostream>
#include <vector>
#include <cstdio>
#include <string>
#include <cmath>
#include <algorithm>
#include <climits>
#define ll long long
#define MAX 25 * 1e13
#define N  200010

using namespace std;
int MOD = 1000000007;

int main(){
  int n;
  int a[10][10];
  for(int i = 0 ; i < 3 ; i++ ){
    for(int j = 0 ; j < 3 ; j++ ){
      cin >> a[i][j];
    }
  }
  cin >> n;
  vector<int> b(n);
  int has[10][10] = {0};
  for(int i = 0 ; i < n ; i++ ){
    cin >> b[i];
    for(int ii = 0 ; ii < 3 ; ii++ ){
      for(int j = 0 ; j < 3 ; j++ ){
        if( b[i] == a[ii][j]) has[ii][j] = 1;
      }
    }
  }

  int ret = 0;
  string y = "Yes";
  string no = "No";
  int sum[10] = {0};
  for(int i = 0 ; i < 3 ; i++ ){
    sum[0] += has[0][i];
    sum[1] += has[1][i];
    sum[2] += has[2][i];

    sum[3] += has[i][0];
    sum[4] += has[i][1];
    sum[5] += has[i][2];

    sum[6] += has[i][i];
    sum[7] += has[i][2-i];
  }
  int flag = 0;
  for(int i = 0 ; i < 8 ; i++ ){
    if( sum[i] == 3 ) {
      flag = 1;
      break;
    }
  }

  if( flag != 0  )  cout << y << endl;
  else cout << no << endl;

  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(void){
    int a,b,ans,i;
    char op;
    
    
    for(i=1;i<10000;i++){
        scanf("%d %c %d",&a,&op,&b);
        if(op=='+'){
            ans=a+b;
            printf("%d\n",ans);
        }
        else if(op=='-'){
            ans=a-b;
            printf("%d\n",ans);
        }
        else if(op=='*'){
            ans=a*b;
            printf("%d\n",ans);
        }
        else if(op=='/'){
            ans=a/b;
            printf("%d\n",ans);
        }
        else if(op=='?'){
            break;
        }
        
    }
    
    return 0;
    
}


Measured memory_bytes: 2040
#include<iostream>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <climits>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <iomanip>
using namespace std;
const long long int mod1=1000000007;
const long long int mod2 = -1;
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb push_back
#define pp pop_back                                       
#define ff first
#define ss second
#define ll long long int
#define ull unsigned long long int
#define inf mod1
ll gcd(ll a, ll b){
    ll c;
     while(b){
        c = b;
        b = a % b;
        a = c;
     }
     return a;
}
ll power1(ll a, ll b){
     if(b == 0) return 1;
     else if(b % 2) return a * power1(a, b - 1);
     else {
        ll temp = power1(a, b / 2);
        return temp * temp;
     }
}
ll power2(ll a, ll b, ll m){
     a %= m;
     if(b == 0) return 1;
     else if(b % 2) return (a * power2(a, b - 1, m)) % m;
     else{
        ll temp = power2(a, b / 2, m);
        return (temp * temp) % m;
     }
}
ll mod(ll x, ll p){
return (x % p + p) % p;
}
ll lcm(ll x, ll y){
return (x * y)/gcd(x, y);
}
int main(){
	fast;
	ll h = 1;
	//scanf("%lld", &h);
    while(h--){ 
           ll n;
           cin >> n;
           ll p[n];
           for(int  i =0; i < n; i++){
            cin >> p[i];
           }
        ll out = 1;
        ll min1 = p[0];
        for(int  i =1 ; i < n; i++){
            if(p[i] <= min1){
                out++;
            }
            min1 = min(min1, p[i]);
        }
        cout << out << endl;
        }   
    }       

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


using namespace std;

using ll   = long long;
using ii   = pair   < int , int >;
using i3   = pair   < int , ii  >;
using li   = pair   < ll  , int >;
using lii  = pair   < ll  , ii  >;
using pll  = pair   < ll  , ll  >;
using vi   = vector < int       >;
using vl   = vector < ll        >;
using vii  = vector < ii        >;
using vli  = vector < li        >;
using vpll = vector < pll       >;
using vi3  = vector < i3        >;
using vlii = vector < lii       >;


const int N = 1000 + 5 , INF = 2e9;
const double eps = 1e-9 , PI = acos(-1);


int n , m , k;

char s[12][N];
int  a[12][N];

void solve(int testCase){

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

    vector < int > P;
    for(int i = 1 ; i <= n ; i ++){
            scanf("%s" , s[i] + 1);
            for(int j = 1 ; j <= m ; j ++){
                    if(s[i][j] == '1')a[i][j] = 1;
            }

            if(i < n)P.push_back(i);
    }

    int sz = n - 1;
    int ans = 2e9;
    for(int mask = 0 ; mask < (1 << sz) ; mask ++){

            vector < bool > cut(n + 1 , 0);
            for(int i = 0 ; i < sz ; i ++){
                    if(mask & (1 << i)){
                            cut[P[i]] = 1;
                    }
            }

            int cnt = 0;
            bool sol = 1;
            vector < vector < int > > sum(n + 1 , vector < int > (m + 1 , 0));
            for(int j = 1 ; j <= m ; j ++){
                    int mx = 0;
                    for(int i = 1 ; i <= n ; i ++){

                            if(cut[i-1]){
                                    sum[i][j] = a[i][j] + sum[i][j-1];
                            }
                            else {
                                    sum[i][j] = a[i][j] + sum[i][j-1] + sum[i-1][j] - sum[i-1][j-1];
                            }
                            mx = max(mx , sum[i][j]);

                    }

                    if(mx > k){
                            cnt ++;
                            mx = 0;
                            for(int i = 1 ; i <= n ; i ++){
                                    sum[i][j-1] = 0;
                            }
                            for(int i = 1 ; i <= n ; i ++){
                                    if(cut[i-1]){
                                            sum[i][j] = a[i][j] + sum[i][j-1];
                                    }
                                    else {
                                            sum[i][j] = a[i][j] + sum[i][j-1] + sum[i-1][j] - sum[i-1][j-1];
                                    }
                                    mx = max(mx , sum[i][j]);
                            }

                            if(mx > k)sol = 0;
                    }
            }

            if(sol){
                    ans = min(ans , cnt + __builtin_popcount(mask));
            }
    }
    printf("%d\n" , ans);
}

main(){

    int t = 1;
    // scanf("%d" , &t);

    for(int testCase = 1 ; testCase <= t ; testCase ++){
            solve(testCase);
    }

    return 0;
}


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

//最大公約数(引数の型に注意)
ll gcd(ll a,ll b){
    if(a<b)swap(a,b);
    if(a%b==0)return b;
    return gcd(a%b,b);
}

//最小公倍数
ll lcm(ll a,ll b){
    return a/gcd(a,b)*b;
}
 
int main() {
    int n;
    cin>>n;
    vector<ll> T(n);
    rep(i,n)cin>>T[i];
    ll ans=1;
    rep(i,n){
        ans=lcm(ans,T[i]);
    }
    cout<<ans<<endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000001

#define NUM 2147483647

int N = 1;
int* value;

void init(int first_N){
	while(N < first_N)N *= 2;
}

//update(s, t, value, 0, 0, N-1)でas,as+1,...,atの値をxに変更する
void update(int update_left,int update_right,int new_value,int node_id,int node_left,int node_right){
	if(update_right < node_left || update_left > node_right)return;
	else if(update_left <= node_left && update_right >= node_right){
		value[node_id] = new_value;
	}else{
		if(value[node_id] >= 0){
			value[2*node_id+1] = value[node_id];
			value[2*node_id+2] = value[node_id];
			value[node_id] = -1;
		}
		update(update_left,update_right,new_value,2*node_id+1,node_left,(node_left+node_right)/2);
		update(update_left,update_right,new_value,2*node_id+2,(node_left+node_right)/2+1,node_right);
	}
}

//query(loc, loc, 0, 0, N-1)でalocの値を出す(sumもあるかもしれないが要検討)
int query(int search_left,int search_right,int node_id,int node_left,int node_right){
	if(search_right < node_left || search_left > node_right){
		return -1;
	}else if(node_left <= search_left && node_right >= search_right && value[node_id] >= 0){
		return value[node_id];
	}else{
		int left = query(search_left,search_right,2*node_id+1,node_left,(node_left+node_right)/2);
		int right = query(search_left,search_right,2*node_id+2,(node_left+node_right)/2+1,node_right);
		return max(left,right);
	}
}

//問題は0-indexedで渡されている
int main(){
	int n, q; cin >> n >> q;
	init(n);

	value = new int[270000];

	for(int i = 0; i <= 2*N-2; i++) value[i] = NUM;

	int command, left, right, value, loc;

	for(int i = 0; i < q; i++){
		cin >> command;

		if(command == 0){
			cin >> left >> right >> value;
			update(left,right,value,0,0,N-1);
		}else{
			cin >> loc;
			cout << query(loc, loc, 0, 0, N-1) << endl;
		}
	}
}



Measured memory_bytes: 4140
#include <stdio.h>
#include <stdlib.h>

int main()
{int a,b,c,d,m,n;
while(~scanf("%d%d%d%d",&a,&b,&c,&d))
{if(a>=b)
 m=b;
 if(a<b)
 m=a;
 if(c>=d)
 n=d;
 if(d>c)
 n=c;
 printf("%d\n",m+n);
}
    return 0;
}


Measured memory_bytes: 256
using Microsoft.VisualBasic;
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net.Http.Headers;
using System.Security.Cryptography;

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

		const int mod = 1000000007;  // 10^9+7
		static int Mod(long x, int m) { return (int)((x % m + m) % m); }
		static long Mod(long x, long m) { return (x % m + m) % m; }

		static public void Solve(string[] args)
		{
			//string s = Console.ReadLine();
			//int n = int.Parse(Console.ReadLine());
			//long x = long.Parse(Console.ReadLine());
			//int[] vs = Console.ReadLine().Split().Select(int.Parse).ToArray();
			//long[] vs = Console.ReadLine().Split().Select(long.Parse).ToArray();

			int n = int.Parse(Console.ReadLine());
			int[] a = Console.ReadLine().Split().Select(int.Parse).ToArray();

			long ans = 0;
			long sum = 0;
			for (int i = a.Length - 2; i >= 0; i--) {
				sum += a[i + 1];
				sum %= mod;
				ans += a[i] * sum;
				ans %= mod;
			}
			Console.WriteLine(ans);

		}
	}
}


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

int main(){
  int N, X, Y;
  cin >> N >> X >> Y;
  vector<int> ans(N-1);
  int tmp;
  for  (int i = 1; i < N+1; i++){
    for (int j = i+1; j < N+1; j ++){
      tmp = min(j-i, abs(X-i) +1 + abs(Y-j));
      ans.at(tmp-1) += 1;
    }
  }
  for (int k = 0; k < N-1; k++){
    cout << ans.at(k) << endl;
  }
}


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

vector<string> gen_candidates(const string& Sd, const string& T){
    vector<string> vecCand;
    for(int i=0; i<Sd.size()-T.size()+1; ++i){
        int t;
        string buf; buf.clear();
        for(t=0; t<T.size(); ++t){
            if(Sd[i + t] != T[t] && Sd[i + t] != '?'){ break; }
        }
        if(t < T.size()){ continue; }
        for(int k=0;   k<i;         ++k){ buf += ((Sd[k]=='?') ? 'a':Sd[k]); }
        for(int k=0;   k<T.size();  ++k){ buf += T[k]; }
        for(int k=i+t; k<Sd.size(); ++k){ buf += ((Sd[k]=='?') ? 'a':Sd[k]); }
        vecCand.emplace_back(buf);
    }
    return vecCand;
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    string Sd; cin >> Sd;
    string T;  cin >> T;
    
    vector<string> vecCand = gen_candidates(Sd, T);
    if(vecCand.size()==0){ cout << "UNRESTORABLE" << endl; return 0; }
    
    sort(vecCand.begin(), vecCand.end());
    cout << vecCand[0] << endl;
    
    return 0;
}

// ref: https://atcoder.jp/contests/abc076/submissions/1717950

// Additional TEST case 1
/*
ab???ba
abcba

candidate1: abcbaba
candidate1: ababcba <--
 */

// Additional TEST case 2
/*
cb???bc
cbabc

candidate1: cbabcbc <--
candidate1: cbcbabc
 */


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,l,r) for (int i=l;i<=r;i++)
using namespace std;
int n;
long long ans;
int a[100500];
int main(){
    scanf("%d",&n);
    rep(i,1,n) scanf("%d",&a[i]);
    int last=0;
    rep(i,1,n) {
        if (last&&a[i]) a[i]--,ans++,last=0;
        ans+=a[i]/2;
        if (a[i]&1) last=1;
        else last=0;
    }
    printf("%lld\n",ans);
    return 0;
}

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

vector<int> vec;

int main(void){
    int n,t,sum=0;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>t;
        sum+=t;
        vec.push_back(t);
    }
    sort(vec.begin(),vec.end());
    if(sum%10)cout<<sum<<endl;
    else{
        int ans=0;
        for(int i=0;i<n;i++){
            if(vec[i]%10){
                ans=sum-vec[i];
                break;
            }
        }
        cout<<ans<<endl;
    }
    
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <list>
#include <set>
#include <queue>
#include <map>
#include <algorithm>
#include <functional>
#include <string>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
using namespace std;

#define REP(i,p,n) for(int i=p;i<n;++i)
#define rep(i,n) REP(i,0,n)

using ll = long long int;
using pll = pair<ll, ll>;

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

    vector<int> hs(n);
    rep(i, n) { cin >> hs[i]; }

    int maxHeight = -1;
    int ans = 0;

    rep(i, n)
    {
        if (maxHeight <= hs[i]) { ++ans; }
        maxHeight = std::max<int>(maxHeight, hs[i]);
    }

    cout << ans << endl;

    return 0;
}


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

using namespace std ; 

typedef long long lint ; 
typedef long double ntrl ; 

# define MAXN 10010
# define MAXM 500010
# define INF 2147483647

///global variable///
int n ; 
/////*/

///basic function///
inline lint min ( lint x , lint y ) { return x < y ? x : y ; }
inline lint max ( lint x , lint y ) { return x > y ? x : y ; }
inline bool isltr ( char x ) { return ( 'A' <= x && x <= 'Z' ) || ( 'a' <= x && x <= 'z' ) ; }
inline bool isnum ( char x ) { return ( '0' <= x && x <= '9') ; }
/////*/

///fast read///
inline lint readlint ( )
{
	lint val = 0 , sign = 1 ; char tmp = getchar ( ) ; 
	while ( ! isnum ( tmp ) ) { if ( tmp == '-' ) { sign = - sign ; } tmp = getchar ( ) ;  } 
	while ( isnum ( tmp ) ) { val = ( val << 1 ) + ( val << 3 ) + tmp - 48 ; tmp = getchar ( ) ; } 
	return val * sign ; 
}
inline char readlter ( ) 
{
	char tmp = getchar ( ) ; 
	while ( ! isltr ( tmp ) )
		tmp = getchar ( ) ; 
	return tmp ; 
}
/////*/

int main ( )
{
	putchar ( getchar ( ) + 1 ) ; 
	printf ( "\n" ) ; 
	return 0 ; 
}

Measured memory_bytes: 256