akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define ll long long
#define ull unsigned long long
#define ld long double
#define vl vector<long long>
#define vvl vector<vector<long long>>
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define rrep(i, x) for (ll i = ((ll)(x)-1); i >= 0; i--)
#define pll pair<long long,long long>
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define vvc vector<vector<char>>
#define vc vector<char>
#define vvb vector<vector<bool>>
#define vb vector<bool>
#define maxe(x) *max_element(all(x))
#define mine(x) *min_element(all(x))
#define Size(x) ((int)(x).size())
#define umap unordered_map
const long long INF = 1LL << 60;
const long double pi = 3.1415926535897932;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

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

//lis,modpow,uf,modncr,soinsubunkai,yakusurekkyo,gyakugen
//mint,dijkstra
    signed main(){
        ios::sync_with_stdio(false);
        cin.tie(nullptr);
        ll n;
        cin>>n;
        ll res=1;
        rep(i,n){
            res*=i+1;
            res%=1000000007;
        }
        cout<<res<<endl;
    }

Measured memory_bytes: 256
//is there any case of -1 or any special corner cases ?
#include<bits/stdc++.h>
using namespace std;
#define int long long int 
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define vi vector<int>
#define pi pair<int,int>
#define all(v) v.begin(),v.end()
#define zeros(arr) memset(arr,0,sizeof(arr));
#define precise(num)  cout<<fixed; cout << std::setprecision(num)
#define nl cout<<"\n";
#define test int t;cin>>t;while(t--) 
const int maxx  = 1e6+2 , limit = 9*1e18 , MOD=1e9+7;
int32_t main(){
    // boost;
    string s;cin>>s;
    reverse(all(s));
    if(s[0] == '3'){
        cout<<"bon\n";
    }else if(s[0] == '0' || s[0] == '1' || s[0] == '6' || s[0] == '8'){
        cout<<"pon\n";
    }else{
        cout<<"hon\n";
    }
}


Measured memory_bytes: 3580
using System;
using System.IO;
using System.Linq;

namespace CompetitiveProgramming
{

  class Solve
  {

    const int INF = (int)1e9 + 10;

    private void main()
    {
      string input = Console.ReadLine();
      int S = 0, E = 0, N = 0, W = 0;
      foreach (var a in input)
      {
        if (a == 'S')
        {
          S++;
        }
        else if (a == 'E')
        {
          E++;
        }
        else if (a == 'N')
        {
          N++;
        }
        else
        {
          W++;
        }
      }
      bool flag = true;
      if (S > 0)
      {
        if (N == 0)
        {
          flag = false;
        }        
      }
      if (N > 0)
      {
        if (S == 0)
        {
          flag = false;
        }
      }
      if (E > 0)
      {
        if (W==0)
        {
          flag = false;
        }
      }
      if (W > 0)
      {
        if (E == 0)
        {
          flag = false;
        }
      }
      
      if (flag)
      {
        Console.WriteLine("Yes");
      }
      else
      {
        Console.WriteLine("No");
      }
        
    }


    public Solve()
    {
      Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });
      main();
      Console.Out.Flush();
    }
  }

  class Program
  {
    static void Main(string[] args)
    {
      new Solve();
    }
  }

}

Measured memory_bytes: 2776
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define rep2(i, s, n) for (ll i = s; i < (ll)(n); i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define fi first
#define sc second
#define pb push_back
#define COUT(x) cout << (x) << "\n"
#define COUTF(x) cout << setprecision(15) << (x) << "\n"
#define ENDL cout << "\n"
#define DF(x) x.erase(x.begin())  // 先頭文字削除
#define ALL(x) x.begin(), x.end()
#define SZ(x) (ll) x.size()
#define SORT(x) sort(ALL(x))
#define REVERSE(x) reverse(ALL(x))
#define MAX(x, y, z) max(x, max(y, z))
#define MIN(x, y, z) min(x, min(y, z))
#define ANS cout << ans << "\n"
#define RETURN(x)    \
  cout << x << "\n"; \
  return 0
clock_t CLOCK;
#define START_TIMER CLOCK = clock()
#define SHOW_TIMER cerr << "time: " << (ld)(clock() - CLOCK) / 1000000 << "\n"
#define init() \
  cin.tie(0);  \
  ios::sync_with_stdio(false)
#define LINE cerr << "[debug] line: " << __LINE__ << "\n";
#define debug(x) cerr << "[debug] " << #x << ": " << x << "\n";
#define debugV(v)                       \
  cerr << "[debugV] " << #v << ":";     \
  rep(i, v.size()) cerr << " " << v[i]; \
  cerr << "\n";
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using mll = map<ll, ll>;
using qll = queue<ll>;
using P = pair<ll, ll>;

constexpr ll INF = 0x3f3f3f3f3f3f3f3f;
constexpr ld PI = 3.141592653589793238462643383279;
ll get_digit(ll x) {
  return to_string(x).size();
}

ll gcd(ll x, ll y) {
  return y ? gcd(y, x % y) : x;
}

ll lcm(ll a, ll b) {
  return a / gcd(a, b) * b;
}

vector<P> factorize(ll n) {
  vector<P> result;
  for (ll i = 2; i * i <= n; ++i) {
    if (n % i == 0) {
      result.pb({i, 0});
      while (n % i == 0) {
        n /= i;
        result.back().second++;
      }
    }
  }
  if (n != 1) {
    result.pb({n, 1});
  }
  return result;
}

vll divisor(ll n) {
  vll ret;
  for (ll i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      ret.push_back(i);
      if (i * i != n) ret.push_back(n / i);
    }
  }
  SORT(ret);
  return (ret);
}

signed main() {
  init();
  string N;
  cin >> N;
  string S = N;
  REVERSE(N);
  if (S == N) {
    COUT("Yes");
  } else {
    COUT("No");
  }
  return 0;
}

Measured memory_bytes: 3668
#include <bits/stdc++.h> 
using namespace std;
using ll = long long;
template<typename T> using v2 = vector<vector<T>>;
template<typename T> inline v2<T> fill(int r, int c, const T& t){ return v2<T>(r, vector<T>(c, t)); }
#define F first
#define S second

void solve(){
    string s;
    cin >> s;
    if(s[(int)s.length()-1]=='s'){
        s += "es";
    }
    else{
        s += "s";
    }

    cout << s << "\n";
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
    return 0;
}

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

//repetition
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)

//container util
#define all(x) (x).begin(),(x).end()

//typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;

//const value
//const ll MOD = 1e9 + 7;
const int INF = 1e9;
//const int dx[] = {0,1,0,-1};//{0,0,1,1,1,-1,-1,-1};
//const int dy[] = {1,0,-1,0};//{1,-1,0,1,-1,0,1,-1};

//conversion
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
inline ll toLL(string s) {ll v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
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 (a > b) { a = b; return 1; } return 0; }

int dp[1<<18][51];

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n; cin >> n;
  int card[2][n];
  rep(i,n) cin >> card[0][i];
  rep(i,n) cin >> card[1][i];

  // dp tanle init
  rep(i,1<<n) rep(j,51) dp[i][j] = INF;
  dp[0][0] = 0;

  // solve
  rep(state,(1<<n)-1){
    int nextIdx = __builtin_popcount(state);
    rep(maxNum,51) {
      int mvCost = 0;
      rep(i,n){ // iを挿入可能か?
        if( ((state>>i) & 1) ) continue;
        
        int cardFlag = abs(nextIdx - i)%2;
        if(card[cardFlag][i] >= maxNum ){ // 設置できる
          chmin(dp[state | (1<<i)][card[cardFlag][i]], dp[state][maxNum] + mvCost);
        }
        mvCost++;
      }
    }
  }

  int ans = INF;
  rep(i,51) chmin(ans,dp[(1<<n)-1][i]);

  if(ans == INF)  cout << -1 << endl;
  else            cout << ans << endl;

  return 0;
}


Measured memory_bytes: 52608
def main() :
    N,A,B = map(int,input().split())

    span_len = A+B
    # span中に何回繰り返しがあるか
    span_count = N // span_len

    span_remain = N % span_len
    # print(span_count, span_remain)
    if (span_remain == 0) :
        ans = span_count * A
        print(ans)
    elif (span_remain < A) :
        ans = span_count * A + span_remain
        print(ans)
    else :
        ans = span_count * A + A
        print(ans)


main()

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

int main(void){
  int a[7] = {1, 3, 5, 7, 8, 10, 12};
  int b[4] = {4, 6, 9, 11};
  int c[1] = {2};
  int x, y;
  bool ans = true;
  cin >> x >> y;
  for(int i = 0; i < 7; i++){
    for(int j = 0; j < 4; j++){
      for(int l = 0; l < 1; l++){
	if((a[i] == x && b[j] == y) || (a[i] == y && b[j] == x) || (a[i] == x && c[l] == y) || (a[i] == y && c[l] == x) || (b[j] == x && c[l] == y) || (b[j] == y && c[l] == x)){
	  ans = false;
	  break;
	} 
      }
    }
  }
  if(ans) cout << "Yes" << "\n";
  else cout << "No" << "\n";
  return 0;
}


Measured memory_bytes: 3612
# -*- coding: utf-8 -*-
from sys import stdin
from operator import itemgetter
import math
# stdin = open("sample.txt")

s = stdin.readline().rstrip()

v = [s[i] for i in range(0, len(s))]

g = v.count('g')
p = v.count('p')

print((g-p)//2)

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

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = std::int64_t;
using P = std::tuple<int,int>;

int N, M;
int A[110];

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

  std::cin >> N >> M;

  for(int i=0;i<N;++i){
      std::cin >> A[i];
  }

  int S = std::accumulate(A, A + N, 0);

  int n = 0;

  for(int i=0;i<N;++i){
      if(4 * M * A[i] >= S){
          n += 1;
      }
  }

  if(n >= M){
      std::cout << "Yes" << std::endl;
  }else{
      std::cout << "No" << std::endl;
  }
}


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

#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define REP(i,n) FOR(i,0,n)
using ll = long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vvvi = vector<vector<vector<int>>>;
using mii = map<int, int>;
using msi = map<string, int>;
using pii = pair<int, int>;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << std::fixed << std::setprecision(10);
    
    int a, b; cin >> a >> b;
    cout << a * b << " " << (a + b) * 2 << endl;
    

    return 0;
}


Measured memory_bytes: 3112
#include <bits/stdc++.h>
using namespace std;
#define mem(a,n) memset(a,n,sizeof(a))
#define rep(i,a,n) for(int i=a;i<n;i++)
#define pb push_back
typedef long long ll;
const int INF=0x3f3f3f3f;
const double PI=3.1415926;
const int MOD=1e9+7;
const double eps=1e-8;
const int N=1e3;
int main()
{
    int sx=0,sy=0;
    int T,st=0,t;
    cin>>T;
    bool flag=0;
    while(T--)
    {
        int x,y;
        cin>>t>>x>>y;
        int dis=abs(x-sx)+abs(y-sy);
        int d=t-st;
        if(dis<=d)
        {
            int tmp=d-dis;
           // printf("tmp=%d\n",tmp);
            if(tmp%2)
            {
                puts("No");
                flag=1;
                break;
            }
        }
        if(dis>d)
        {
            flag=1;
            puts("No");
            break;
        }
        st=t,sx=x,sy=y;
    }
    if(!flag) puts("Yes");
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;

#define ALL(x) (x).begin(), (x).end()
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)

//////////////////////////////////////
#include <iostream>
using namespace std;
#define dp(arg) do { cout << #arg << ":"; dprint(arg); } while(0)

template <typename T> void dprint(T arg) { cout << arg << "\n"; }
template <typename T> void dprint(const vector<T>& arg) { for_each(begin(arg), end(arg), [](T value){ cout << value << " "; }   ); cout << "\n";  }
template <typename T> void dprint(const vector<vector<T>>& arg) { for_each(begin(arg), end(arg), [=](vector<T> arg2){ dprint(arg2); cout << "\n";} );  }

// #define dprint(arg) ;
//////////////////////////////////////

lint subfunc(lint n, std::vector<long long> a, bool isPlus){
    lint b[n]; // 結果を示す
    lint total = 0LL; // ここまでのa[i]の和
    lint resCount = 0LL; // 置き換えた数
    memset(b, 0, sizeof b);

    REP(i, n){
        total += a[i];
        b[i] = a[i];
        if (isPlus && total < 1) { // plusであるべきなのに，マイナスなら
            resCount += (-total) + 1;
            b[i] += (-total) + 1;
            total = 1;
        }
        else if(!isPlus && total > -1){
            resCount += (total) + 1;
            b[i] += (total) + 1;
            total = -1;
        }
        isPlus = !isPlus;
    }

    //cout << "res:"; REP(i, n) cout << " " << b[i]; cout << "\n";
    //cout << "cost:" <<resCount << "\n";
    return resCount;
}

int main(){

    long long n;
    lint res1, res2;
    scanf("%lld",&n);
    std::vector<long long> a(n);
    for(int i = 0 ; i < n ; i++){
        scanf("%lld",&a[i]);
    }
    // この渡し方はaのcopyが走るのでうれしくない
    res1 = subfunc(n, a, true);  // pat1: プラス始まり
    res2 = subfunc(n, a, false); // pat2: マイナス始まり
    cout << min(res1, res2) << "\n";
    return 0;
}



Measured memory_bytes: 2672
#include <stdio.h>
    #define TRUE 1
    #define FALSE 0

    struct Card{
      char suit, value;
    };

    void bubble(struct Card A[], int N){
      int i,j;
      struct Card tmp;
      for(i = 0; i < N; i++){
        for(j = N-1; j >= i+1; j--){
          if(A[j].value < A[j-1].value){
            tmp = A[j];
            A[j] = A[j-1];
            A[j-1] = tmp;
          }
        }
      }
    }

    void selection(struct Card A[], int N){
      int i,j;
      int min;
      for(i = 0; i < N; i++){
        min = i;
        for(j = i; j < N; j++){
          if(A[j].value < A[min].value)
            min = j;
        }
        struct Card tmp = A[i];
        A[i] = A[min];
          A[min] = tmp;
      }
    }

    void print(struct Card A[], int N){
      int i;

      for(i = 0; i < N; i++){
        if(i > 0)
          printf(" ");
        printf("%c%c",A[i].suit,A[i].value);
      }

      printf("\n");
    }

    int isStable(struct Card C1[],struct Card C2[], int N){
      int i;

      for(i = 0; i < N; i++){
        if(C1[i].suit != C2[i].suit)
          return FALSE;
      }

      return TRUE;
    }

    int main(){

      int i,n;

      struct Card C1[100], C2[100];


      scanf("%d",&n);

      for(i = 0; i < n; i++){
        scanf("%1s%1s",&C1[i].suit,&C1[i].value);
      }

      for(i = 0; i < n; i++)
        C2[i] = C1[i];

      bubble(C1,n);

      selection(C2, n);

      print(C1, n);

      printf("Stable\n");

      print(C2,n);

      if(isStable(C1,C2,n) == TRUE){
        printf("Stable\n");
      }

      else
        printf("Not stable\n");

      return 0;
    }



Measured memory_bytes: 2096
using System;
class Example
{
    static void Main()
    {
        int temp;
        string t = Console.ReadLine();
        string p = Console.ReadLine();
        int tlength = t.Length;
        int plength = p.Length;
        if (tlength >= plength)
        {
            temp = t.IndexOf(p);
            if (temp != -1)
                Console.WriteLine(temp);
            for (; temp + plength < tlength;)
            {
                temp = t.IndexOf(p, temp + 1);
                if (temp <= 0) break;
                Console.WriteLine(temp);
            }
        }
    }
}

Measured memory_bytes: 9752
n, m = map(int, input().split())
km = [0]*m
sm = [0]*m
for i in range(m):
    inp = input().split()
    km[i] = int(inp[0])
    sm[i] = list(map(int, inp[1:]))
    
pm = list(map(int, input().split()))

cnt = 0
for i in range(2**n):
    m_state = [0]*m
    for j in range(n):
        if (i>>j)&1:
            for k in range(m):
                if j+1 in sm[k]:
                    m_state[k]+=1
    all_flg = 1
    for x in range(m):
        if m_state[x]%2!=pm[x]:
            all_flg = 0
            break
    if all_flg:
        cnt +=1

print(cnt)
        

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

int main() {
  int A, B, k;
  string op;
  cin >> A >> B;

  k= A * B;
  if (k%2 == 1) {
    cout << "Odd" << endl;
  }
  else {
    cout << "Even" << endl;
  }
}

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

int main(){
	string SS;
	string T;
	cin>>SS>>T;
	vector<string>arr;
	if(SS.length()>=T.length()){
		for(int i=0;i<=SS.length()-T.length();++i){
			bool get=true;
			for(int j=0;j<T.length();++j){
				if(SS[i+j]!=T[j] && SS[i+j]!='?'){
					get=false;
					break;
				}
			}
			if(get==true){
				string SSS=SS;
				for(int j=0;j<SSS.length();++j){
					if(i<=j && j-i<T.length()){
						SSS[j]=T[j-i];
					}
					else if(SSS[j]=='?')SSS[j]='a';
				}
				arr.push_back(SSS);
			}
		}
		sort(arr.begin(),arr.end());
	}
	/*
	for(int i=0;i<arr.size();++i){
		cout<<arr[i]<<endl;
	}
	*/
	if(arr.size()==0)cout<<"UNRESTORABLE"<<endl;
	else cout<<arr[0]<<endl;
}


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include<cmath>
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
vector<int> arr;
stack<int> st;
queue<int> qu;
queue<pair<int,int> > qu2;
priority_queue<int> pq;
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define rep2(i,n) for(int i=1; i<=(int)(n); i++)
typedef set<int> set_t;
typedef set<string> set_g;
typedef complex<double> xy_t;
static const int NIL = -1;

int P[10010];
void init(int n){
    for(int i=0;i<n;++i)P[i]=i;
}
int root(int a) {
    if(P[a]==a)return a;
    return (P[a]=root(P[a]));
}
bool is_same_set(int a,int b){
    return root(a) == root(b);//代表元を求める
}
void unite(int a,int b){
    P[root(a)]=root(b);
}//対set,グラフ？

double dot_product(xy_t a, xy_t b) { return (conj(a)*b).real(); }//内積
double cross_product(xy_t a, xy_t b) { return (conj(a)*b).imag(); }//外積
xy_t projection(xy_t p, xy_t b) { return b*dot_product(p,b)/norm(b); }//投影
//対図形

int main(){
    int n;
    cin >>n;
    int d[n];
    rep(i,n){
        cin >> d[i];
    }
    sort(d,d+n);
    int a=d[n/2-1],b=d[n/2];
    cout<<b-a<<endl;
    return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <math.h>
#include <algorithm>
#include <map>
using namespace std;

int main() {
	int N, M, X, *A, key;

	cin >> N >> M >> X;
	A = new int[N];

	for (int i = 0; i < N; i++) {
		cin >> A[i];
		if (A[i] > X) {
			if (M - i >= i) { cout << i; }
			else { cout << M - i; }
			break;
		}
	}

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,m,n) for(int i=m;i<n;i++)
#define fix(n) cout<<fixed<<setprecision(n)
#define co(n) cout<<n<<endl
#define all(n) (n).begin(),(n).end()
using namespace std;
typedef long long ll;
const ll mod=1000000007;
double pi=3.1415926535;

int main(){
  int x,y,a,b,c;
  cin>>x>>y>>a>>b>>c;
  int aa[a],bb[b],cc[c],ax[x],ay[y];
  rep(i,0,a) cin>>aa[i];
  rep(i,0,b) cin>>bb[i];
  rep(i,0,c) cin>>cc[i];
  
  sort(bb,bb+b); reverse(bb,bb+b);
  sort(aa,aa+a); reverse(aa,aa+a);
  sort(cc,cc+c); reverse(cc,cc+c);
  
  rep(i,0,x) ax[i]=aa[i];
  rep(i,0,y) ay[i]=bb[i];
  
  pair<int,int> p[x+y];
  rep(i,0,x){
    p[i].first=ax[i];
    p[i].second=0;
  }
  rep(i,0,y){
    p[i+x].first=ay[i];
    p[i+x].second=1;
  }
  sort(p,p+x+y);
  rep(i,0,c){
    if(cc[i]>p[i].first) p[i].first=cc[i];
    else break;
  }
  ll ans=0;
  rep(i,0,x+y) ans+=p[i].first;
  co(ans);
  
  
  return 0;
}


Measured memory_bytes: 3584
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll mod2 = 998244353;

int gcd(int a,int b) {
  if (a < b) swap(a, b);
  if (a % b == 0) return b;
  return gcd(b, a%b);
}

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i, n) cin >> a[i];
  rep(i, n-1) {
    a[i+1] = gcd(a[i], a[i+1]);
  }
  cout << a[n-1] << endl;
}

Measured memory_bytes: 640
from fractions import gcd
T=int(input())
for i in range(T):
  A,B,C,D=map(int,input().split())
  if B<=A and B<=D:
    if B<=C:
      print("Yes")
    else:
      G=gcd(B,D)
      a=A%G
      t=(C-a)//G+1
      if B>t*G+a:
        print("No")
      else:
        print("Yes")
  else:
    print("No")

  

Measured memory_bytes: 64252
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define M 1000000007
typedef long long ll;
int main() { 
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    ll t,a[1000000],n,i,c=0,s=0,m=10000000000000007;
    cin>>n;
    for(i=0;i<n;i++){
        cin>>a[i];
        s+=a[i];
    }
    for(i=0;i<n;i++){
        c+=a[i];
        m=min(abs(2*c-s),m);
    }
    cout<<m;
    return 0;
}

Measured memory_bytes: 3712
//============================================================================
// Name        : HelloWorld.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <math.h>
#include <stdio.h>
#include <vector>
typedef long long ll;
using namespace std;
int N;
int W[101];
int S2=0;
int S1=0;
ll R=10000000000000;
int main() {
	cin>>N;
	for(int i=0;i<N;i++){
		cin>>W[i];
		S2+=W[i];
	}

	for(int i=0;i<N;i++){
		S1+=W[i];
		S2-=W[i];

	    if(R>abs(S2-S1)){
	    	R=abs(S2-S1);
	    }

	}

	cout<<R<<endl;
	return 0;
}


Measured memory_bytes: 256
using System;

class Program
    {
        static void Main(string[] args)
        {
            //まずは数字を読む
            string[] input = Console.ReadLine().Split(' ');
            int n = int.Parse(input[0]);
            int k = int.Parse(input[1]);

            //文字列を読む
            string s = Console.ReadLine();
            

            //小文字に置き換える文字を作る
            string s2 = s.ToLower();

            //書き換える文字を読み込む
            char small = s2[k-1];


            //文字を置きかえる
            for (int i = 0; i < n; i++)
            {

                if (i == k - 1)
                    Console.Write(small);
                else
                    Console.Write(s[i]);
            }

        }


    }

Measured memory_bytes: 11092
/*  
     author : masaow    
     g++ : 17.3.20  
*/        
#include <bits/stdc++.h>  
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#define forn(i,a,b)        for( i = a ; i < b  ; i++ )
#define debug(x)           cout << #x << " " << x << " -- \n  "
#define I__O               ios::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define ll                 long long  
#define p(x)               cout << x << "\n" ; 
#define MOD                100000007
#define pi                 pair<int,int>
#define vi                 vector <int>
#define pb                 push_back
#define vp                 vector <pair<ll,ll>>
#define endl               cout << "\n"
#define mi                 map <int,int> 
#define f1                 first 
#define s1                 second    
#define in                 insert
#define all(x)             x.begin(),x.end() 
using namespace std ; 
using namespace __gnu_pbds;
typedef tree<int,null_type,less<int>,rb_tree_tag,
tree_order_statistics_node_update> indexed_set ; 
const int N = 2e5+7;  
/*  
    time : 10 : 14    
    date : 24.01.2020
*/    

// int L,R,mid,target,idx ;
int tests(){
  int a,b ; 
  cin >> a >> b ; 
  cout << (a+b-1)/b <<  '\n' ; 
  return 0 ; 
}
int main(){
    I__O ;  
    int cases = 1 ; 
    // cin >> cases;  
    while(cases--)
      tests(); 
  return 0 ; 
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int main(void)
{
	int i;
	char o[51],e[51];
	scanf("%s %s", o, e);
	for(i=0; i<strlen(o); i++)
	{
		printf("%c", o[i]);
		if(i<strlen(e))
		printf("%c", e[i]);
	}
	printf("\n");
	
	return 0;
}

Measured memory_bytes: 128
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while (true) {
			int t = sc.nextInt();
			int n = sc.nextInt();
			if ((t | n) == 0)
				break;
			String nstr = Integer.toString(n);
			int len = nstr.length() - 1;
			int max = 0;
			boolean rejected = false;
			List<String> result = new ArrayList<String>(0);
			for (int i = 0; i < (1 << len); i++) {
				List<String> list = new ArrayList<String>(0);
				int shred = 0;
				for (int j = 0; j < len; j++)
					if ((i & (1 << j)) != 0) {
						list.add(nstr.substring(shred, j + 1));
						shred = j + 1;
					}
				list.add(nstr.substring(shred));
				int sum = 0;
				for (String s : list)
					sum += Integer.parseInt(s);
				if (sum <= t) {
					if (sum > max) {
						max = sum;
						result = list;
						rejected = false;
					} else if (sum == max)
						rejected = true;
				}
			}
			if (rejected)
				System.out.println("rejected");
			else if (max == 0)
				System.out.println("error");
			else {
				System.out.print(max);
				for (String s : result)
					System.out.print(" " + s);
				System.out.println();
			}
		}
		sc.close();
	}
}

Measured memory_bytes: 21164
# include <iostream>
# include <algorithm>
#include <array>
# include <cassert>
#include <cctype>
#include <climits>
#include <numeric>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <tuple>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
# include <chrono>
# include <random>
# include <limits.h>
# include <unordered_map>
# include <unordered_set>
# include <deque>
# include <cstdio>
# include <cstring>
#include <stdio.h>
#include<time.h>
#include <stdlib.h>
#include <cstdint>
#include <cfenv>
#include<fstream>
//#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
long long MOD = 1000000000 + 7;// ;//1000000000 + 7 998244353 924844033 1000000000 + 9;
constexpr long long INF = numeric_limits<LL>::max()/100;
constexpr long long DINF = 1000000000000;
const double PI = acos(-1);
#define fir first
#define sec second
#define thi third
#define debug(x) cerr<<#x<<": "<<x<<'\n'
typedef pair<LL, LL> Pll;
typedef pair<double, double> Dll;
typedef pair<LL, pair<LL, LL>> Ppll;
typedef pair<LL, pair<LL, bitset<100001>>> Pbll;
typedef pair<LL, pair<LL, vector<LL>>> Pvll;
typedef pair<LL, LL> Vec2;
struct Tll { LL first, second, third; };
struct Fll { LL first, second, third, fourth; };
typedef pair<LL, Tll> Ptll;
#define rep(i,rept) for(LL i=0;i<rept;i++)
#define Rrep(i,mf) for(LL i=mf-1;i>=0;i--)
void YN(bool f) {
	if (f)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
}
void yn(bool f) {
	if (f)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}
struct Edge { LL to, cost; };
struct edge {
	LL from, to, cost;
};
vector<vector<LL>>g;
vector<edge>ed;
vector<Pll>pv;
map<LL, LL>ma;
set<LL>st;
vector<LL>rest;
int di[4][2] = { { 0,1 },{ 1,0 },{ 0,-1 },{ -1,0 } };
LL n, m, k, p, q, w, h, s, t, ans, cnt, sum, a[100][100], b[310000];
string str;
bool f;
char c[1100][1100];
int main() {
	cin >> n>>m;
	rep(i, n) {
		rep(j, m) {
			cin >> a[i][j];
		}
	}
	for (int i = 0; i < n; i++) {
		for (int j = i + 1; j < n; j++) {
			sum = 0;
			rep(k, m) {
				sum += (a[i][k] - a[j][k])*(a[i][k] - a[j][k]);
			}
			LL cur = sqrt(sum);
			if (cur*cur== sum)
				ans++;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

int main() {
    ios_base::sync_with_stdio(false); cin.tie(nullptr);    
    int k;
    cin >> k;
    long long a, b, c, ans = 0, tmp;
    for (a = 1; a <= k; ++a) {
        b = 0;
        while (b++ < k) {
            c = 0; 
            while(c++ < k) {
                tmp = __gcd(b, c);
                ans += __gcd(tmp, a);
            }
        }        
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 3648
#pragma gcc optimize("Ofast")
#include <bits/stdc++.h>
#define ff first
#define ss second
using namespace std;
using ll = long long; using ld = long double;
using pii = pair<int,int>; using pil = pair<int,ll>;
using pli = pair<ll,int>; using pll = pair<ll,ll>;
const int MOD = 1000000007, MOD2 = 998244353;
const int INF = 0x3f3f3f3f, INF2 = 0x3f3f3f37;
const ll LINF = 0x3f3f3f3f3f3f3f3f, LINF2 = 0x3f3f3f3f3f3f3f3d;



int main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int n; cin >> n;
    map<int, int> m;
    for (int i = 0; i < n; ++i) {
        int a; cin >> a;
        if (m[a]) return cout << "NO\n", 0;
        ++m[a];
    }
    cout << "YES\n";
}

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

using namespace std;
const double eps=1e-8;
const double g=9.8;
const int NUM=60;
int L[NUM],B[NUM],R[NUM],T[NUM];
int n,v,x,y;
/////////////////////////////////////////////
int cmp(double l,double r,double now);
double cal(double vy,double t);
bool check(double qx,double qy);
/////////////////////////////////////////////

int main()
{
    scanf("%d %d %d %d",&n,&v,&x,&y);
    for (int i=0; i<n; i++)
    {
        scanf("%d %d %d %d",&L[i],&B[i],&R[i],&T[i]);
        R[i]=min(R[i],x);
    }
    bool ans=check(x,y);
    for (int i=0; i<n; i++)
    {
        ans|=check(L[i],T[i]);
        ans|=check(R[i],T[i]);
    }
    if (ans)
        printf("Yes\n");
    else
        printf("No\n");
    return 0;
}
int cmp(double l,double r,double now)
{
    return (now<l+eps)?-1:(now>r-eps)?1:0;
}
double cal(double vy,double t)
{
    return vy*t-g*t*t/2;
}
bool check(double qx,double qy)
{
    double a=g*g/4;
    double b=g*qy-v*v;
    double c=qx*qx+qy*qy;
    double d=b*b-4*a*c;
    if (d<0&&d+eps>0)//=
        d=0;
    else if (d<0)
        return false;
    for (int i=-1; i<=1; i+=2)
    {
        double t=(-b+i*sqrt(d))/(2*a);
        if (t-eps<0) continue;
        t=sqrt(t);
        double vy=(qy+g*t*t/2)/t;
        double vx=qx/t;
        double yt=cal(vy,x/vx);//能不能经过猪的上方
        if (eps<y-yt) continue;
        bool ok=true;
        for (int j=0; j<n&&ok; j++)
        {
            if (L[j]>=x)
                continue;
            if (R[j]==x&&y<=T[j]&&B[j]<=yt)
                ok=false;
            int yl=cmp(B[j],T[j],cal(vy,L[j]/vx));
            int yr=cmp(B[j],T[j],cal(vy,R[j]/vx));
            int xh=cmp(L[i],R[i],vx*(vy/g));
            int yh=cmp(B[i],T[i],cal(vy,vy/g));
            if (xh==0&&yh>=0&&yl<0) ok=false;
            if (yl*yr<=0)
                ok=false;
        }
        if (ok)
            return true;
    }
    return false;
}



Measured memory_bytes: 3164
#include<iostream>
#include<cmath>
#include<string>
#include<algorithm>
#include <iomanip>
#include<sstream>
using namespace std;
int main()
{
    string s, t, u;
    int a, b;
    while (cin >> s >> t)
    {
        cin >> a >> b;
        cin >> u;
        if (u == s)
            a--;
        if (u == t)
            b--;
        cout << a << " " << b << '\n';
    }
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){

    char S[10000];
    int N;

    scanf("%d", &N);
    scanf("%s", S);

    int i = 0;
    while(S[i] != 0){

        for (int j = 0; j < N; j++){
            
            if(S[i] == 0x5a){
                S[i] = 0x41;
            }else if(S[i] == 0x7a){
                S[i] += 0x61;
            }else{
                S[i] += 1;
            }
        }

        i++;
    }

    printf("%s", S);

    return 0;
}

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

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>  // Including tree_order_statistics_node_update

using namespace __gnu_pbds;
using namespace std;

#define sz(a) int((a).size())
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(), (c).end()
#define tr(c, i) for (__typeof((c).begin()) i = (c).begin(); i != (c).end(); i++)
#define present(c, x) ((c).find(x) != (c).end())
#define cpresent(c, x) (find(all(c), x) != (c).end())
#define minei(x) min_element(x.begin(), x.end()) - (x).begin()
#define maxei(x) max_element(x.begin(), x.end()) - (x).begin()
#define LSOne(S) (S & (-S))

#define uns(v) sort((v).begin(), (v).end()), v.erase(unique(v.begin(), v.end()), v.end())
#define acusum(x) accumulate(x.begin(), x.end(), 0)
#define acumul(x) accumulate(x.begin(), x.end(), 1, multiplies<int>());
#define bits(x) __builtin_popcount(x)
#define oo INT_MAX
#define inf 1000000000
#define MAXN 1000007
#define MOD 1000000007

const double pi = acos(-1.0);
const double eps = 1e-11;

typedef long long ll;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
bool isPalind(string s) {
    string rev = s;
    reverse(all(rev));
    return rev == s;
}
bool isStrongPalind(string s) {
    int n = sz(s);
    return isPalind(s) && isPalind(s.substr(0, n / 2)) && isPalind(s.substr((n + 3) / 2 - 1));
}
int main() {
    std::ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    string s;
    cin >> s;
    cout << (isStrongPalind(s) ? "Yes\n" : "No\n");

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <time.h>
#include <math.h>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <iterator>
#include <sstream>
#include <string>
#include <bitset>
using namespace std;
#define FOR(I,F,N) for(int I = F; I < (int)(N); I++)
#define rep(i, n) FOR(i, 0, n)
#define FIN(V) cout<<V<<endl
#define pb push_back
#define INF (1 << 28)

template<typename T>
void remove(vector<T>& vector, unsigned int index){
vector.erase(vector.begin() + index);
}

typedef pair<int, int> P;
typedef long long ll;
typedef priority_queue<int> pq;
int StrToInt(string);
string IntToStr(int);
int dx[4] = {1, -1, 0, 0};
int dy[4] = {0, 0, 1, -1};

map<string, vector<int> > list;
vector<string> names;
map<string, bool> check;

int main(void){
	string S;
	int n;
	while(cin >> S >> n){
		list[S].push_back(n);
		names.pb(S);
	}
	sort(names.begin(), names.end());
	rep(i, names.size()){
		S = names[i];
		if(check[S])continue;
		sort(list[S].begin(), list[S].end());
		cout << S << endl;
		rep(i, list[S].size()){
			if(i != 0)cout << " ";
			cout << list[S][i];
		}
		check[S] = true;
		cout << endl;
	}
	

	return 0;
}



int StrToInt(string s){
	stringstream ss;
	ss << s;
	int val;
	ss >> val;
	return val;
}
string IntToStr(int i){
	stringstream ss;
	ss << i;
	return ss.str();
}

Measured memory_bytes: 1260
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <cmath>
using namespace std;
typedef long long ll;
long long  a[2100],b[2100];
int main ()
{
    int T;
    scanf("%d",&T);
    while(T--)
    {
        long long a,b;
        scanf("%lld%lld",&a,&b);
        long long mid=(long long)sqrt(a*b);
        long long x=min(a,b);
        long long y=max(a,b);
        long long sum = (x-1)*2;
        if(a==b)
            ;
        else if(x==mid)
            sum+=y-1-x;
        else if(mid*mid==a*b)
        {
            sum+=min(y-mid,mid-x)*2-1;
        }
        else if(mid-x<y-mid)
        {
            if((mid+1)*mid<a*b)
            {
                sum=sum+(mid-x)*2+1;
            }
            else
                sum+=(2*(mid-x));
        }
        else
            sum+=min(y-mid,mid-x)*2+1;
//       if(mid==x)
//            sum--;
//       else
//        if(mid*mid==a*b)
//            sum--;
        printf("%lld\n",sum);
    }
    return 0;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
	"math"
)

func main() {
	var N int
	fmt.Scanf("%d", &N)
	B := make([]int, N-1)
	for i := 0; i < N-1; i++ {
		fmt.Scanf("%d", &B[i])
	}

	ans := B[0] + B[N-2]
	for i:=0; i < N-2; i++ {
		ans += int(math.Min(float64(B[i]), float64(B[i+1])))
	}
	fmt.Println(ans)
}


Measured memory_bytes: 512
#include<stdio.h>

int main(){
  int n;
  int d[128];
  int re=0;

  scanf("%d",&n);
  for(int i=0;i<n;i++){
    scanf("%d",&d[i]);
  }
  for(int i=0;i<n;i++){
    for(int j=i+1;j<n;j++){
        re+=d[i]*d[j];
    }
  }
  printf("%d",re);

  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef set<int> si;
typedef set<ll> sl;
typedef pair<int,int> pii;
#define rep(i,a,b) for(int i=(a); i<(b); ++i)
#define per(i,a,b) for(int i=(b)-1; i>=(a); --i)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define F first
#define S second

int main(void) {
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	//freopen("in.txt", "r", stdin);
	int x;
	cin >> x;
	int p = x / 100;
	int q = x % 100;
	if(p*5 >= q) {
		cout << 1 << endl;
	} else {
		cout << 0 << endl;
	}
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

class Main
{
	public static void main(String args[])
	{
		Scanner sc = new Scanner(System.in).useDelimiter("[.]*");
		int buffer = 1;
		while (sc.hasNext())
		{
			String str = sc.next();
			if (str.equals("@"))
			{
				buffer = sc.nextInt();
			}
			else
			{
				for (int i = 0; i < buffer; i++)
				{
					System.out.print(str);
				}
				buffer = 1;
			}
		}
	}
}

Measured memory_bytes: 12000
from fractions import gcd
from functools import reduce


def lcm(a, b):
    return a * b // gcd(a, b)


def solve(string):
    n, m, *a = map(int, string.split())
    l = reduce(lcm, a)
    c = 1
    while a[0] % (2 * c) == 0:
        c *= 2
    a = [_a // c if _a % c == 0 else 0 for _a in a]
    for _a in a:
        if not _a or _a % 2 != a[0] % 2:
            return "0"
    return str(max((m - l // 2) // l + 1, 0))


if __name__ == '__main__':
    import sys
    print(solve(sys.stdin.read().strip()))


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

struct Date
{
    Date(int y, int m, int d) : year(y), month(m), day(d) {}
    int year, month, day;
    
    bool operator< (const Date& rhs) const
    {
         return year == rhs.year ? month == rhs.month ? day < rhs.day : month < rhs.month : year < rhs.year;
    }
    
    bool operator<= (const Date& rhs) const
    {
        return *this < rhs || year == rhs.year && month == rhs.month && day == rhs.day; 
    }
};

int main()
{
    int year, month, day;
    const Date meiji(1868,9,8), taisho(1912,7,30), showa(1926,12,25), heisei(1989,1,8);
    while(cin >> year >> month >> day){
        Date date(year, month, day);
        if(date < meiji){
            cout << "pre-meiji" << endl;
        } else if(meiji <= date && date < taisho){
            cout << "meiji" << ' ' << year - meiji.year + 1 << ' ' << month << ' ' << day << endl;  
        } else if(taisho <= date && date < showa){
            cout << "taisho" << ' ' << year - taisho.year + 1 << ' ' << month << ' ' << day << endl; 
        } else if(showa <= date && date < heisei){
            cout << "showa" << ' ' << year - showa.year + 1 << ' ' << month << ' ' << day << endl; 
        } else {
            cout << "heisei" << ' ' << year - heisei.year + 1 << ' ' << month << ' ' << day << endl; 
        }
    }
}

Measured memory_bytes: 1168
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#define For(i, n) for(int i = 0; i < (n); i ++)
#define Range(c) c.begin(), c.end()
#define RevRange(c) c.rbegin(), c.rend()
#define Cin(T, x) T x; cin >> x
#define Cins(T, n, xs) vector<T> xs(n); For(i, n) cin >> xs[i]
#define Cins2(T, n, xs, ys) vector<T> xs(n), ys(n); For(i, n) cin >> xs[i] >> ys[i]
#define Cins3(T, n, xs, ys, zs) vector<T> xs(n), ys(n), zs(n); For(i, n) cin >> xs[i] >> ys[i] >> zs[i]
#define Cout(x) cout << (x) << "\n"
#define Couts(xs) for(const auto &e : xs) cout << e << " "; cout << "\n"
#define Cusum(T, n, xs, sxs) vector<T> sxs(n+1); For(i, n) sxs[i+1] = sxs[i] + xs[i]
#define Sort(a) sort(Range(a))
#define DeSort(a) sort(RevRange(a))
#define Vec2(T, vs, n, m) vector<vector<T>> vs(n, vector<T>(m))

using namespace std;
using ll = long long;

int main(void){
    Cin(int, n);
    Cin(int, m);
    Cins3(ll, n, x, y, z);
    
    ll ans = 0;
    for(ll tx : {1, -1}) for(ll ty : {1, -1}) for(ll tz : {1, -1}){
        vector<ll> v(n);
        For(i, n) v[i] = tx*x[i] + ty*y[i] + tz*z[i];
        DeSort(v);
        ll a = 0;
        For(i, m) a += v[i];
        ans = max(ans, a);
    }
    Cout(ans);
}


Measured memory_bytes: 256
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#include <chrono> 
using namespace std::chrono;
using namespace std;
typedef long long ll;
using namespace __gnu_pbds;   
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
#define ordered_mset tree<pair<ll,ll>, null_type,less<pair<ll,ll>>, rb_tree_tag,tree_order_statistics_node_update> 
#define fr(i,a,b) for (ll i=(a); i<(b);++i)
#define frr(i,a,b) for(ll i=(a-1);i>=(b);--i)
#define vi vector<int>
#define vl vector<ll>
#define pb push_back
#define ppb pop_back()
#define pf push_front
#define ppf pop_front()
#define F first
#define S second
#define pii pair<ll,ll> 
#define rev(a) reverse(a.begin(),a.end())
#define srt(a) sort(a.begin(),a.end())
#define rsrt(a) sort(a.begin(),a.end(),greater<ll>())
#define sz(a) (ll)a.size()
#define endl "\n"
#define po(a,b) (ll)(pow(a,b)+0.5)
#define double long double
#define print(a) for(auto x:a)cout<<x<<" ";cout<<endl;
#define setbits(a) __builtin_popcount(a)
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
const ll M=1e9+7;
const ll mxx=1e6+5;

int main()
{  
    //   #ifndef ONLINE_JUDGE
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    // #endif
    fast
  
   int n,x,t;
   cin>>n>>x>>t;
   cout<<((n+(x-1))/x)*t;
}

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

int main() {
	int N;
	cin >> N;
	vector<int> A(N);

	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}

	int count = 0;

	while (true) {
		bool flg = false;
		for (int i = 0; i < N; i++) {
			if (A[i] % 2 != 0) {
				flg = true;
				break;
			}
		}
		if (flg) {
			break;
		}
		for (int i = 0; i < N; i++) {
			A[i] /= 2;
		}
		count++;
	}

	cout << count << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
     
int main() {
  int sx, sy, tx, ty;
  cin >> sx >> sy >> tx >> ty;
  for(int i = 0; i < tx - sx; i++){
    cout << "R";
  }
  for(int i = 0; i < ty - sy; i++){
    cout << "U";
  }
  for(int i = 0; i < tx - sx; i++){
    cout << "L";
  }
  for(int i = 0; i < ty - sy + 1; i++){
    cout << "D";
  }
  for(int i = 0; i < tx - sx + 1; i++){
    cout << "R";
  }
  for(int i = 0; i < ty - sy + 1; i++){
    cout << "U";
  }
  cout <<"L";
  cout <<"U";
  for(int i = 0; i < tx - sx + 1; i++){
    cout << "L";
  }
  for(int i = 0; i < ty - sy + 1; i++){
    cout << "D";
  }
  cout << "R" << endl;
  
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<queue>
#include<algorithm>
#include<map>
#include<set>
#include<vector>
#include<math.h>
#include<time.h>

using namespace std;

#define INF 1000000007
#define LINF (1LL << 62)

typedef long long i64;
typedef pair<i64,i64> P;


i64 n,k,sum;
i64 a[101010];

int main(){
	cin >> n >> k >> sum;
	
	for(int i = 0; i < n; i++){
		if(k){
			cout << sum << " ";
			k--;
		}
		else{
			if(sum != INF-7) cout << INF-7 << " ";
			else cout << INF-8 << " ";
		}
	}
	cout << endl;
	
	return 0;
}

Measured memory_bytes: 1280
#include<bits/stdc++.h>
using namespace std;
int main(){string s,t;
int i,n,ok=1;

cin>>s>>t;
n=s.size();
for(i=0;i<n;i++){if(s[i]!=t[i])ok=0;}
if(ok){cout<<"Yes";}
else{cout<<"No";}
    return 0;}

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

int main() {
  int A, B;
  cin >> A >> B;
  
  if( A % 3 == 0 || B % 3 == 0 || (A+B) % 3 == 0 ){
    cout << "Possible" << endl;
  }else{
    cout << "Impossible" << endl;
  }
}



Measured memory_bytes: 256
from functools import reduce
def gcd(a,b):
  while b!=0:
    a,b=b,a%b
  return a


#最小公倍数
def lcm(a,b):
  return b//gcd(a,b) * a


if __name__ == "__main__":
    n = int(input())
    lst = []
    for i in range(n):
        lst.append(int(input()))
    print(reduce(lcm,lst))

Measured memory_bytes: 3700
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_4_D
#include <iostream>
using namespace std;
#define MAX 100000
typedef long long llong;

int n, k;
llong T[MAX];

int check(llong P){
  int i = 0;
  for(int j=0;j<k;j++){
    llong s = 0;
    while(s+T[i] <= P){
      s += T[i];
      i++;
      if(i==n) return n;
    }
  }
  return i;
}

int solve(){
  llong left = 0;
  llong right = 100000 * 10000;
  llong mid;
  while(right-left > 1){
    mid = (right+left)/2;
    int v = check(mid);
    if(v>=n) right = mid;
    else left = mid;
  }
  return right;
}

int main(){
  cin >> n >> k;
  for(int i=0;i<n;i++) cin >> T[i];
  llong ans = solve();
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1944