akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <list>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <tuple>

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i <= (n); i++)
#define show(a, n) rep(i,n) {cout<<a[i]<<' ';} cout<<endl
#define show2(a, n, m) rep(i, n) { rep(j, m) {cout << a[i][j] << ' ';} cout << endl;} 
#define chmin(a, b) a = min(a, b)
#define chmax(a, b) a = max(a, b)

using namespace std;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long long ll;
typedef vector<ll> vll;
typedef pair<long long, long long> pll;
typedef long double ld;

const int INF = 1 << 30;
const long long INFL = 1LL << 60;
const int MOD = 1000000007;
const int MAX = 100000;
const int N = 100010;

bool check(string& s, int l, int r) {
	bool ans = true;
	while(ans && l < r) {
		if(s[l] == s[r]) {
			l++;
			r--;
		}
		else {
			ans = false;
		}
	}
	return ans;
}

int main() {
//	cout << fixed << setprecision(15);
	string s;
	cin >> s;
	int n = s.size();

	bool ans = true;
	ans = check(s, 0, n-1);
	if(ans) ans = check(s, 0, (n-3)/2);
	if(ans) ans = check(s, (n+1)/2, n-1);

	cout << (ans ? "Yes" : "No") << endl;
}


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

#define rep(i,s,n) for (int i = (int)s; i < (int)n; i++)
#define ll long long
#define pb push_back
#define All(x) x.begin(), x.end()
#define Range(x, i, j) x.begin() + i, x.begin() + j
#define lbidx(x, y) lower_bound(x.begin(), x.end(), y) - x.begin()
#define ubidx(x, y) upper_bound(x.begin(), x.end(), y) - x.begin()
#define llbidx(x, y, z) lower_bound(x.begin(), x.end(), z) - lower_bound(x.begin(), x.end(), y) // 二要素間の距離
#define deg2rad(deg) ((((double)deg)/((double)360)*2*M_PI))
#define rad2deg(rad) ((((double)rad)/(double)2/M_PI)*(double)360)
#define Find(set, element) set.find(element) != set.end()

typedef pair<int, int> PI;
typedef pair<ll, ll> PLL;

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;
};

int main() {
  int A, B, X;
  cin >> A >> B >> X;
  if (A <= X && X <= A+B) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
};


Measured memory_bytes: 256
N,M=map(int,input().split())
A=[int(input()) for i in range(M)]

mod=10**9+7
dp=[0]*(N+1)
dp[0]=1

isbroken=[1]*(N+1)
for i in range(M):
    isbroken[A[i]]=0

for i in range(N):
    if i-1>=0:
        dp[i+1]=dp[i]*isbroken[i]+dp[i-1]*isbroken[i-1]
    else:
        dp[i+1]=dp[i]*isbroken[i]
    dp[i+1]%=mod

print(dp[-1])

Measured memory_bytes: 9592
#define _USE_MATH_DEFINES

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <unordered_map> 
#include <unordered_set>
#include <functional>
#include <bitset>

using namespace std;

typedef pair<long long int, long long int> P;
typedef tuple<int, int, int> T;

long long int INF = 1e18;
long long int MOD = 1e9 + 7;

long long int LCM(long long int a, long long int b){
	long long int dummy1, dummy2, dummy;
	dummy1 = max(a, b);
	dummy2 = min(a, b);
	while(true){
		dummy = dummy1 % dummy2;
		dummy1 = dummy2;
		dummy2 = dummy;
		if(dummy == 0){
			break;
		}
	}
	return (a / dummy1) * (b / dummy1) * dummy1;
}

int main(){
	long long int N, M;
	cin >> N >> M;
	set<long long int> s;
	for(int i = 0; i < N; i++){
		long long int a;
		cin >> a;
		s.insert(a);
	}
	int cMax = 0, cMin = 100;
	for(long long int num : s){
		int cnt = 0;
		while(num % 2 == 0){
			num /= 2;
			cnt += 1;
		}
		cMax = max(cnt, cMax);
		cMin = min(cnt, cMin);
	}
	if(cMax != cMin){
		cout << 0 << endl;
		return 0;
	}
	long long int L = 1;
	for(long long int num : s){
		L = LCM(L, num / 2);
		if(L > M){
			cout << 0 << endl;
			return 0;
		}
	}
	cout << (M / L + 1) / 2 << endl;
	return 0;
}

Measured memory_bytes: 384
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
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 long long ll;
typedef pair<int,int> P;

int main(){
    string s,t;
    cin >> s >> t;
    int n = s.size();
    //book ok = 1;
    rep(i,n){
        if(s[i]!=t[i]){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
}

Measured memory_bytes: 3624
n,s = readlines.map &:chomp
n = n.to_i
mojiretus = s.bytes.to_a

henkan = []

mojiretus.each do |mojiretu|
    mojiretu = ((mojiretu + n) - 65) % 26 + 65
    henkan << mojiretu
end

puts  henkan.map {|code| code.chr}.join

Measured memory_bytes: 2300
#include <iostream>
#include <fstream>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <list>
#include <algorithm>
#include <cmath>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef __int128 lll;
constexpr ll mod = 1000000007;

ll a, b, c, p, q;

template<class Compare>
class sum_pri_queue : public priority_queue<ll, deque<ll>, Compare> {
private:
    ll ss = 0;
public:
    void push2(ll n) {
        this->push(n);
        ss += n;
    }

    ll pop2() {
        auto r = this->top();
        ss -= r;
        this->pop();
        return r;
    }

    ll sum() {
        return ss;
    }
};

int main() {
    cin >> q;
    sum_pri_queue<greater<>> bigger;
    sum_pri_queue<less<>> smaller;
    for (ll i = 0; i < q; i++) {
        cin >> c;
        if (c == 1) {
            cin >> a >> b;
            p += b;
            if (bigger.size() == smaller.size()) smaller.push2(a);
            else bigger.push2(a);
            while ((!bigger.empty()) && smaller.top() > bigger.top()) {
                smaller.push2(bigger.pop2());
                bigger.push2(smaller.pop2());
            }
        } else if (c == 2) {
            ll center = smaller.top();
            ll r = center * smaller.size() - smaller.sum() + bigger.sum() - center * bigger.size();
            cout << center << ' ' << r + p << endl;
        } else throw;
    }
}


Measured memory_bytes: 3712
#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;

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; }


i64 a;

int main(){
	cin >> a;
	
	i64 ans = 0;
	for(i64 i = 0;; i++){
		a/=2;
		ans += (1LL << i);
		if(a == 0) break;
	}
	cout << ans << endl;
	
	return 0;
}

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

int main() {

    map< string, string > w;

    w["Sunny"] = "Cloudy";
    w["Cloudy"] = "Rainy";
    w["Rainy"] = "Sunny";

    string s;
    cin >> s;
    cout << w[s] << 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 RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
typedef long long LL;
typedef pair<LL,int> P;
vector<P> v;
int N;
LL a[100001];
LL ans[100001];
int main(){
        REP(i,100001)ans[i]=0;
	cin>>N;
	REP(i,N){
	    cin>>a[i];
	    v.push_back(P(a[i],i));
	}
	sort(v.begin(),v.end(),greater<P>());
	LL now=v[0].first;
	LL pos=v[0].second;
	for(int i=1;i<N;i++){
	    LL se=v[i].second;
	    LL fi=v[i].first;
	    ans[pos]+=(now-fi)*i;
	    now=fi;
	    pos=min(se,pos);
	}
	ans[pos]+=now*N;
	REP(i,N){
	    cout<<ans[i]<<endl;
	}
	return(0);
}

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

const int MOD = 1000000007;

//long long
using ll = long long;

//出力系
#define print(x) cout << x << endl
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
 
// begin() end()
#define all(x) (x).begin(),(x).end()

//for
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)

//最大公約数 
unsigned gcd(unsigned a, unsigned b) {
  if(a < b) return gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}

int main(){
     ll N;
     cin >> N;
     vector<int>A(N);
     REP(i, N) cin >> A[i];
     ll sum = 0, cnt = 0, right = 0;
     REP(left, N){
         while(right < N && (sum ^ A[right]) == (sum + A[right])){
             sum += A[right];
             right++; 
         }
         cnt += right - left;
         sum -= A[left];
     }

print(cnt);
}

Measured memory_bytes: 1152
#include<bits/stdc++.h>
#define fo(i,a,b) for(int i=(a);i<(b);i++)
#define qi queue<int>
#define vi vector<int>
#define ll long long
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define pii pair<int,int>
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define fi first
#define se second
#define prq priority_queue
#define foreach(it,c) for(__typeof((c).begin()) it=c.begin();it!=c.end();it++)
//#define KEY_DOWN(VK_NONAME) ((GetAsyncKeyState(VK_NONAME) & 0x8000) ? 1:0)
using namespace std;
inline ll read(){
	ll x=0;
	int f=1;
	char c=getchar();
	for(;!isdigit(c);c=getchar()) if(c=='-')f=-f;
	for(;isdigit(c);c=getchar())x=x*10+(c-'0');
	return x*f;
}
inline void out(int x){
	if(x>=10)out(x/10);
	putchar(x%10+'0');
}
int main(){
	//freopen("a.in","r",stdin);
	//freopen("a.out","w",stdout);
	int a,b;
	cin>>a>>b;
	cout<<a*(a-1)/2+b*(b-1)/2<<endl;
	return 0;
}

Measured memory_bytes: 256
// Template
#include <bits/stdc++.h>
#define rep_override(x, y, z, name, ...) name
#define rep2(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, r) for (int i = (l); i < (r); ++i)
#define rep(...) rep_override(__VA_ARGS__, rep3, rep2)(__VA_ARGS__)
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x).size()
using namespace std;
using ll = long long;
constexpr int inf = 1001001001;
constexpr ll INF = 3003003003003003003;
template <typename T> inline bool chmin(T& x, const T& y) {if (x > y) {x = y; return 1;} return 0;}
template <typename T> inline bool chmax(T& x, const T& y) {if (x < y) {x = y; return 1;} return 0;}
struct IOSET {IOSET() {cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(10);}} ioset;

// Main
int main() {
    int n, k;
    cin >> n >> k;
    vector<int> p(n);
    rep(i, n) {cin >> p[i]; --p[i];}
    vector<ll> c(n);
    rep(i, n) cin >> c[i];
    
    ll ans = -INF;
    rep(i, n) {
        int now = i, cnt = 0;
        ll roopsum = 0;
        while (true) {
            now = p[now];
            ++cnt;
            roopsum += c[now];
            if (now == i) break;
        }
        ll nowsum = 0;
        int atsui = min(cnt, k);
        rep(j, atsui) {
            now = p[now];
            nowsum += c[now];
            if (roopsum > 0) {
                chmax(ans, nowsum + (k - j - 1) / cnt * roopsum);
            } else {
                chmax(ans, nowsum);
            }
        }
    }
    cout << ans << "\n";
    return 0;
}


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

using namespace std;

int main() {
  string str1, str2;
  cin >> str1;
  cin >> str2;
  int n = str1.length();
  for (int i = 0; i < n; ++i) {
    int idx = 0;
    if (str1[0] == str2[i]) {
      bool b = true;
      for (int j = i+1; j < n; ++j) {
	idx++;
	if (str1[idx] != str2[j]) {
	  b = false;
	  break;
	}
      }
      if (b) {
        for (int j = 1; j < n - idx; ++j) {
          if (str1[idx+j] != str2[j-1]) {
	    b = false;
	    break;
	  }
	}
      }
      if (b) {
	cout << "Yes" << endl;
	return 0;
      }
    }
  }
  cout << "No" << endl;

}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<sstream>
#include<cmath>
#include<numeric>
#include<map>
#include<stack>
#include<queue>
#include<list>
#include<cfloat>
using namespace std;
int mod = 1e9+7;
long long int inf = 1e18;

int main() {

  int n; cin >> n;
  vector<int> a;
  a.push_back(0);
  for(int i=0; i<n; i++){
    int x; cin >> x;
    a.push_back(x);
  }
  a.push_back(0);

  int sum = 0;
  for(int i=0; i<=n; i++){
    sum += abs(a[i]-a[i+1]);
  }

  for(int i=1; i<=n; i++){
    int tmp = sum - ( abs(a[i]-a[i-1]) + abs(a[i]-a[i+1]) ) + abs(a[i-1]-a[i+1]);
    cout << tmp << endl;
  }

  return 0;
}

//


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

using namespace std;

#define int long long
#define endl '\n'
#define maxn 100010
const int MOD = 1000000007;

void solve() {
    int n, k;
    cin >> n >> k;

    n %= k;
    cout << min(n, abs(k - n));
}

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int t = 1;
//    cin >> t;

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

Measured memory_bytes: 3644
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();

        if(n==2){
            int a = sc.nextInt();
            int b = sc.nextInt();
            if(a>b){
                int x = a;
                a = b;
                b = x;
            }
            for(int i=1;i<=a;i++){
                if(a%i==0 && b%i==0){System.out.println(i);}
            }
        }else if(n==3){
            int a = sc.nextInt();
            int b = sc.nextInt();
            int c = sc.nextInt();
            if(a>b && c>b){
                int x = a;
                a = b;
                b = x;
            }else if(a>c && b>c){
                int x = a;
                a = c;
                c = x;
            }
            for(int i=1;i<=a;i++){
                if(a%i==0 && b%i==0 && c%i==0){System.out.println(i);}
            }
        }
    }
}


Measured memory_bytes: 26412
n = int(input())
a = [0] + list(map(int, input().split()))
b = [0] + list(map(int, input().split()))
c = [0] + list(map(int, input().split()))
ans = sum(b)
for i in range(1, n):
    if a[i+1] - a[i] == 1:
        ans += c[a[i]]
print(ans)


Measured memory_bytes: 38256
#include <algorithm>
#include <bitset>
#include <cmath>
#include <functional>
#include <iostream>
#include <iterator>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <utility>
#include <unordered_map>
#include <unordered_set>
using namespace std;
 
#define ABS(a) (((a) >= 0) ? (a) : -(a))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) > (b) ? (b) : (a))
#define FOR(i, a, b) for (int i = (a); i <= (b); ++i)
#define RFOR(i, a, b) for (int i = (a); i >= (b); --i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define POW_10_9 1000000000
#define INF (numeric_limits<int>::max()/2)
#define int long long
 
typedef long long ll;
typedef pair<int, int> Pair;

const int costs[10] = {0,2,5,5,4,5,6,3,7,6};
int N,M;
string ans;
int A[9];
//桁DP
int dp[10001];

signed main(){
    cin >> N >> M;
    REP(i,M){cin>>A[i];}
    sort(A,A+M,greater<int>());//降順にソート
    FOR(i,1,N){
        REP(j,M){
            // 桁DP
            int k = i-costs[A[j]];
            if(k>=0) dp[i] = MAX(dp[i],dp[k]+1);
        }
        if(dp[i] == 0) dp[i] = -INF; //一つの整数のみで達成される場合
    }
    int i=N;
    REP(j,M){
        int k = i-costs[A[j]];
        while(k>=0 && dp[i]==dp[k]+1){
            ans.push_back('0'+A[j]);
            i -= costs[A[j]];
            k = i-costs[A[j]];
        }
    }
    cout << ans << endl;

    return 0;
}

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

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define rep2(i, a, b) for (ll i = (a); i < (b); i++)
#define chmax(x, v) do { x = max(x, v); } while (0)
#define chmin(x, v) do { x = min(x, v); } while (0)
typedef uint64_t ull;
typedef int64_t ll;
typedef std::pair<ll, ll> PLL;

using namespace std;

signed main() {
  ll X, Y, A, B, C;
  cin >> X >> Y >> A >> B >> C;
  vector<ll> p(A), q(B), r(C), merged;
  rep(i,A) cin >> p[i];
  rep(i,B) cin >> q[i];
  rep(i,C) cin >> r[i];
  sort(begin(p),end(p),greater<>());
  sort(begin(q),end(q),greater<>());
  rep(i, X) merged.push_back(p[i]);
  rep(i, Y) merged.push_back(q[i]);
  rep(i, C) merged.push_back(r[i]);
  sort(begin(merged),end(merged), greater<>());
  ll ans = 0;
  rep(i,X+Y)
    ans += merged[i];
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 8688
//ProblemB.cpp

#include <iostream>

static std::istream & ip = std::cin;
static std::ostream & op = std::cout;

#if OJ_MYPC
#include <ojio.h>
#endif

#ifndef OPENOJIO
#define OPENOJIO
#endif

#if 1 || DEFINE
/***************************************************************/
typedef unsigned long long u64;
typedef long long s64;

typedef unsigned uint;

#define ABS(x) ((x) > 0 ? (x) : -(x))

#define MIN(x, y) ((x) < (y) ? (x) : (y))
#define MAX(x, y) ((x) > (y) ? (x) : (y))

#define MIN3(x, y, z) MIN(x, MIN(y, z))
#define MAX3(x, y, z) MAX(x, MAX(y, z))

#define FillZero(arr) memset(arr, 0, sizeof(arr));

/***************************************************************/
#endif //1 || DEFINE

#include <string>
#include <vector>
#include <map>
#include <set>
#include <bitset>
#include <queue>
#include <stack>
#include <utility>
#include <algorithm>
#include <iomanip>
#include <cstring>
#include <cmath>
#include <cstdio>

//001
//op << setfill('0') << setw(3) << setiosflags(ios::right) << 1;

//op << fixed << setprecision(20);

using namespace std;

//ProblemB.cpp

int main(int argc, char* argv[])
{
	OPENOJIO;

	int n;
	vector<s64> cards;

	ip >> n;
	cards.resize(n);

	s64 rst = 0; s64 pre = 0;
	for (int i = 0; i < n; ++i) {
		ip >> cards[i];

		s64 t = cards[i] + pre;
		rst += t / 2;

		if(cards[i] > 0) pre = t % 2;
		else pre = 0;
	}

	op << rst << endl;
	return 0;
}
/***************************************************************/


Measured memory_bytes: 1532
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main(){
  int n;
  cin >> n;
  vector<int> b(n);
  rep(i, n) cin >> b[i];
  int nx = b[0] - 1;
  int c = 1;
  while(true){
    if(nx == 1) {
      cout << c << endl;
      return 0;
    }
    nx = b[nx] - 1;
    c++;
    // cout << "next btn " << nx + 1 << " cnt " << c << endl;
    if(c > n) break;
  }
  cout << -1 << endl;

}


Measured memory_bytes: 3784
X=int(input())
if 400<=X<=599:
    print(8)
elif 600<=X<=799:
    print(7)
elif 800<=X<=999:
    print(6)
elif 1000<=X<=1199:
    print(5)
elif 1200<=X<=1399:
    print(4)
elif 1400<=X<=1599:
    print(3)
elif 1600<=X<=1799:
    print(2)
else:
    print(1)

Measured memory_bytes: 9184
#include<bits/stdc++.h>
using namespace std;
int main() { 
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int a,b,c;
  cin>>a>>b>>c;
  cout<<(a+b+c>=22? "bust":"win");
  
  return 0;
  }

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

int main(){
    int w, x, y, z, a, b, c, d;
    cin >> w >> x >> y >> z >> a >> b >> c >> d;

    int hiroshi = w*a + x*b + w/10 * c + x/20 * d;
    int kenjiro = y*a + z*b + y/10 * c + z/20 * d;

    if(hiroshi > kenjiro)       cout << "hiroshi" << endl;
    else if(hiroshi < kenjiro)  cout << "kenjiro" << endl;
    else if(hiroshi == kenjiro) cout << "even" << endl;
    
    return 0;
}


Measured memory_bytes: 3096
/*===================*\
|ID : harryPotter_421  |
|      LANG: C++       |
\*====================*/
#include <iostream>
#include<bits/stdc++.h>
#define lli long long int
#define ld long double
#define pb push_back
#define f(j,m,n) for(lli j=m;j<n;j++)
#define harry ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;

int main()
   {harry
    lli n;
    cin>>n;
    lli arr[n+1],dp[n+1];
    for(lli i=1;i<=n;i++)
         cin>>arr[i];
         dp[1]=0;
         dp[2]=abs(arr[2]-arr[1]);
         for(int i=3;i<=n;i++)
            {dp[i]=min(dp[i-2]+abs(arr[i]-arr[i-2]),dp[i-1]+abs(arr[i]-arr[i-1]));}
         cout<<dp[n];



   }

















Measured memory_bytes: 1792
#include<iostream>
#include<map>
#include<list>
#include<cstring>
using namespace std;
map<int,list<int>>mp;
int dp[100005];
int solve(int src)
{
    if(dp[src]!=-1)
    {
        return dp[src];
    }
    bool node=0;
    int newnode=0;
    for(auto i:mp[src])
    {
        node=1;
        newnode=max(newnode,1+solve(i));
    }
    if(node==0)
    {
        return dp[src]=0;
    }
    else{
        return dp[src]=newnode;
    }
}
int main()
{
    int n,m,k,ans=0;
    cin>>n>>m;
    k=m;
    while(m--)
    {
        int a,b;
        cin>>a>>b;
        mp[a].push_back(b);
    }
        memset(dp,-1,sizeof dp);
        for(int i=1;i<=n;i++)
        {
            ans=max(ans,solve(i));
        }
        cout<<ans<<endl;
    }


Measured memory_bytes: 18884
A, B, K = [int(x) for x in input().split()]

for i in range(K):
    if i % 2 == 0:
        if A % 2 == 1:
            A -= 1
        B += A // 2
        A = A//2
    else:
        if B % 2 == 1:
            B -= 1
        A += B // 2
        B = B // 2

print("{} {}".format(A, B))


Measured memory_bytes: 2940
#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <string>
#include <map>
#include <cmath>
#include <cstring>

#define fi first
#define se second
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for (int i = 1; i < (n); ++i)
#define drep(i,n) for (int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define all(x) (x).begin(), (x).end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define pb push_back
#define sz(x) (int)(x).size()
#define PQ(T) priority_queue<T, v(T), greater<T> >

using namespace std;
typedef long long ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;

const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;

const int mod = 1000000007;

int main() {
    int a,b,c;
    cin >> a >> b >> c;
    if (a==b && a!=c) cout << "Yes" << endl;
    else if (a==c && a!=b) cout << "Yes" << endl;
    else if (c==b && a!=c) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}





















Measured memory_bytes: 256
#include <iostream>
using namespace std;
typedef long long int ll;

int main(){
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    if(a+b>c+d){
        cout<<"Left"<<endl;
    }else if(a+b==c+d){
        cout<<"Balanced"<<endl;
    }else{
        cout<<"Right"<<endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int solve(int H, int W)
{
    if(H%3==0 || W%3==0)
    {
        return 0;
    }
    long long ans = 1234123412349LL;
    for(long long int i=0; i<=H; ++i)
    {
        long long int v1 = i*W;
        long long int v2 = (H-i)*(W/2);
        long long int v3 = (H-i)*(W-W/2);
        long long int v4 = ((H-i)/2)*W;
        long long int v5 = ((H-i)-(H-i)/2)*W;
        ans = min(ans, max({v1,v2,v3})-min({v1,v2,v3}));
        ans = min(ans, max({v1,v4,v5})-min({v1,v4,v5}));
    }
    return ans;
}
int main()
{
    int H, W;
    scanf("%d%d", &H, &W);
    printf("%d\n", min(solve(H, W), solve(W, H)));
}

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

#define rp(i, k, n) for (int i = k; i < n; i++)
typedef long long ll;
typedef double ld;

template<class T>inline bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>inline bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll INF = 1ll << 60;
const ll MOD = 1e9 + 7ll;
const double PI=3.14159265358979323846;

struct UnionFind {
    vector<int> par;
    vector<int> siz;
    UnionFind(int _sz) : par(_sz), siz(_sz, 1) {
        rp(i, 0, _sz) par[i] = i;
    }
    int root(int a) {
        while(a != par[a]) {
            a = par[a] = par[par[a]];
        }
        return a;
    }
    bool unite(int a, int b) {
        int root_a = root(a);
        int root_b = root(b);
        if(root_a == root_b) return false;
        else {
            par[root_b] = root_a;
            siz[root_a] += siz[root_b]; 
            return true;
        }
    }
};



int main() {
    int n, m;
    cin >> n >> m;
    UnionFind uf(n);
    rp(i, 0, m) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        uf.unite(a, b);
    }
    int res = 0;
    rp(i, 0, n) chmax(res, uf.siz[uf.root(i)]);
    cout << res << endl;
    return 0;
}


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


// M A F I A - M A F I A - M A F I A - M A F I A - M A F I A - M A F I A //

#define int               int
#define endl              '\n'
#define ff                first
#define ss                second
#define mp                make_pair
#define pb                push_back
#define vii               vector<int> 
#define pii               pair<int,int>
#define vpii              vector< pii >
#define all(v)            v.begin(),v.end()
#define loop(i,s,e)       for(int i=s;i<e;i++)
#define rloop(i,e,s)      for(int i=e;i>=s;i--)
#define mset(a,f)              memset(a,f,sizeof(a))
#define M                 1000000007
#define fastio            ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define prvec(v)          loop(i_u_j,0,v.size())cout << v[i_u_j] ; cout << endl;
#define prarr(arr,n)      loop(i_u_j,0,n)cout << arr[i_u_j] << " "; cout << endl;
#define bug(...)        __f (#__VA_ARGS__, __VA_ARGS__)


template <typename Arg1>
void __f (const char* name, Arg1&& arg1) { cout << name << " : " << arg1 << endl; }
template <typename Arg1, typename... Args>
void __f (const char* names, Arg1&& arg1, Args&&... args)
{
     const char* comma = strchr (names + 1, ',');
     cout.write (names, comma - names) << " : " << arg1 << " | "; __f (comma + 1, args...);
}

// M A F I A - M A F I A - M A F I A - M A F I A - M A F I A - M A F I A //
const int N = 3e5 + 7;
int n1, n2;
int arr[N];
string s,t;
int   dp[3001][3001];


void solve()
{
      cin >> s >> t;
      
      n1 = s.length();
      n2 = t.length();
      s = " " + s;
      t = " " + t;
      mset(dp,0);
      loop(i,1,n1+1)
      {
            loop(j,1,n2+1)
            {
                  if( s[i] == t[j] )
                  {
                        dp[i][j] = dp[i-1][j-1] + 1;
                  }
                  else
                  {
                        dp[i][j] = max(dp[i-1][j], dp[i][j-1]);
                  }
            }
      }
      vector<char> vec;
      int x = n1, y = n2;
      while( x > 0 and y > 0 )
      {
            if( s[x] == t[y] ) 
            {
                  vec.pb(s[x]);
                  x--; y--;
            }
            else
            {
                  if( dp[x][y-1] > dp[x-1][y] ) y = y-1;
                  else x = x - 1;
            }
      }
      reverse( all(vec));
      prvec(vec);


}

int32_t main() {
    fastio;
  
  int t = 1; 
  //cin>>t;
  
  while(t--) solve();
  
  


}


// M A F I A - M A F I A - M A F I A - M A F I A - M A F I A - M A F I A //















Measured memory_bytes: 35456
using System;
using System.Collections.Generic;
using System.Linq;

namespace ziyuutyou
{
    class Program
    {
        static void Main(string[] args)
        {
            var S = Console.ReadLine();
            var count = new int[S.Length + 1];
            count[0] = 0;

            for(var i=0; i<S.Length; i++)
            {
                if(S[i] == 'A' || S[i] == 'C' || S[i] == 'G' || S[i] == 'T')
                {
                    count[i + 1] = ++count[i];
                }
                else
                {
                    count[i + 1] = 0;
                }
            }
            Console.WriteLine(count.Max());
        }
        
    }
}


Measured memory_bytes: 13268
process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data',function(chunk){


var data = chunk.toString().split(' ').map(Number);

var a = data[0];
var b = data[1];
var c = data[2];
var count = 0;

for(var i = a; i < b+1 ; i++){

if(c % i === 0){
    count++;
  }
 }
console.log(count);
});

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

int main() {
  int n;
  cin >> n;
  tuple<int,int,int>data=make_tuple(0,0,0);
  for(int i=0;i<n;i++){
    int t,x,y;
    cin >> t >> x >> y;
    if((x+y+t)%2==1||abs(t-get<0>(data))<abs(x-get<1>(data))+abs(y-get<2>(data))){
      cout << "No" << endl;
      return 0;
    }
    data=make_tuple(t,x,y);
  }
  cout << "Yes" << endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void){
	int time, m1, m2, s1, s2;
	
	scanf("%d", &time);
	s1 = time / 60; s2 = time % 60;
	m1 = s1 / 60; m2 = s1 % 60;
	
	printf("%d:%d:%d\n", m1, m2, s2);
	
	return 0;
}

Measured memory_bytes: 592
#include <bits/stdc++.h>
#define ll long long
#define uint unsigned long long
#define ls x << 1
#define rs x << 1 | 1
#define pb push_back
#define mp make_pair
#define pii pair<int, int>
#define X first
#define Y second
#define pcc pair<char, char>
#define vi vector<int>
#define vl vector<ll>
#define rep(i, x, y) for(int i = x; i <= y; i ++)
#define rrep(i, x, y) for(int i = x; i >= y; i --)
#define eps 1e-9
using namespace std;
inline int read()
{
	int x = 0, f = 1; char ch = getchar();
	while (ch < '0' || ch > '9') { if (ch == '-') f = -1; ch = getchar(); }
	while (ch >= '0' && ch <= '9') { x = x * 10 + ch - '0'; ch = getchar(); }
	return x * f;
}
const int M = 262144;
const int N = 1e6 + 10;
int n, a[N], L[N], R[N], ss[N];
bool fl[N];
pii ps[N];

pii mg(pii a,pii b)
{
	return pii(min(a.X, b.X), min(a.Y, b.Y));
}
int qr(int p)
{
	static int s1[800010],s2[800010];
	int n1 = 0, n2 = 0;
	for(int l = p + M - 1, r = n + M + 3; l ^ r ^ 1; l >>= 1, r >>= 1)
	{
		if(~l & 1) s1[++ n1] = l ^ 1;
		if(r & 1) s2[++ n2] = r ^ 1;
	}
	while(n2) s1[++ n1] = s2[n2 --];
	int g;
	rep(i, 1, n1)
		if(ss[s1[i]]) {g = s1[i]; break;}
	while(g < M)
	{
		if(ss[g + g]) g = g + g;
		else g = g + g + 1;
	}
	return R[g] - 1;
}
void Clear(int x)
{
	for(x += M; x; x >>= 1) ss[x] = 1;
}
void build()
{
	rep(i, 1, M) L[i + M] = R[i + M] = i;
	rep(i, 1, n)
		if((n - i) & 1) ps[i + M] = pii(a[i], 1e9);
		else ps[i + M] = pii(1e9, a[i]);
	rrep(i, M - 1, 1)
		L[i] = L[i + i], R[i] = R[i + i + 1],
		ps[i] = mg(ps[i + i], ps[i + i + 1]);
}
void pd(int x)
{
	if(fl[x])
	{
		swap(ps[x].X, ps[x].Y);
		if(x <= M) fl[ls] ^= 1, fl[rs] ^= 1;
		fl[x] = 0;
	}
}
void Push_down(int x)
{
	pd(ls);
	pd(rs);
	ps[x] = mg(ps[ls], ps[rs]);
}
pii Query(int x,int l,int r)
{
	if(R[x] < l || r < L[x]) return pii(1e9,1e9);
	pd(x);
	if(l <= L[x] && R[x] <= r) return ps[x];
	pii t = mg(Query(ls, l, r), Query(rs, l, r));
	Push_down(x);
	return t;
}
void Del(int p)
{
	int x = 1;
	while(1)
	{
		pd(x);
		if(x > M) break;
		if(p <= R[ls]) x = ls;
		else x = rs;
	}
	ps[x] = pii(1e9, 1e9);
	for(x >>= 1; x; x >>= 1) ps[x] = mg(ps[ls], ps[rs]);
}
void Upd(int x,int l,int r)
{
	if(R[x] < l || r < L[x]) return;
	pd(x);
	if(l <= L[x] && R[x] <= r) {fl[x] ^= 1; return;}
	Upd(ls, l, r);
	Upd(rs, l, r);
	Push_down(x);
}
int ans[N], cnt, rv[N];
int main()
{
	n = read();
	rep(i, 1, n)
		a[i] = read(), rv[a[i]] = i;
	build();
	Clear(n + 1);
	while(cnt < n)
	{
		int x = rv[Query(1, 1, n).X], t = qr(x);
		int y = rv[Query(1, x, t).Y];
		ans[++ cnt] = a[x];
		ans[++ cnt] = a[y];
		Upd(1, x, y);
		Del(x);
		Del(y);
		Clear(x);
		Clear(y);
	}
	rep(i, 1, cnt) printf("%d ",ans[i]);
	return 0;
}


Measured memory_bytes: 30976
// finish date: 2019/1/26

#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)
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<vector<int>>> vvvi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<double> vd;
typedef vector<vector<double>> vvd;
typedef vector<vector<vector<double>>> vvvd;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<string> vs;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, pair<int, int>> plii;
const int bigmod = 1000000007;
const int INF = 1000000007;
const long long INFll = 100000000000000000;


vvi warshall_floyd(vvi d) {
    int n = d.size();
    for (int k = 0; k < n; k++) {       // 経由する頂点
        for (int i = 0; i < n; i++) {    // 始点
            for (int j = 0; j < n; j++) {  // 終点
                d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
            }
        }
    }
    return d;
}

int main() {
    int H, W;
    cin >> H >> W;
    vs S(H);
    rep(i, H) cin >> S[i];
    int N = H * W;
    vvi d(N, vi(N, INF));
    rep(i, N) d[i][i] = 0;
    rep(i, H) {
        rep(j, W) {
            if (S[i][j] == '#') continue;
            int x[] = {-1, 0, 1, 0};
            int y[] = {0, -1, 0, 1};
            rep(k, 4) {
                if ((0 <= i + y[k] and i + y[k] < H) and
                    (0 <= j + x[k] and j + x[k] < W) and
                    (S[i + y[k]][j + x[k]] == '.')) {
                    d[i * W + j % W][(i + y[k]) * W + (j + x[k]) % W] = 1;
                }
            }
        }
    }


    vvi dist = warshall_floyd(d);
    int ma = 0;
    rep(i, N) {
        rep(j, N) {
            if (dist[i][j] != INF)
                ma = max(ma, dist[i][j]);
        }
    }
    cout << ma <<endl;

    return 0;
}


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

using namespace std;

#define pb push_back
#define mp make_pair
#define MOD ((int)(1e9) + 7)
const int N = 1 * ((int)1e5) + 1;

int a,b,c;
int ans;

int main ()
{
	scanf("%d %d %d",&a,&b,&c);
	if (a % 2 == 0 && a == b && b == c)
		return printf("%d",-1),0;
	while (a % 2 == 0 && b % 2 == 0 && c % 2 == 0)
	{
		int ta = a, tb = b, tc = c;
		a = tb / 2 + tc / 2;
		b = ta / 2 + tc / 2;
		c = tb / 2 + ta / 2;
		ans++;
	}
	printf("%d",ans);
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<list>
#include<iomanip>
#include<cmath>
#include<cstring>
#include<functional>
using namespace std;
using ll = long long;
using Pi = pair<int,int>;
using Pl = pair<ll,ll>;

int main(){
  int N, M;
  cin >> N >> M;
  vector<pair< int, int >> p; // firstがA日後に入金、second 入金額
  int tmpA, tmpB;
  pair<int,int> tmpP;
  priority_queue<pair<int,int>, vector<pair<int,int>>, greater<pair<int,int>> > arbeit;
  for( int i=0; i<N; i++ ){
    cin >> tmpA >> tmpB;
    tmpP = make_pair( tmpA, tmpB );
    arbeit.push( tmpP );
  }
/*  
  for( int i=0; i<N; i++ ){
    cout << arbeit.top().first << " " << arbeit.top().second << endl;
    arbeit.pop();
  }*/
  
  priority_queue<int> pq;
  int earn = 0;
  
  for( int day = 1; day <= M; day++ ){
//    printf( "Day %d\n", day );
    while( !arbeit.empty() && arbeit.top().first == day ){
      pq.push( arbeit.top().second );
      arbeit.pop();        
    }
    if( pq.empty() ) continue;
    earn += pq.top();
    pq.pop();
  }
  
  cout << earn;
  return 0;
}

  


Measured memory_bytes: 1908
#include <bits/stdc++.h>
using namespace std;
//make_tuple emplace_back next_permutation push_back make_pair second first setprecision

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

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

struct Problem{
    int h,w;
    vector<int> c;
    Problem(LL n, LL w):h(n),w(w),c(26){};

    void solve(){
        for(int i=0; i<h; ++i){
            for(int j=0; j<w; ++j){
                char tmp;
                cin >> tmp;
                c[tmp-'a']++;
            }
        }
        vector<int> amari(4);
        for(int i=0; i<26; ++i){
            amari[c[i]%4]++;
        }
        DBG(amari)
        bool ans=false;
        if(h%2==1 and w%2==1){
            if(amari[2]<=((h+w)/2-2)and amari[3]==1 and amari[1]==0)ans= true;
            if(amari[2]<=((h+w)/2-1)and amari[3]==0 and amari[1]==1)ans=true;
        }else if(h%2== 0 and w%2==0){
            if(amari[2]==0 and amari[3]==0 and amari[1]==0)ans=true;
        }else{
            if(h%2==1 and amari[2]<=w/2 and amari[3]==0 and amari[1]==0)ans= true;
            if(w%2==1 and amari[2]<=h/2 and amari[3]==0 and amari[1]==0)ans=true;
        }

        if(ans) cout <<"Yes"<<"\n";
        else cout <<"No"<<"\n";
    }
};

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    long long n=0,w;
    cin >> n >> w;
    Problem p(n,w);
    p.solve();
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define owo(i,a, b) for(int i=(a);i<(b); ++i)
#define uwu(i,a, b) for(int i=(a)-1; i>=(b); --i)
#define senpai push_back
#define ttgl pair<int, int>
#define ayaya cout<<"ayaya~"<<endl
 
using namespace std;
/*#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
gp_hash_table<int, int> mp;*/
using ll = long long;
using ld = long double;
const ll MOD = 1000000007;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
ll binpow(ll a,ll b){ll res=1;while(b){if(b&1)res=(res*a)%MOD;a=(a*a)%MOD;b>>=1;}return res;}
ll modInv(ll a){return binpow(a, MOD-2);}
const double PI = acos(-1);
const double eps = -1e6;
const int INF = 0x3f3f3f3f;
const int NINF = 0xc0c0c0c0;
const ll INFLL = 0x3f3f3f3f3f3f3f3f;
const ll NINFLL = 0xc0c0c0c0c0c0c0c0;
array<int, 3> arr[16];
ll valx[1<<15][15];
ll valy[1<<15][15];
ll ans[15];
int n;
int main()
{   
    //freopen("file.in", "r", stdin);
    //freopen("file.out", "w", stdout);
    mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
    cin.tie(0)->sync_with_stdio(0);
    cin>>n;
    owo(i, 0, n) {
        cin>>arr[i][0]>>arr[i][1]>>arr[i][2];
    }
    owo(i, 0, (1<<n)) {
        set<int> yl;
        set<int> xl;
        xl.insert(0);
        yl.insert(0);
        owo(j, 0, n) {
            if(i&(1<<j)) {
                xl.insert(arr[j][0]);
                yl.insert(arr[j][1]);
            }
        }
        owo(j, 0, n) {
            auto up = xl.lower_bound(arr[j][0]);
            ll add = INFLL;
            if(up!=xl.end()) {
                add = min(add, 1LL*(*up - arr[j][0])*arr[j][2]);
            }
            if(up!=xl.begin()) {
                up--;
                add = min(add, 1LL*(arr[j][0] - *up)*arr[j][2]);
            }
            valx[i][j]=add;
        }
        owo(j, 0, n) {
            auto up = yl.lower_bound(arr[j][1]);
            ll add = INFLL;
            if(up!=yl.end()) {
                add = min(add, 1LL*(*up - arr[j][1])*arr[j][2]);
            }
            if(up!=yl.begin()) {
                up--;
                add = min(add, 1LL*(arr[j][1] - *up)*arr[j][2]);
            }
            valy[i][j]=add;
        }
    }
    memset(ans, INFLL, sizeof(ans));
    owo(msk, 0, 1<<n) {
        int num = __builtin_popcount(msk);
        ll best = INFLL;
        for(int s=msk; ; s=(s-1)&msk) {
            ll curr =0;
            owo(i, 0, n) {
                curr+=min(valx[s][i], valy[msk^s][i]);
            }
            best = min(best, curr);
            if(s==0)break;
        }
        ans[num] = min(ans[num], best);
    }
    owo(i, 0, n+1) {
        cout<<ans[i]<<"\n";
    }
    return 0;
}


Measured memory_bytes: 11280
from collections import defaultdict
import sys
input = sys.stdin.readline

N=int(input())
A=list(map(int,input().split()))
lcm = defaultdict(int)

n=max(A)+5

#is_prime[i]にはi-1画素数か否かを示すboolが入る，[0]に1の素数判定がある．
is_prime = [True]*(n+1)
is_prime[0] = False

for i in range(2, n+1):
    if is_prime[i-1]:
        j = 2 * i
        while j <= n:
            is_prime[j-1] = False
            j += i

table = [ i for i in range(1, n+1) if is_prime[i-1]]
#print(table)


for i in range(N):
    a=A[i]
    for j in table:
        temp=0
        while a%j==0:
            a=a//j
            temp+=1
        lcm[j]=max(lcm[j],temp)
        if a==1 or j*j>A[i]:
            break
    if a!=1:
        lcm[a]=max(lcm[a],1)
                
        
l=1
for d in lcm.items():
    l*=pow(d[0],d[1])
    
ans=0
mod=10**9+7

for i in range(N):
    ans+=l//A[i]
    
print(ans%mod)

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

int main(){
  int n, m;
  cin >> n >> m;
  vector<pair<int, int>> vec(n);
  for(int i = 0; i < n; ++i){
    vec[i].first = n - i - 1;
    vec[i].second = i + 1;
  }
  int e;
  for(int i = n; i < n + m; ++i){
    cin >> e;
    vec[e - 1].first = i;
  }
  sort(vec.begin(), vec.end(), greater<pair<int, int>>());
  for(int i = 0; i < n; ++i){
    cout << vec[i].second << endl;
  }
  return 0;
}


Measured memory_bytes: 4396
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

int main() {
	ll k,x;
	cin>>k>>x;
	if(k*500>=x){
		cout << "Yes";
	}
	else{
		cout << "No";
	}
	// your code goes here
	return 0;
}

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

int main() {
  long N;
  long K;
  cin >> N;
  cin >> K;
  long sum = 0;
  for (long p = K; p <= N+1; p++) {
    sum += (long)p*N-p*(p-1)+1;
  }
  long ans = sum % (1000000007);
  cout << ans << endl;;
}



Measured memory_bytes: 3604
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <math.h>
#include <complex>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <bitset>
#include <functional>
#include <assert.h>
#define int long
#define ll long long
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define eb emplace_back
#define all(x) x.begin(),x.end()
#define SZ(x) x.size()
#define fi first
#define se second
const int INF = 1e9;
using namespace std;

template<class t> using vc=vector<t>;
template<class t> using vvc=vc<vc<t>>;

using pi=pair<int,int>;
using vi=vc<int>;

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;
}

signed main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout<<fixed<<setprecision(20);

    int N,M,R; cin >> N >> M >> R;
    vi r; rep(i,R) {int a; cin >> a; a--; r.eb(a);}
    int A[M],B[M],C[M];
    rep(i,M){
        cin >> A[i] >> B[i] >> C[i];
        A[i]--; B[i]--;
    }
    int dis[210][210];
    rep(i,N) {
        rep(j,N) dis[i][j] = INF;
        dis[i][i] = 0;
    }
    rep(i,M){
        chmin(dis[A[i]][B[i]],C[i]);
        chmin(dis[B[i]][A[i]],C[i]);
    }
    rep(i,N){
        rep(j,N){
            rep(k,N){
                chmin(dis[j][k],dis[j][i]+dis[i][k]);
            }
        }
    }
    int ans=INF;
    sort(all(r));
    do{
        int pos=0;
        rep(i,R-1){
            pos+=dis[r[i]][r[i+1]];
        }
        chmin(ans,pos);
    }while(next_permutation(all(r)));
    cout << ans << endl;

}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int x[100005];
int read() {
	char c=getchar(); int x=0,f=1;
	while (c<'0' || c>'9') {
		if (c=='-') f=-1;
		c=getchar();
	}
	while (c>='0' && c<='9') {
		x=x*10+c-'0';
		c=getchar();
	}
	return x*f;
}
int main() {
	int n=read(),k=read();
	for (int i=1; i<=n; i++) x[i]=read();
	x[n+1]=0;
	sort(x+1,x+n+2);
	int j;
	for (int i=1; i<=n+1; i++) if (x[i]==0) j=i;
	int ans=1<<30;
	for (int i=max(j,k+1); i<=min(j+k,n+1); i++) {
		ans=min(ans,x[i]*2-x[i-k]);
	}
	for (int i=min(j,n+1-k); i>=max(j-k,1); i--) {
		ans=min(ans,-x[i]*2+x[i+k]);
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
#define loop(i, a, b) for(li i=a; i<=b; i++)
#define stuff ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
using namespace std;
typedef long long li;
typedef long double ld;
typedef pair<int, int> ii;
typedef pair<li, li> lii;
typedef vector<int> vi;
typedef vector<li> vli;
typedef vector<ii> vii;
typedef vector<lii> vlii;
li mod = 1e9+7;
li expo(li base, li exponent)
{
	li ans=1;
	while(exponent)
	{
		if(exponent&1) ans = (ans*base)%mod;
		base = (base*base)%mod;
		exponent >>= 1;
	}
	return ans;
}
li gcd(li x, li y)
{
	if(y==0) return x;
	return gcd(y, x%y);
}


typedef tree<li, null_type, less<li>,
rb_tree_tag, tree_order_statistics_node_update> ordered_set;

int main()
{
	stuff;
	// #ifndef ONLINE_JUDGE 
	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);
	// freopen("error.txt", "w", stderr);
	// #endif

	li n, k;
	cin >> n >> k;
	vector<li> ar(n);
	loop(i, 0, n-1) cin >> ar[i], ar[i]--;
	vector<li> pwr = ar, ans(n), tmp;
	for(li i=0; i<n; i++)
	{
		ans[i] = i;
	}
	while(k>0)
	{
		// for(auto x : pwr)
		// {
		// 	cout << x << " ";
		// }
		// cout << endl;
		if(k&1)
		{
			for(li i=0; i<n; i++)
			{
				ans[i] = pwr[ans[i]];
			}
		}
		tmp = pwr;
		for(li i=0; i<n; i++)
		{
			pwr[i] = tmp[tmp[i]];
		}
		// cout << ans[0]+1 << endl;
		k >>= 1;
	}
	cout << ans[0]+1;
	return 0;
}


Measured memory_bytes: 9532
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <limits>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x * x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18

vector< bool > isprimetable(int n) {
	vector< bool > prime(n + 1, true);
	if (n >= 0) prime[0] = false;
	if (n >= 1) prime[1] = false;
	for (int i = 2; i * i <= n; i++) {
		if (!prime[i]) continue;
		for (int j = i + i; j <= n; j += i) {
			prime[j] = false;
		}
	}
	return prime;
}




int main() {

	//0------l-1 l-----r
	int n; n = 100010;
	auto prime = isprimetable(n);

	vector<int> table(n);

	for (int i = 3; i < n; i+=2) {
		if (prime[i]==true && prime[(i+1)/2]==true) {
			table[i]++;
		}
	}

	for (int i = 3; i < n; i++) {
		table[i] += table[i - 1];
	}

	int q; cin >> q;

	for (int i = 0; i < q; i++) {
		int n, m; cin >> n >> m;

		cout << table[m]-table[n-1] << endl;
	}



	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#define rep(i, a, n) for(int i = a;i < n;i++)
using namespace std;


int n;
int a[4][110];


int acc(int *ary, int a, int b){
	int s = 0;
	rep(i, a, b+1) s += ary[i];
	return s;
}


int solve(){
	int ans = 0;

	rep(i, 0, n) ans = max(ans, acc(a[0], 0, i) + acc(a[1], i, n-1));

	return ans;
}


int main(){
	cin >> n;
	rep(i, 0, 2)
		rep(j, 0, n) cin >> a[i][j];

	cout << solve() << endl;

	return 0;
}

Measured memory_bytes: 256