akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

void fn(int i,int j,vector<ll>& v,vector<vector<ll> >& dp,vector<vector<ll> >& s){
	if(i==j){
		dp[i][j]=v[i];
		s[i][j]=0;
		return;
	}
	
	if(dp[i+1][j]==-1)
		fn(i+1,j,v,dp,s);
	if(dp[i][j-1]==-1)
		fn(i,j-1,v,dp,s);
	

	ll t1=v[i]+s[i+1][j],t2=s[i][j-1]+v[j];

	if(t1>t2){
		dp[i][j]=t1;
		s[i][j]=dp[i+1][j];
	}
	else{
		dp[i][j]=t2;
		s[i][j]=dp[i][j-1];
	}

}

int main(){

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);

	int n;cin>>n;
	vector<ll> v(n,0);
	for(int i=0;i<n;i++)
		cin>>v[i];

	vector<vector<ll> > dp(n,vector<ll> (n,-1));
	vector<vector<ll> > s(n,vector<ll> (n,-1));
	
	fn(0,n-1,v,dp,s);
	cout<<dp[0][n-1]-s[0][n-1]<<endl;

	return 0;
}

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

int main(void){
  std::string s;
  std::cin >> s;

  std::string codefes = "CODEFESTIVAL2016";

  int count = 0;
  for(int i=0; i<codefes.size(); i++){
    count += (s[i]!=codefes[i])?1:0;
  }

  std::cout << count << std::endl;
  return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines


def main():
    N = int(readline())
    S = list(readline().rstrip().decode())
    ans = 1
    for s1, s2 in zip(S, S[1:]):
        if s1 != s2:
            ans += 1
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 4948
#include <iostream>
#include <string>//
#include <vector>//
#include <map>
#include <cstdlib>
#include <numeric>
#include <algorithm>//ソート等に使用
#include <iomanip>
#define _USE_MATH_DEFINES
#include <cmath>
#include <math.h>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <thread>///////////////////
#include <queue>//幅優先等のキュー
#include <stack>
#include <bitset>

#define rep(i,m,n) for(int i=(m);i<=(n);i++)
#define mer(i,m,n) for(int i=(m);i>=(n);--i)

#define MOD 1000000007
//#define MOD 998244353
//#define MAX 

using namespace std;

using ll = long long int;
using ld = long double;
using std::swap;

vector<int> v;
vector<long long int> vll;
//vector<vector<int>> vec(50, vector<int>(4, 0));
vector<vector<int>> vv;
vector<char> vc;
vector<string> vs;

long long modpow(long long a, long long n, long long mod) {
	long long res = 1;
	while (n > 0) {
		if (n & 1) res = res * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}


int main() {
	int N;
	ll nor = 1, ans = 1, nine = 1;
	cin >> N;
	ans = modpow(10, N, MOD);
	nine = modpow(9, N, MOD);
	nor = modpow(8, N, MOD);
	
	ans = (ans % MOD - ((nine * 2) % MOD - nor % MOD)) % MOD;
	if (ans < 0)ans += MOD;
	cout << ans << '\n';
	return 0;
}


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

/* macro */
#define rep(i,a,b) for(int i=a;i<b;i++)
#define revrep(i,a,b) for(int i = a; i > b; i--)
#define int long long
#define exist(s,e) ((s).find(e)!=(s).end())
#define all(v) (v).begin(), (v).end()
#define each(s,itr) for(auto (itr) = s.begin(); (itr) != s.end(); (itr)++)
#define sum(v) accumulate(all(v), (0LL))
#define isin(a, b, c) (b <= a && a <= c)
#define println cout << "\n";
#define sz(v) (int)v.size()
#define bin(x) static_cast<bitset<16> >(x)


/* alias */
template<class T> using vec = vector<T>;
typedef vector<int> vi;
typedef pair<int, int> pi;
typedef tuple<int, int, int> ti;
typedef map<int, int> mi;
typedef set<int> si;


/* constant */
const int inf = 1LL << 62;
const int mod = 1e9 + 7;
const int dx[8]={1,0,-1,0,-1,1,-1,1};
const int dy[8]={0,1,0,-1,-1,-1,1,1};
const string alphabet = "abcdefghijklmnopqrstuvwxyz";

/* io_method */
int input(){int tmp;cin >> tmp;return tmp;}
string raw_input(){string tmp;cin >> tmp;return tmp;}
template<class T> void printx(T n){cout << n;}
template<class T, class U> void printx(pair<T, U> p){cout << "(" << p.first << "," << p.second << ")";}
template<class T, class U, class V> void printx(tuple<T, U, V> t){cout << "{" << get<0>(t) << "," << get<1>(t) <<"," << get<2>(t) << "}" << endl;}
template<class T> void printx(vector<T> v){cout << "{";rep(i,0,v.size()){printx(v[i]);if(i != v.size()-1)printx(",");}cout << "}";}
template<class T> void print(T n){printx(n);cout << endl;}
template<class T> void print(set<T> s){cout << "{";each(s, e){if(e != s.begin()) printx(",");printx(*e);}cout << "}" << endl;}
template<class T, class U> void print(map<T, U> mp){cout << "{";each(mp, e){cout << "(" << e -> first << "," << e -> second << ")";}cout << "}" << endl;}
template<class T> void printans(vec<T> v){rep(i,0,sz(v)){cout << v[i] << (i == sz(v) - 1 ? "" : " ");}cout << endl;}


/* general_method */
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; }
template<class T>T cut(T &a, int l, int r){return T(a.begin()+l, a.begin()+r);}


/* math_method */
int ceil(int a, int b){return a / b + (a % b > 0);}


/* main */

int x, y, z, k;
vi a;
vi b;
vi c;
void in(){
    cin >> x >> y >> z >> k;
    rep(i,0,x) a.push_back(input());
    rep(i,0,y) b.push_back(input());
    rep(i,0,z) c.push_back(input());
}

void solve(){

    vi tmp;
    rep(i,0,x){
        rep(j,0,y) tmp.push_back(a[i] + b[j]);
    }

    sort(all(tmp));
    reverse(all(tmp));
    tmp = cut(tmp, 0, min(3001LL, sz(tmp)));

    vi ret;
    rep(i,0,sz(tmp)){
        rep(j,0,z) ret.push_back(tmp[i] + c[j]);
    }
    sort(all(ret));
    reverse(all(ret));
    rep(i,0,k){
        print(ret[i]);
    }

}

signed main(){

    cin.tie(0);
    ios::sync_with_stdio(false);
    in();
    solve();
    
}

Measured memory_bytes: 35128
N, T = map(int, input().split())
t = [int(i) for i in input().split()]

pre = 0
total = 0
for i in range(N):
    if t[i] - pre <= T:
        total += t[i] - pre
    else:
        total += T
    pre = t[i]
    
print(total+T)

Measured memory_bytes: 25200
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <complex>
#include <utility>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <tuple>
#include <cmath>
#include <bitset>
#include <cctype>
#include <set>
#include <map>
#include <unordered_map>
#include <numeric>
#include <functional>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long;
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; }
inline void Yes(bool condition){ if(condition) PRINT("Yes"); else PRINT("No"); }
template<class itr> void cins(itr first,itr last){
    for (auto i = first;i != last;i++){
        cin >> (*i);
    }
}
template<class itr> void array_output(itr start,itr goal){
    string ans = "",k = " ";
    for (auto i = start;i != goal;i++) ans += to_string(*i)+k;
    if (!ans.empty()) ans.pop_back();
    PRINT(ans);
}
ll gcd(ll a, ll b) {
    return a ? gcd(b%a,a) : b;
}
const ll INF = 1e15;
const ll MOD = 1000000007;
const ll MOD2 = 998244353;
typedef pair<ll,ll> P;
const ll MAX = 200010;
constexpr ll nx[8] = {1,0,-1,0,-1,-1,1,1};
constexpr ll ny[8] = {0,1,0,-1,-1,1,-1,1};
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    int a = s[s.length()-1]-'0';
    if (a == 2 || a == 4 || a == 5 || a == 7 || a == 9){
        PRINT("hon");
    }
    else if (a == 0 || a == 1 || a == 6 || a == 8){
        PRINT("pon");
    }
    else{
        PRINT("bon");
    }
}


Measured memory_bytes: 3648
#include <iostream>
#include <algorithm>
#include <math.h> 
#include <string>
#include <iomanip>
#include <vector>
#include <chrono>
#include <cstdlib>
#include <bitset>
using namespace std;

int main(){
    int n; 
    cin >> n;
    cout << n*n*n << endl;
}

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

int main(){
	string s;

	cin >> s;

	int answer_a = 0, answer_b = 0;
	int s_length = s.length();
	int i = 0;
	
	for (i = 0; i < s_length; i++){
		if ((i % 2 == 0 && s[i] == '0' )||( i % 2 == 1 && s[i] == '1')){
			answer_a++;
		}
		if ((i % 2 == 0 && s[i] == '1' )||( i % 2 == 1 && s[i] == '0')){
			answer_b++;
		}
	}

	if (answer_a < answer_b){
		cout << answer_a << endl;
	}
	else{
		cout << answer_b << endl;
	}

	return 0;
}

Measured memory_bytes: 512
h, w = map(int, input().split())
a = []
for i in range(h):
    a.append(list(map(int, input().split())))

ans = []
def operate(i, j, k, l):
    a[i][j] -= 1
    a[k][l] += 1
    ans.append([i+1, j+1, k+1, l+1])

for j in range(0, w):
    for i in range(0, h-1):
        if a[i][j]%2 == 1:
            operate(i, j, i+1, j)
for j in range(0, w-1):
    if a[h-1][j]%2 == 1:
       operate(h-1, j, h-1, j+1)

print(len(ans))
for i in ans:
    print("{} {} {} {}".format(i[0], i[1], i[2], i[3]))

Measured memory_bytes: 31800
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Scanner;
 
public class Main {    
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        Map<String , Integer> map = new HashMap<>();
        map.put("AC" , 0);
        map.put("WA" , 0);
        map.put("TLE" , 0);
        map.put("RE" , 0);
        for(int i =0;i<n;i++){
            String s = sc.next();
            switch(s){
                case "AC":
                    map.replace("AC", map.get("AC") + 1 );
                    break;
                    case "WA":
                    map.replace("WA", map.get("WA") + 1 );
                    break;
                    case "TLE":
                    map.replace("TLE", map.get("TLE") + 1 );
                    break;
                    case "RE":
                    map.replace("RE", map.get("RE") + 1 );
                    break;
            }
        }
        System.out.println("AC x " + map.get("AC"));
        System.out.println("WA x " + map.get("WA"));
        System.out.println("TLE x " + map.get("TLE"));
        System.out.println("RE x " + map.get("RE"));
    }
}



Measured memory_bytes: 58868
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
using namespace std;
typedef long long lng;
#define FOR(i,a,b) for(int i=(a); i<=(b); ++i)
#define FORD(i,b,a) for(int i=(b); i>=(a); --i)
#define REP(i,n) FOR(i,0,n-1)
#define ALL(a) (a).begin(), (a).end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end()) //NOTE: <a> must be sorted in advance

lng power(lng b, lng n) {lng sol=1; while(n>0) {if(n&1) {sol=sol*b;} n>>=1; b*= b;} return sol;} //calculate b^n

const int MOD = 1000000007; //10^9+7


/*********** variables ************/
int A, B;
/**********************************/

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> A >> B;

    cout <<(A+B)%24 << endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(){
	int i,a;

	scanf("%d",&a);

	int A[a+1];

	for(i=1; i<a+1; i++){
		scanf("%d",&A[i]);
	}

	for(i=1; i<a+1; i++){
		printf("node %d: key = %d, ",i,A[i]);
		if(i/2 > 0)
      printf("parent key = %d, ",A[i/2]);
		if(i*2 < a+1)
      printf("left key = %d, ",A[i*2]);
		if(i*2 + 1 < a+1)
      printf("right key = %d, ",A[i*2 + 1 ]);

		printf("\n");
	}

	return 0;
}



Measured memory_bytes: 2044
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>

#define CK(N, A, B) (A <= N && N < B)
#define REP(i, a, b) for (int i = a; i < b; i++)
#define RREP(i, a, b) for (int i = (b - 1); a <= i; i--)
#define F first
#define S second
#define ll long long

const int INF = 1e9;
const long long LLINF = 1e18;

using namespace std;

int dy[] = {0,1,0,-1};
int dx[] = {1,0,-1,0};
int dy8[] = {0,1,1,1,0,-1,-1,-1};
int dx8[] = {1,1,0,-1,-1,-1,0,1};

/*==================================================*/
/*variable*/

/*==================================================*/
/*function*/

/*==================================================*/

int main() {

    int a, b;
    int ans = 0;

    cin>>a>>b;

    for(int i = a; i <= b; i++){
        string s = to_string(i);

        bool f = true;
        REP(j,0,s.size()/2){
            if(s[j] != s[s.size() - 1 - j]){
                f = false;
                break;
            }
        }
        if(f) ans++;
    }

    cout<<ans<<endl;

    return 0;
}


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

using namespace std;

int main(void){
    int A[10] = {0};
    for(int i = 0; i < 4; i++){
        int N;
        cin >> N;
        A[N]++;
    }
    if(A[1] == 1 && A[4] == 1 && A[7] == 1 && A[9] == 1) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}

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

#define REP(i, x, n) for (int i = x; i < (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x.size())
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define uniq(x) x.erase(unique(x.begin(), x.end()), x.end())
#define F first
#define S second
#define mp make_pair
#define eb emplace_back
#define pii pair<int, int>
#define pll pair<ll, ll>

using namespace std;

typedef long long ll;

/* --- INFやMODの値が適切か確認する --- */
// const int INF = 1 << 30;
// const ll INF = 1LL << 60;
// const ll MOD = 1000000007;

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  map<int, int> idx;
  rep(i, n) {
    cin >> a[i];
    idx[a[i]] = i;
  }
  int ans = 0;
  sort(all(a));
  rep(i, n) {
    if (i % 2 != idx[a[i]] % 2) ans++;
  }
  ans /= 2;
  cout << ans << endl;
}


Measured memory_bytes: 5376
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const int INT_INF = 2147483647;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
typedef pair<int,int> P;

vector<int>dp(100005,1001001001);

int main(){
  int n,k;
  cin >> n >> k;
  int h[n];
  rep(i,n)cin >> h[i];
  dp[0]=0;
  rep(i,n){
    rep(j,k)if(i-j-1>=0)chmin(dp[i],dp[i-j-1]+abs(h[i]-h[i-j-1]));
  }
  cout << dp[n-1] << endl;
}


Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>


using namespace std;

typedef long long ll;

const ll INF = 1ll << 60;

int dp[60][10100][60] = { 0 };

int main(void){
	int n, d;

	cin >> n >> d;

	vector<vector<int>> x(n, vector<int>(d));

	for (int i = 0; i < n; i++){
		for (int j = 0; j < d; j++){
			cin >> x[i][j];
		}
	}

	int ans = 0;

	for (int i = 0; i < n; i++){
		for (int j = 0; j < n; j++){
			if (i >= j)continue;
			long double tmp = 0;
			for (int k = 0; k < d; k++){
				tmp += (x[i][k] - x[j][k]) * (x[i][k] - x[j][k]);
			}

			tmp = sqrt(tmp);
			if (floor(tmp) == ceil(tmp)){
				ans++;
			}
		}
	}

	cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
#define mx 100005
#define inf 1e18
using namespace std;
int arr[mx];
int n;
int dp[mx];
int dfs(int n){
	if(dp[n] != -1){
		return dp[n];
	}
	if(n <= 1){
		return 0;
	}
	int a = 0,b = inf;
	if(n-1 > 0)
	a = abs(arr[n] - arr[n-1]) + dfs(n-1);
	if(n-2 > 0)
	b = abs(arr[n] - arr[n-2]) + dfs(n-2);
	dp[n] = min(a,b);
	return min(a,b);	
}
signed main(){
	//freopen("input.txt","r",stdin);
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>arr[i];
	}
	memset(dp,-1,sizeof(dp));
	cout<<dfs(n);
}

Measured memory_bytes: 4992
#include <vector>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

#define REP(i,n)for (int i=0;i<(n);i++)
#define PB push_back
#define MP make_pair
#define ALL(a) (a).begin(),(a).end()
#define ll long long
using namespace std;

int main(){
	vector<int>v(3);
	REP(i,3)cin>>v[i];
	sort(ALL(v));
	if(v[0]+v[1]==v[2])cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}


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

public class Program
{
    #region Standard I/O
    readonly TextReader input;
    readonly TextWriter output;

    X[] ReadLine<X>(Func<string, X> func)
    {
        return input.ReadLine().Split(' ').Select(func).ToArray();
    }

    void WriteLineOne(object obj)
    {
        output.WriteLine("{0}", obj);
    }

    void WriteLineMany(params object[] objects)
    {
        output.WriteLine(string.Join(" ", objects.Select(obj => obj.ToString())));
    }
    #endregion

    int n;
    int[] ks;

    bool CanColorize(int count, int k)
    {
        return count <= 1 ? k == 0 : 1 <= k && k <= count / 2;
    }

    bool Solve()
    {
        var sorted = ks.OrderBy(k => k).ToArray();
        var d = sorted.Last() - sorted.First();

        if (d == 0)
        {
            if (sorted[0] == n - 1) return true;

            return CanColorize(n, sorted[0]);
        }
        else if (d == 1)
        {
            var minValue = sorted[0];
            var minValueCount = sorted.TakeWhile(k => k == minValue).Count();
            if (minValue < minValueCount) return false;

            var maxValue = sorted.Last();
            var maxValueCount = maxValue - minValueCount;
            return CanColorize(n - minValueCount, maxValueCount);
        }
        else
        {
            return false;
        }
    }

    public void Run()
    {
        n = ReadLine(int.Parse)[0];
        ks = ReadLine(int.Parse);
        WriteLineOne(Solve() ? "Yes" : "No");
    }

    public Program(TextReader input, TextWriter output)
    {
        this.input = input;
        this.output = output;
    }

    public static void Main(string[] args)
    {
        new Program(Console.In, Console.Out).Run();
    }
}


Measured memory_bytes: 23008
#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
using namespace std;
inline void rd(int &x){
  int k;
  int m=0;
  x=0;
  for(;;){
    k = getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
inline void wt_L(char a){
  putchar_unlocked(a);
}
inline void wt_L(int x){
  int s=0;
  int m=0;
  char f[10];
  if(x<0){
    m=1;
    x=-x;
  }
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  if(m){
    putchar_unlocked('-');
  }
  while(s--){
    putchar_unlocked(f[s]+'0');
  }
}
int N;
int K;
int S;
int A[100000];
int main(){
  int i;
  int d;
  rd(N);
  rd(K);
  rd(S);
  if(S==1000000000){
    d =1000000000-1;
  }
  else{
    d =1000000000;
  }
  for(i=(0);i<(N);i++){
    A[i] = d;
  }
  for(i=(0);i<(K);i++){
    A[i] = S;
  }
  {
    int cTE1_r3A;
    if(N==0){
      putchar_unlocked('\n');
    }
    else{
      for(cTE1_r3A=(0);cTE1_r3A<(N-1);cTE1_r3A++){
        wt_L(A[cTE1_r3A]);
        wt_L(' ');
      }
      wt_L(A[cTE1_r3A]);
      wt_L('\n');
    }
  }
  return 0;
}
// cLay varsion 20200116-1 [beta]

// --- original code ---
// int N, K, S;
// int A[1d5];
// {
//   int d;
//   rd(N,K,S);
//   d = if[S==1d9, 1d9-1, 1d9];
//   rep(i,N) A[i] = d;
//   rep(i,K) A[i] = S;
//   wt(A(N));
// }


Measured memory_bytes: 1664
#include <bits/stdc++.h>
#define LL long long
using namespace std;
const int N = 1e5 + 7;

LL a[N], b[N], c[N];
int f[N];
bool vis[N];

int main(){
	int n;
	scanf("%d", &n);
	for (int i = 1; i <= n; i++) scanf("%lld", &a[i]);
	for (int i = 2; i <= n; i++) b[i] = a[i] - a[i - 1];
	for (int i = 2; i <= n; i++) f[i] = i;
	int m; long long k;
	scanf("%d%lld", &m, &k);
	for (int i = 1; i <= m; i++){
		int x; scanf("%d", &x);
		swap(f[x], f[x + 1]);
	}
	for (int i = 2; i <= n; i++){
		if (!vis[i]){
			vector<int > v;
			int j = i;
			while (!vis[j]){
				v.push_back(j);
				vis[j] = true;
				j = f[j];
			}	
			int len = v.size(), p = k % len;
			for (int j = 0; j < len; j++){
				c[v[j]] = b[v[(j + p) % len]];
			}
		}
	}
	LL t = a[1];
	for (int i = 2; i <= n; i++){
		t += c[i];
		a[i] = t;
	}
	for (int i = 1; i <= n; i++) printf("%lld ", a[i]);

	return 0;
}

Measured memory_bytes: 4208
#n, m, q = map(int, input().split())
#List = list(map(int, input().split()))
#req = [list(map(int, input().split())) for _ in range(q)]
#t = t[:-1]
#print(ans[j], end = "") 改行無しで出力
#[0]*n
List = list(map(int, input().split()))

for i in range(5):
    if List[i] == 0:
        ans = i+1

print(ans)


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

#define fi first
#define se second

const int N = 200200;
const int mod = 1e9 + 7;

using namespace std;

int main()
{
        ios_base::sync_with_stdio(0);

        //freopen("input.txt", "r", stdin);
        //freopen("output.txt", "w", stdout);

        int n;
        cin >> n;
        int bal = 0;
        int shit = 0;
        for(int i = 1; i <= n; i++){
                int x;
                cin >> x;
                if(x % 2){
                        bal -= 1;
                } else if(x % 4 == 0){
                        bal += 1;
                } else{
                        shit = 1;
                }
        }
        bal -= shit;
        if(bal < -1){
                cout << "No" << "\n";
        } else{
                cout << "Yes" << "\n";
        }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,k,r,s,p,ans=0;
  char c='a';
  string t;
  cin>>n>>k>>r>>s>>p>>t;
  for(int i=0;i<t.size();i++){
    if(i>=k)c=t[i-k];
    if(c==t[i]){
      t[i]='a';
      continue;
    }
    if(t[i]=='r'){
      ans+=p;
    }
    if(t[i]=='s'){
      ans+=r;
    }
    if(t[i]=='p'){
      ans+=s;
    }
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 512
N=int(input())
X=list(map(int,input().split()))

for i in range(100):
    L0=0
    for ii in range(N):
        L0+=(i+1-X[ii])**2
    
    if i==0:
        L=L0
    else:
        L=min(L,L0)
print(L)

Measured memory_bytes: 2940
import java.util.Scanner;

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

		int n = stdIn.nextInt();
		int min = stdIn.nextInt();
		int max = stdIn.nextInt();

		if(extracted(n, min, max)) {
			System.out.println("OK");
		} else {

			System.out.println("NG");
		}



		stdIn.close();
	}

	private static boolean extracted(int n, int min, int max) {
		for (int i = min; i <= max; i++) {
			if(i % n == 0) {
				return true;
			}
		}

		return false;
	}
}


Measured memory_bytes: 35696
#include <algorithm>
#include <deque>
#include <iostream>
#include <string>

using namespace std;

class Process {
public:
  Process(string name, int time) : name_(name), time_(time) {}
  int getTime() { return time_; }
  string getName() { return name_; }
  void run(int q) { time_ -= q; }

 private:
  string name_;
  int time_;
};
int main(int argc, char *argv[]) {
  int n, q;
  cin >> n >> q;

  deque<Process> queue;

  for (int i = 0; i < n; ++i) {
    string name;
    int time;
    cin >> name >> time;
    Process proc{name, time};
    queue.push_back(proc);
  }

  int current = 0;
  while (!queue.empty()) {
    Process &active = queue.front();
    if (active.getTime() <= q) { // done
      current += active.getTime();
      cout << active.getName() << " " << current << endl;
      queue.pop_front();
    } else {
      current += q;
      active.run(q);
      queue.push_back(active);
      queue.pop_front();
    }
  }

  return 0;
}



Measured memory_bytes: 6220
//宝くじチェッカー
#include <iostream>

using namespace std;

bool LotCheck(char* TousenNum, char* LotNum){//当選番号,宝くじ番号(8桁)
	for (int i = 0; i < 8; ++i){
		if (TousenNum[i] != '*' && TousenNum[i] != LotNum[i]){
			return false;
		}
	}
	return true;
}

int main(){
	int TousenNNum;//当選番号の数
	int LotNNum;//宝くじ番号の枚数
	char** TousenNum;//当選番号
	int* TousenMoney;//当選金額
	char** LotNum;//宝くじ番号
	while(1){
		cin >> TousenNNum; cin >> LotNNum;
		if (TousenNNum == 0)break;

		TousenNum = new char*[TousenNNum];//当選番号データ入力
		for (int i = 0; i < TousenNNum; ++i){
			TousenNum[i] = new char[9];
		}
		TousenMoney = new int[TousenNNum];
		for (int i = 0; i < TousenNNum; ++i){
			cin >> TousenNum[i];
			cin >> TousenMoney[i];
		}

		LotNum = new char*[LotNNum];//宝くじ番号データ入力
		for (int i = 0; i < LotNNum; ++i){
			LotNum[i] = new char[9];
		}
		for (int i = 0; i < LotNNum; ++i){
			cin >> LotNum[i];
		}

		int TotalMoney = 0;
		for (int i = 0; i < LotNNum; ++i){//判定(総当たり？)
			for (int j = 0; j < TousenNNum; ++j){
				if (LotCheck(TousenNum[j], LotNum[i])){
					TotalMoney += TousenMoney[j];
				}
			}
		}

		cout << TotalMoney << endl;

		for (int i = 0; i < TousenNNum; ++i){
			delete[] TousenNum[i];
		}
		delete[] TousenNum;

		for (int i = 0; i < LotNNum; ++i){
			delete[] LotNum[i];
		}
		delete[] LotNum;

		delete[] TousenMoney;
	}

	return 0;
}

Measured memory_bytes: 1236
#include <iostream>
#include <vector>
#include <unordered_set>
#include <string>
#include <algorithm>
#include <sstream>

using namespace std;

using ll = long long;

int ctoi(char c)
{
	if (c >= '0' && c <= '9')
	{
		return c - '0';
	}
	return 0;
}

void dfs(string num, ll &sum, ll currentSum, ll prev, int pos, int len)
{
	if (pos == len)
	{
		currentSum += prev;
		sum += currentSum;
		return;
	}

	// refreshする
	if (prev != 0)
	{
		dfs(num, sum, currentSum + prev, ctoi(num[pos]), pos + 1, len);
	}

	// refreshしない
	dfs(num, sum, currentSum, prev * 10 + ctoi(num[pos]), pos + 1, len);
}

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

	ll ans = 0;
	dfs(s, ans, 0, 0, 0, s.length());
	cout << ans << endl;
}

Measured memory_bytes: 256
/*
* @Author: kabbo
* @Date:   2020-04-19 20:44:15
* @Last Modified by:   kabbo
* @Last Modified time: 2020-04-19 20:47:37
*/
#include<bits/stdc++.h>
using namespace std;
#define mem(x,y) memset(x,y,sizeof(x));
#define eps 1e-9
#define pii pair<int,int>
#define sdi(x) scanf("%d",&x)
#define sdii(x,y) scanf("%d%d",&x,&y)
#define endl '\n'
#define ull unsigned long long
#define ll long long
const int mod=1e9+7;
using u64 = uint64_t;
using u128=__uint128_t;
const double pi=acos(-1);
void solve(){
   double r;
   cin>>r;
   double ans=(2.0*r*pi);
   cout<<fixed<<setprecision(3)<<ans<<endl;
}
int main(){
	
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	/*int t;
	cin>>t;
	for(int i(1);i<=t;++i){
	  printf("Case %d: ",i);*/
	  solve();
	//}
	#ifndef LOCAL_DEFINE
	  cerr<< "Time elapsed: "<<1.0*clock()/CLOCKS_PER_SEC <<"s.\n";
	#endif
	return 0;
}

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

int main() {
	int a, b;
	cin >> a >> b;
	if (a > 0) {
		cout << "Positive" << endl;
	}
	else if (a <= 0 && b >= 0) {
		cout << "Zero" << endl;
	}
	else if(b < 0 && (b - a) % 2 != 0)
		cout << "Positive" << endl;
	else {
		cout << "Negative" << endl;
	}
}

Measured memory_bytes: 3592
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline
inpl = lambda: list(map(int,input().split()))
N, Q = inpl()
neighbor = [[] for i in range(N)]
for i in range(N-1):
    a, b = inpl()
    a -= 1
    b -= 1
    neighbor[a].append(b)
    neighbor[b].append(a)
X = [0] * N
for _ in range(Q):
    p, x = inpl()
    X[p-1] += x

result = [0] * N
result[0] = X[0]
visited = [False] * N
dfs_stack = [0]
while dfs_stack:
    node = dfs_stack.pop()
    visited[node] = True
    for c in neighbor[node]:
        if visited[c]:
            continue
        else:
            dfs_stack.append(c)
            result[c] = result[node] + X[c]

print(' '.join(map(str,result)))

Measured memory_bytes: 82564
import java.util.*;
import java.io.*;

class Main {
	private static Integer MOD = (int)1e9+7;

	private static Integer findTotalPaths(String []grid, int H, int W) {
		int [][]dp = new int[H+1][W+1];

		for(int i=0; i <= H; ++i)
			Arrays.fill(dp[i], 0);

		for(int i=1; i <= H; ++i)
			for(int j=1; j <= W; ++j) {
				if (i == 1 && j == 1)
					dp[i][j] = 1;

				else if (grid[i-1].charAt(j-1) == '.') {
					dp[i][j] = (dp[i-1][j]%MOD + dp[i][j-1]%MOD)%MOD;
				}
			}
		return dp[H][W]%MOD;
	}

	public static void main(String[] args) throws Exception{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        
        String []s = br.readLine().split(" ");


        int H = Integer.parseInt(s[0]);
        int W = Integer.parseInt(s[1]);

		String []grid = new String[H];

		for(int i=0; i < H; ++i)
			grid[i] = br.readLine();

		System.out.println(findTotalPaths(grid, H, W));
    }
}

Measured memory_bytes: 31032
#include <cstdio>

#include <cmath>

#include <cstring>

#include <iostream>

#include <algorithm>

#include <queue>

#include <vector>

#include <map>



using namespace std;



typedef long long LL;


char s[300005];
int a[300005],sum[300005];
struct Node
{
	int x1,x2,bj;
}tree[3000005];
int n,m,ans,x;
void build(int x,int l,int r)
{
	tree[x].bj=0;tree[x].x1=19950920;tree[x].x2=19950920;
	if (l==r)
	{
		if (a[l]==-1) tree[x].x1=l;
		else tree[x].x1=19950920;
		tree[x].x2=sum[l];
		return;
	}
	int mid=(l+r)/2;
	build(x*2,l,mid);
	build(x*2+1,mid+1,r);
	tree[x].x2=min(tree[x*2].x2,tree[x*2+1].x2);
	tree[x].x1=min(tree[x*2].x1,tree[x*2+1].x1);
}

void change(int x,int l,int r,int ll,int rr,int w)
{
	if (l==ll&&rr==r)
	{
		tree[x].x2+=w;
		tree[x].bj+=w;
		return;
	}
	int mid=(l+r)/2;
	if (tree[x].bj!=0)
	{
		tree[x*2].x2+=tree[x].bj;tree[x*2].bj+=tree[x].bj;
		tree[x*2+1].x2+=tree[x].bj;tree[x*2+1].bj+=tree[x].bj;
		tree[x].bj=0;
	}
	if (rr<=mid) change(x*2,l,mid,ll,rr,w);
	else if (ll>=mid+1) change(x*2+1,mid+1,r,ll,rr,w);
	else 
	{
		change(x*2,l,mid,ll,mid,w);
		change(x*2+1,mid+1,r,mid+1,rr,w);
	}
	tree[x].x2=min(tree[x*2].x2,tree[x*2+1].x2);
	tree[x].x1=min(tree[x*2].x1,tree[x*2+1].x1);
}
int query(int x,int l,int r)
{
	if (l==r) return l;
	int mid=(l+r)/2;
	if (tree[x].bj!=0)
	{
		tree[x*2].x2+=tree[x].bj;tree[x*2].bj+=tree[x].bj;
		tree[x*2+1].x2+=tree[x].bj;tree[x*2+1].bj+=tree[x].bj;
		tree[x].bj=0;
	}
	if (tree[x*2+1].x2<2) return query(x*2+1,mid+1,r);
	else return query(x*2,l,mid);
}
void change2(int x,int l,int r,int pos)
{
	if (l==r)
	{
		if (a[l]==-1) tree[x].x1=l;
		else tree[x].x1=19950920;
		return;
	}
	int mid=(l+r)/2;
	if (pos<=mid) change2(x*2,l,mid,pos);
	else change2(x*2+1,mid+1,r,pos);
	tree[x].x1=min(tree[x*2].x1,tree[x*2+1].x1);
}

int main()

{
	scanf("%d%d",&n,&m);
	scanf("%s",s+1);
	for (int i=1;i<=n;++i) 
	{
		if (s[i]=='(') a[i]=1;
		else a[i]=-1;
	}
	sum[0]=0;
	for (int i=1;i<=n;++i) sum[i]=sum[i-1]+a[i];
	build(1,1,n);
	for (int i=1;i<=m;++i)
	{
		scanf("%d",&x);
		if (a[x]==1)
		{
			change(1,1,n,x,n,-2);
			a[x]=-a[x];
			change2(1,1,n,x);
			ans=tree[1].x1;
			change(1,1,n,ans,n,+2);
			a[ans]=-a[ans];
			change2(1,1,n,ans);
		}
		else
		{
			change(1,1,n,x,n,+2);
			a[x]=-a[x];
			change2(1,1,n,x);
			ans=query(1,1,n)+1;
			change(1,1,n,ans,n,-2);
			a[ans]=-a[ans];
			change2(1,1,n,ans);
		}
		printf("%d\n",ans);
		//for (int j=1;j<=n;++j) if (a[j]==1) cout<<"(";
		//else cout<<")";
		//cout<<endl;
	}

	return 0;

}

Measured memory_bytes: 18504
#include <cstdio>
#include <algorithm>

using namespace std;

typedef long long ll;

#define REP(i, n) for(int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)

ll const INF = 1000000000000000000;
int const N_MAX = 100;

int N;

int A[2][N_MAX + 1];
int C[2][N_MAX + 1];

int main() {
  scanf("%d", &N);

  REP(i, N) {
    scanf("%d", &A[0][i]);
  }
  REP(i, N) {
    scanf("%d", &A[1][i]);
  }

  C[0][0] = A[0][0];
  C[1][0] = C[0][0] + A[1][0];
  FOR(i, 1, N) {
    C[0][i] = A[0][i] + C[0][i - 1];
    C[1][i] = A[1][i] + max(C[0][i], C[1][i - 1]);
  }
  printf("%d\n", C[1][N - 1]);
}


Measured memory_bytes: 128
#pragma warning(disable : 4996)
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
#define dup(x) x.erase(unique(x.begin(), x.end()),x.end())
typedef long long int ll;
typedef unsigned long long int ull;
using namespace std;
// https://atcoder.jp/contests/abc171/tasks/abc171_f
ll mod = 1e9+7;
ll fac[2000001], inv[2000001];
ll power(ll x, ll y) {
    ll r = 1;
    while (y) {
        if (y & 1)
            r = (r * x) % mod;
        x = (x * x) % mod;
        y >>= 1;
    }
    return r;
}
ll C(int n, int k) {
    if (k < 0 || k > n)
        return 0;
    return ((fac[n] * inv[k]) % mod * inv[n - k]) % mod;
}
int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    ll ans = 0;
    ll k;
    string s;
    cin >> k >> s;
    fac[0] = 1;
    for (int i = 1; i < 2000001; i++)
        fac[i] = fac[i - 1] * i % mod;
    inv[2000001 - 1] = power(fac[2000001 - 1], mod - 2);
    for (int i = 2000001 - 1; i > 0; i--) {
        inv[i - 1] = inv[i] * (i) % mod;
    }
    ll n = s.length();
    for (int i = n; i <= k + n; i++) {
        ans = (ans + C(k + n, i) * power(25, k + n - i)) % mod;
    }

    cout << ans;

	return 0;
}


Measured memory_bytes: 35648
#include<iostream>
#include<cstring>
#include<algorithm>

using namespace std;

int main()
{
	int a,b;
	cin >> a >> b;
	if(b>=a)
	{
		cout <<"unsafe"<<endl;
	}
	else
	{
		cout << "safe"<<endl;
	}
	return 0;
 } 

Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define vi vector<int>
#define vv vector<vi>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int> >
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define INF 100000000000
#define eps 1e-7
#define mod 1000000007
#define int ll
using namespace std;
pi island[100000];
int N, M;
int ans = 0;

signed main(void) {
    cin >> N >> M;

    rep(i,M){
        int a, b;
        cin >> a >> b;
        island[i].first = b;
        island[i].second = a;
    }

    sort(island, island+M);

//    rep(i, M){
//        cout << island[i].first << endl;
//    }

    int now=0;
    rep(i,M){
        if(island[i].second > now){
            ans++;
            now = island[i].first - 1;
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1792
#include<iostream>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<string>
#define LL long long
#define maxn 100010
using namespace std;
string a,b;
int main()
{
    char x;
    int i,l,r;
    a="10";
    int sum=0;
    int di=0;
    do
    {
        di++;
        cout<<"? "<<a<<endl;
        cin>>x;
        a+='0';
    }while (x=='Y'&&di<=9);
    if (di==10)
    {
        di=1;
        a='2';
        cout<<"? "<<a<<endl;
        cin>>x;
        if (x=='Y')
        {
            cout<<"! 1"<<endl;
            return 0;
        }
        a+='2';
        do
        {
            di++;
            cout<<"? "<<a<<endl;
            cin>>x;
            a+='2';
        }while (x=='N');
    }
    for (i=0;i<di-1;i++)
    {
        l=0,r=9;
        b+='0';
        while(l<r)
        {
            int mid=(l+r)/2+1;
            b[i]=mid+'0';
            cout<<"? "<<b<<endl;
            cin>>x;
            sum++;
            if (x=='Y') l=mid;
            else r=mid-1;
        }
        b[i]=l+'0';
    }
    b+='0';
    a=b;
    a+='0';
    r=9;
    if (di==1) l=1;
    else l=0;
    while (l<r)
    {
        int mid=(l+r)/2;
        a[di-1]=mid+'0';
        cout<<"? "<<a<<endl;
        cin>>x;
        sum++;
        if (x=='Y') r=mid;
        else l=mid+1;
    }
    b[di-1]=l+'0';
    /*for (;i<=9;i++)
      {
      a[di-1]=i+'0';
      cout<<"? "<<a<<endl;
      cin>>x;
      sum++;
      if (x=='Y') break;
      }
      b[di-1]=i+'0';*/
    cout<<"! "<<b<<endl;
}


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

int main(void) {
    char c;
    cin >> c;
    if (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u') cout << "vowel" << endl;
    else cout << "consonant" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define PER(i, a, b) for(ll i=(a); i>=(b); i--)
#define rep(i, n) REP(i, 0, n)
#define per(i, n) PER(i, n, 0)
#define ALL(a)  (a).begin(),(a).end()
const ll INF = 1e18+18;
const ll MAX = 200000;
const ll MOD = 1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;
static const double pi = 3.141592653589793;



int main(){
    ll N;
    cin>>N;
    vector<ll> A(N);
    ll Sum=0;
    rep(i, N){
        cin>>A[i];
        if(i==0){
            Sum+=abs(A[i]);
        }
        else{
            Sum+=abs(A[i]-A[i-1]);
        }
    }
    Sum+=abs(A[N-1]);
    cout<<Sum-abs(A[0])-abs(A[1]-A[0])+abs(A[1])<<endl;
    rep(i, N-2){
        cout<<Sum-abs(A[i+1]-A[i])-abs(A[i+2]-A[i+1])+abs(A[i]-A[i+2])<<endl;
    }
    cout<<Sum-abs(A[N-1])-abs(A[N-1]-A[N-2])+abs(A[N-2])<<endl;
}

Measured memory_bytes: 2048
s = input()

odd = ['R','U','D']
even = ['L','U','D']

judge = True

for i in range(len(s)):
    if i%2 == 0:
        if s[i] in odd:
            pass
        else:
            judge = False
    
    else:
        if s[i] in even:
            pass
        else:
            judge = False


if judge:
    print("Yes")

else:
    print("No")







Measured memory_bytes: 3060
/*!enjoy karo yaar!*/

//CF,CC,AtC,SPOJ: hp1999
//HE: hemant269
//HR: hemant2132

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

/*-----<Defines>-----*/
#define     int             long long int
#define     fast()          ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define     all(x)          begin(x),end(x)
#define     rz(x)           resize(x)
#define     asn(x,y)        assign(x,y)
#define     mem(a,b)        memset(a,b,sizeof(a))
#define     sz(x)           ((int)size(x))
#define     eb              emplace_back
#define     pb              push_back
#define     pf              push_front
#define     pob             pop_back
#define     pof             pop_front
#define     ins             insert
#define     vi              vector<int>
#define     pii             pair<int,int>
#define     mii             map<int,int>
#define     F               first
#define     S               second
#define     remax(a,b)      a=max(a,b)
#define     remin(a,b)      a=min(a,b)
#define     bitcount(x)     __builtin_popcountll(x)
#define     iceil(n,x)      (((n)-1)/(x)+1)
#define     flush           fflush(stdout)

using ull=unsigned long long;
using ll=long long;
using ld=long double;
/*-----</Defines>-----*/

/*-----<Debugging Stuff>-----*/
string to_string(char s)
{   string res="'''";res[1]=s;return res; }

string to_string(string s)
{   return '"'+s+'"'; }

string to_string(const char* s)
{   return to_string((string)s); }

string to_string(bool b)
{   return (b?"true":"false"); }

template<typename A, typename B>
string to_string(pair<A, B> p)
{   return "("+to_string(p.F)+", "+to_string(p.S)+")"; }

template<typename A>
string to_string(A v)
{
    bool first=1; string res="{";
    for(const auto &x:v)
    {
        if(!first)  res+=", ";
        first=0;
        res+=to_string(x);
    }
    res+="}";
    return res;
}

void debug() { cout<<"\n"; }
template<typename Head, typename... Tail>
void debug(Head H, Tail... T)
{
    cout<<" "<<to_string(H);
    debug(T...);
}

#define show(...) cout << "[" << #__VA_ARGS__ << "]:", debug(__VA_ARGS__)
/*-----</Debugging Stuff>-----*/

/*-----<Mod Operations>-----*/
const int M=1e9+7;
inline int add(int a,int b,int p=M){ a=a+b; if(a>=p) a-=p; return a; }
inline int sub(int a,int b,int p=M){ a=a-b; if(a<0) a+=p; return a; }
inline int mul(int a,int b,int p=M){ a=(a*1ll*b)%p; return a; }
/*-----</Mod Operations>-----*/

/*-----<Constants>-----*/
const ld pi=acos(-1),eps=1e-9;
const ll inf=1e18;
const int N=1;
/*-----</Constants>-----*/

void solve()
{
    int n,x,t;
    cin>>n>>x>>t;

    int req=iceil(n,x);
    int ans=req*t;
    cout<<ans;
}

int32_t main()
{
    fast();

    int t=1;
    //cin>>t;
    for(int z=1;z<=t;++z)
    {
        solve();
        //cout<<"\n";
    }

    return 0;
}




Measured memory_bytes: 3640
from math import radians, sqrt, sin, cos
a, b, C = map(float, input().split())
print(a * b * sin(radians(C)) / 2)
print(a + b + sqrt(a ** 2 + b ** 2 - 2 * a * b * cos(radians(C))))
print(b * sin(radians(C)))



Measured memory_bytes: 5688
#include <bits/stdc++.h>
#define ll long long
#define double long double
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mod (ll)(1e9+7)
#define inf (ll)(3e18+7)
#define pi (double) acos(-1)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
using namespace std;

int main() {
    string s;
    int n, k, c, sa = 0;
    cin >> n >> k >> c >> s;
    vector<int> a(n, -1), b(n, -1);
    while(s[sa] == 'x')sa++; 
    a[sa] = 1;
    int cnt = 0, sum = 1;
    for(int i = sa+1; i < n; i++){
        if(sum >= k)break;
        if(cnt >= c && s[i] == 'o'){
            sum++;
            a[i] = sum;
            cnt = 0; 
        }
        else cnt++;
    }
    cnt = 0; sum = 1;
    int sb = 0;
    reverse(all(s));
    while(s[sb] == 'x')sb++; 
    b[sb] = k;
    for(int i = sb+1; i < n; i++){
        if(sum >= k)break;
        if(cnt >= c && s[i] == 'o'){
            sum++;
            b[i] = k-sum+1;
            cnt = 0;
        }
        else cnt++;
    }
    reverse(all(b));
    rep(i, n)if(a[i] == b[i] && a[i] != -1)cout << i+1 << endl;
}

Measured memory_bytes: 5240
# -*- coding: utf-8 -*-
"""
Created on Sat Apr 13 21:30:35 2019

@author: yuta
"""
from collections import Counter
S = input()

def main(s):
    moji = list(s)
    first = moji[0:len(moji):2]
    second = moji[1:len(moji):2]
    
    x = Counter(first)
    y = Counter(second)
    
    x_count0 = x['0']
    x_count1 = x['1']
    y_count0 = y['0']
    y_count1 = y['1']
    
    count = min(x_count0 + y_count1,x_count1 + y_count0)
    print(count)
main(S)

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

#ifdef DEBUG
#include <Mylib/Debug/debug.cpp>
#else
#define dump(...) ((void)0)
#endif

template <typename T, typename U>
bool chmin(T &a, const U &b){
  return (a > b ? a = b, true : false);
}

template <typename T, typename U>
bool chmax(T &a, const U &b){
  return (a < b ? a = b, true : false);
}

template <typename T, size_t N, typename U>
void fill_array(T (&a)[N], const U &v){
  std::fill((U*)a, (U*)(a + N), v);
}

template <typename T>
auto make_vector(int n, int m, const T &value){
  return std::vector<std::vector<T>>(n, std::vector<T>(m, value));
}

template <typename T>
std::ostream& operator<<(std::ostream &s, const std::vector<T> &a){
  for(auto it = a.begin(); it != a.end(); ++it){
    if(it != a.begin()) s << " ";
    s << *it;
  }
  return s;
}

template <typename T>
std::istream& operator>>(std::istream &s, std::vector<T> &a){
  for(auto &x : a) s >> x;
  return s;
}

/**
 * @title Prime factorization (Precalculation)
 * @docs prime_factorize_precalculated.md
 */
struct PrimeFactorize{
  std::vector<int> p;

  PrimeFactorize(int N): p(N+1){
    for(int i = 2; i <= N; ++i){
      if(p[i] != 0) continue;
      for(int j = i; j <= N; j += i){
        if(p[j] == 0) p[j] = i;
      }
    }
  }

  auto factorize(int N){
    std::vector<int64_t> ret;

    while(N > 1){
      ret.push_back(p[N]);
      N /= p[N];
    }

    return ret;
  }
};


namespace solver{
  void init(){
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(12);
    std::cerr << std::fixed << std::setprecision(12);
    std::cin.exceptions(std::ios_base::failbit);
  }

  constexpr int MAX = 1000000;
  
  void solve(){
    int N; std::cin >> N;
    std::vector<int> A(N); std::cin >> A;

    std::vector<bool> check(MAX + 1);
    PrimeFactorize p(MAX);

    bool pairwise = true;
    for(auto x : A){
      auto fs = p.factorize(x);
      //dump(fs);
      fs.erase(std::unique(fs.begin(), fs.end()), fs.end());
      for(auto f : fs){
        if(check[f]){
          pairwise = false;
          break;
        }
        check[f] = true;
      }
    }

    if(pairwise){
      std::cout << "pairwise coprime" << "\n";
      return;
    }


    int g = 0;
    for(auto x : A){
      g = std::gcd(g, x);
    }

    if(g == 1){
      std::cout << "setwise coprime" << "\n";
      return;
    }

    std::cout << "not coprime" << "\n";
  }
}

int main(){
  solver::init();
  while(true){
    try{
      solver::solve();
    }catch(const std::istream::failure &e){
      break;
    }
  }
  return 0;
}


Measured memory_bytes: 11124
import itertools as it

N = int(input())
P = [int(i) for i in input().split()]
Q = [int(i) for i in input().split()]
a, b = 0, 0
count = 0
for perm in it.permutations(range(1, N + 1)):
    count += 1
    if list(perm) == P:
        a = count
    if list(perm) == Q:
        b = count
print(abs(a - b))


Measured memory_bytes: 3060
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include<bits/stdc++.h>
using namespace std;
using namespace __gnu_pbds;
#define ll long long
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define sz(v) ((ll)v.size())
#define mp make_pair
#define all(a) a.begin(),a.end()
#define F first
#define S second
#define pii pair<ll,ll> 
const ll mod = 1000000007;
const ll mod1= 1000000009;
const ll base= 2323233;
const ll base1=3424424;
#define MAXN 2000002
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
ll arr[20002];
int main() {
   ios::sync_with_stdio(0);
   cin.tie(0);
   cout.tie(0);
   ll n;
   cin>>n;
   cout<<(n*(n-1))/2;
 }

Measured memory_bytes: 764
import java.util.*;
import java.io.*;

import static java.lang.Character.isUpperCase;

public class Main {

    public static void main(String[] args) {

        Scanner in = new Scanner(System.in);
        int N = in.nextInt();
        String S = in.next();
        String T = in.next();
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i<N; i++)
        {
            sb.append(S.charAt(i));
            sb.append(T.charAt(i));
        }
        System.out.println(sb);




    }

}
















Measured memory_bytes: 35580
#include <bits/stdc++.h>
using namespace std;
#define ll unsigned long long 
#define mod 1000000007
#define pb push_back
#define ff first 
#define ss second  
typedef pair<int,int> pp;
bool com(pp x,pp y){
    return x.ff<y.ff;
} 
vector<ll> dp(1e7+9,1),ans(1e7+9,0);
void solve(){
    for(int i=2;(long long)i<=1e7+8;i++){
        for(int j=i;j<=1e7+8;j+=i){
            dp[j]++;
        }
    }
    for(ll i=1;i<=1e7+7;i++){
        ans[i]=(long long)((long long)ans[i-1]+(long long)((long long)i*(long long)dp[i]));
    }
}
int main() {
	// your code goes here
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);  
    solve();
    ll n;
    cin>>n;
    cout<<ans[n];
}


Measured memory_bytes: 159360