akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
//#include <iomanip>
//#include <string>
//#include <vector>
//#include <algorithm>
//#include <utility>
#include <set>
//#include <map>
//#include <queue>
//#include <deque>
//#include <bitset>
//#include <math.h>
using namespace std ;
using ll = long long ;
//using ld = long double ;
//using vll = vector<ll> ;
//using vvll = vector<vll> ;
//using vc = vector<char> ;
//using vvc = vector<vc> ;
//using vb = vector<bool> ;
//using vvb = vector<vb> ;
//using pll = pair<ll,ll> ;
//#define all(v) v.begin(),v.end()
//ll mod = 1000000007 ;
//long double pie = acos(-1) ;
//ll INF = 1000000000000 ;

//void yorn(bool a){if(a) cout << "Yes" << endl ; else cout << "No" << endl ;}
//void YorN(bool a){if(a) cout << "YES" << endl ; else cout << "NO" << endl ;}
//ll gcd(long long a,long long b){if(b==0) return a ; return gcd(b,a%b) ;}
//ll lcm(long long a,long long b){return a/gcd(a,b)*b ;}
//ll sa(long long a,long long b){if(a>b) return a-b ; return b-a ;}
//void mysort(vector<long long> &a){sort(a.begin(),a.end()) ;}
//void myrev(vector<long long> &a){reverse(a.begin(),a.end()) ;}
//void fix_cout(){cout << fixed << setprecision(20) ;}

int main(){
	ll n ; cin >> n ;
	char c ;
	set<char> s ;
	for(int i=0;i<n;i++){
		cin >> c ;
		s.insert(c) ;
	}
	cout << (s.size()==3?"Three":"Four") << endl ;
}


Measured memory_bytes: 256
#include <stdio.h>

int c(int n)
{
	int d,s=0;
	while(n){
		d=n%10;
		s=s+d;
		n=n/10;
	}
	return s;
}

int main(void)
{
	int n,a,b,i,d,z=0;
	scanf("%d%d%d",&n,&a,&b);
	for(i=1; i<=n; i++){
		d=c(i);
		if(a<=d && b>=d){
			z=z+i;
		}
	}
	printf("%d\n",z);
	return 0;
}

Measured memory_bytes: 128
n = int(input())
xl = [list(map(int, input().split())) for _ in range(n)]
ran = [[xl[i][0]-xl[i][1], xl[i][0]+xl[i][1]] for i in range(n)]
ran = sorted(ran, key=lambda x:x[1])
ans = n
right = ran[0][1]
for i in range(1, n):
  l, r = ran[i]
  if l < right:
    ans -= 1 
  else:
    right = r 
 
print(ans)

Measured memory_bytes: 43620
A = int(input())
B = int(input())
C = int(input())
X = int(input())

count = 0

for a in range(A+1):
  for b in range(B+1):
    for c in range(C+1):
      if (10*a+2*b+c == int(X/50)):
        count +=1

print(count)



Measured memory_bytes: 3060
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;


int main() {
  int a,b;
  cin>>a>>b;
  if(a%2==0||b%2==0)
  {
  	cout<<"Even";
  }
  else
  cout<<"Odd";  /* Enter your code here. Read input from STDIN. Print output to STDOUT */
    return 0;
}


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

int main() {
    int n;
    cin >> n;
    vector<pair<int, int>> red(n), blue(n);
    for(int i = 0; i < n; i++)
    {
        cin >> red.at(i).first >> red.at(i).second;
    }
    for(int i = 0; i < n; i++)
    {
        cin >> blue.at(i).first >> blue.at(i).second;
    }
    
    sort(blue.begin(), blue.end());
    
    vector<bool> is_used(n, false);
    int ans = 0;
    for(int b = 0; b < n; b++)
    {
        int highest = -1;
        int index_r = -1;
        for(int r = 0; r < n; r++)
        {
            if (blue.at(b).first > red.at(r).first && blue.at(b).second > red.at(r).second) {
                if (is_used.at(r)) continue;

                if (highest < red.at(r).second) {
                    highest = red.at(r).second;
                    index_r = r;
                }
            }
        }
        
        if (highest == -1) continue;

        is_used.at(index_r) = true;
        ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<random>
#include<array>
#include<cassert>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())


int n;
int a[20000];

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin >> n;
	rep(i,n) {
		int p;
		cin >> p;
		p--;
		a[p] = 20000 * (p + 1) + i;
	}
	rep(i, n) {
		if (i)cout << ' ';
		cout << a[i];
	}
	cout << endl;
	rep(i, n) {
		if (i)cout << ' ';
		cout << (n - i)* 20000;
	}
	cout << endl;

	return 0;
}

Measured memory_bytes: 768
// 2014/08/01 Tazoe

#include <iostream>
#include <cmath>
#include <algorithm>
using namespace std;

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

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

	int y[100];
	for(int i=0; i<n; i++){
		cin >> y[i];
	}

	double f[100];
	for(int i=0; i<n; i++){
		f[i] = fabs((double)x[i]-(double)y[i]);
	}

	double sum = 0.0;
	for(int i=0; i<n; i++){
		sum += f[i];
	}
	double d = sum;

	cout.precision(6);
	cout << fixed << d << endl;

	sum = 0.0;
	for(int i=0; i<n; i++){
		sum += (f[i]*f[i]);
	}
	d = sqrt(sum);

	cout << fixed << d << endl;

	sum = 0.0;
	for(int i=0; i<n; i++){
		sum += (f[i]*f[i]*f[i]);
	}
	d = pow(sum, 1.0/3.0);

	cout << fixed << d << endl;

	d = f[0];
	for(int i=1; i<n; i++){
		d = max(d, f[i]);
	}

	cout << fixed << d << endl;

	return 0;
}

Measured memory_bytes: 1280
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <iterator>
#include <cmath>
#include <set>
#include <deque> 
#include <string>


using namespace std;

int r;

int main()
{
	int a;
	scanf("%d", &r);
	a = 3 * r * r;
	printf("%d\n", a);

	return 0;
}
	

Measured memory_bytes: 128
data = gets.split(" ")
weight = data[0].to_i
height = data[1].to_i
x = data[2].to_i
y = data[3].to_i
r = data[4].to_i

flg = 0
if (((x - r) < 0) or ((y - r) < 0) or ((x + r) > weight) or ((y + r) > height))
  flg += 1
end

if flg == 0
  puts "Yes"
else
  puts "No"
end

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

using ll = long long;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
using vint = vector<int>;
using vvint = vector<vint>;
using vvvint = vector<vvint>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using uint = unsigned int;
using ull = unsigned long long;

template<typename T> using uset = unordered_set<T>;
template<typename T1, typename T2> using umap = unordered_map<T1, T2>;

constexpr int INF = (1 << 30) - 1;
constexpr ll LLINF = 1LL << 60;
constexpr int dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
constexpr int dx[] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr char el = '\n';
constexpr int mod = 1000000007;

template<typename T> T gcd(T a, T b) { return (b ? gcd(b, a % b) : a); }
template<typename T> T lcm(T a, T b) { return (a / gcd(a, b) * b); }
template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) { return (a > b && (a = b, true)); }
template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) { return (a < b && (a = b, true)); }

template<typename T>
ostream& operator <<(ostream &os, vector<T> &v) {
	os << v[0];
	for (int i = 1; i < v.size(); i++) os << " " << v[i];
	return (os);
}

template<typename T>
istream& operator >>(istream &is, vector<T> &v) {
	for (auto &u : v) is >> u; return (is);
}

template<typename T1, typename T2>
istream& operator >>(istream &is, pair<T1, T2> &p) {
	return (is >> p.first >> p.second);
}

bitset<1005> flag;
vvint G;
vvint nxt;

Pi dfs(int s, int u, int f) {
	//閉路の中で一番小さいものを採用する
	//cout << s << " " << u << " " << f << endl;
	if (s == u && f) {
		nxt[s][u] = -1;
		return (Pi(0, -1));
	}
	if (flag[u]) return (Pi(-1, -1));
	flag[u] = true;
	
	Pi ret = Pi(-1, -1);
	int size = INF;
	for (auto &v : G[u]) {
		Pi data = dfs(s, v, 1);
		if (data.first != -1) {
			if (chmin(size, data.first)) {
				ret = data;
			}
		}
	}
	if (ret.first == -1) return (Pi(-1, -1));
	//cout << " " << s << " " << u << " " << f << endl;
	//cout << " " << ret.first << " " << ret.second << endl;
	nxt[s][u] = ret.second;
	ret.second = u;
	ret.first++;
	return (ret);
}

void Main() {
	int N, M; cin >> N >> M;
	G = vvint(N);
	nxt = vvint(N, vint(N, -1));
	while (M--) {
		int A, B;
		cin >> A >> B; --A, --B;
		G[A].push_back(B);
	}
	Pi ans = Pi(-1, -1);
 	int minv = INF;
	int p = -1;
	for (int i = 0; i < N; i++) {
		flag = 0;
		Pi loop = dfs(i, i, 0);
		if (loop.first != -1) {
			if (chmin(minv, loop.first)) {
				ans = loop;
				p = i;
			}
		}
	}
	if (ans.first == -1) {
		cout << -1 << endl;
		return;
	}
	int v = ans.second;
	cout << ans.first << el;
	while (v != -1) {
		cout << v+1 << el;
		v = nxt[p][v];
	}
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(0);
	cout << fixed << setprecision(20);
	Main();
	return (0);
}

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

int main() {
	long a, b, k;
	cin >> a >> b >> k;

	if (a < k) {
		if (0 < b - (k - a)) {
			cout << 0 << " " << b - (k - a) << endl;
		} else {
			cout << 0 << " " << 0 << endl;
		}
	} else {
		cout << a - k << " " << b << endl;
	}
	return 0;
}

Measured memory_bytes: 256
N=int(input())
S=list(input())
import copy
A=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
L=[[0 for i in range(26)]]
for i in range(N):
    l=copy.deepcopy(L[-1])
    for j in range(26):
        if S[i]==A[j]:
            l[j]+=1
    L.append(l)
#print(L)
ans=0
for i in range(N):
    cnt=0
    for j in range(26):
        if L[i][j]>0 and L[-1][j]-L[i][j]>0:
            cnt+=1
    if ans<cnt:
        ans=cnt
print(ans)

Measured memory_bytes: 41200
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		
		Scanner sc=new Scanner(System.in);
		
		int n=sc.nextInt();		//果物の種類
		int k=sc.nextInt();		//k種類の果物を一個ずつ買う
		
		ArrayList<Integer>p=new ArrayList<>();
		for(int i=0;i<n;i++) {
		p.add(sc.nextInt());		//1個当たりの金額
		}
		
		Collections.sort(p);	//ソート
		
		int count=0;
		for(int i=0;i<k;i++) {
			count+=p.get(i);
		}
		System.out.println(count);
		sc.close();
	}
}

Measured memory_bytes: 29960
#include <stdio.h>
int power(int a){
    int i,s=1;
    if(a==0)
    return(1);
    else
    {for(i=0;i<a;i++)
    s=s*100;
    }
    return("%d",s);
}

int main(void){
    int D,N;
    scanf("%d %d",&D,&N);
   
    if(N==100)
    printf("%d",101*power(D));
    else if(D==0)
    printf("%d",N);
    else if(D==1)
    printf("%d",N*100);
    else if(D==2)
    printf("%d",N*10000);
  
    return(0);
}


Measured memory_bytes: 128
#include<stdio.h>
int main(void)
{
	int x[10000],i,a=0;
	while(1){
		scanf("%d",&x[a]);
		if(x[a]==0)
			break;
		a++;
	}
	for(i=0;i<a;i++)
		printf("Case %d: %d\n",i+1,x[i]);
	return 0;
}

Measured memory_bytes: 2712
#include <stdio.h>

int main()
{
    int n, i;
    int a, b, c;

    scanf("%d", &n);

    for (i = 0; i < n; i++) {

      scanf("%d %d %d", &a, &b, &c);

      if((a*a) == (b*b + c*c) || (b*b) == (c*c + a*a) || (c*c) == (a*a + b*b))
          printf("YES\n");
      else
          printf("NO\n");
    }

    return 0;
}

Measured memory_bytes: 580
#include<cstdio>
using namespace std;

#define ll long long
int n;

int main()
{
	scanf("%d",&n);
	
	ll ans=0;
	for (int i=1 ; i<=n ; i++)
	{
		ll x=n/i;
		ans+=x*(x+1)/2*i; 
	} 
	
	printf("%lld",ans);
	return 0;
 } 

Measured memory_bytes: 1712
#include <iostream>
#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 = a; i >= b; i--)
#define ll long long
vector<ll> val(101);
vector<ll> wt(101);
ll dp[100001][101];
bool check[100001][101];
long long f(ll w, ll i)
{
    if (check[w][i] == 1)
        return dp[w][i];
    if ((i == 0) || (w == 0))
        return 0;
    if(w-wt[i]<0)
        dp[w][i]=f(w,i-1);
    else
        dp[w][i] = max(f((w - wt[i]), (i - 1)) + val[i], f(w, i - 1));
    check[w][i] = 1;
    return dp[w][i];
}

int main()
{
    ll n, w;
    cin >> n >> w;
    For(i, 1, n + 1)
    {
        cin >> wt[i] >> val[i];
    }
    memset(dp, 0, sizeof(dp));
    memset(check, 0, sizeof(check));
    cout << f(w, n) << "\n";
    return 0;
}

Measured memory_bytes: 92356
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int K,X;
	cin>>K>>X;
	int i,d;
	d=K;
    for(i=1;i<=K-1;i++)
    {
    	d=d-1;
    cout<<X-d<<' ';
}
cout<<X<<' ';
for(i=1;i<=K-1;i++)
	cout<<X+i<<' ';
return 0;
}

Measured memory_bytes: 384
#include <cstdio>
using namespace std;
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)

const int MOD = 1000000007;
typedef long long ll;

ll fac(int n) {
  ll res = 1;
  REP(i, n) {
    res = res * (i+1) % MOD;
  }
  return res;
}

int main(void) {
  ll n, m;
  scanf("%lld%lld", &n, &m);

  ll res;
  if(n == m) {
    res = fac(n)*fac(m)%MOD*2%MOD;
  } else if(n == m-1) {
    res = fac(n)*fac(m)%MOD;
  } else if(n == m+1) {
    res = fac(n)*fac(m)%MOD;
  } else {
    res = 0;
  }
  printf("%lld\n", res);
  
  
  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
// const bool debug=true;
const bool debug=false;
#define DEBUG if(debug==true)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll MOD = 1000000007;

int main(void) {
    ll x,y;
    cin>>x>>y;
    if (abs(x-y)<=1) {
        cout << "Brown" << endl;
    }
    else {
        cout << "Alice" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define all(v) v.begin(),v.end()
#define P pair<int,int>
#define len(s) (int)s.size()
#define pb push_back

template<class T> inline bool chmin(T &a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
template<class T> inline bool chmax(T &a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}
void cmps(vector<int>&v,int &i){
	i=lower_bound(all(v),i)-v.begin();
}
constexpr int mod = 1e9+7;
constexpr int inf = 3e18;


int N,A[200005];
int dp[200005][5];
signed main(){
	cin>>N;
	rep(i,N)cin>>A[i];
	rep(i,N+1)rep(j,5)dp[i][j]=inf;
	dp[0][0]=0;
	rep(i,N){
		chmin(dp[i+1][0],dp[i][0]+A[i]);
		rep(j,2)chmin(dp[i+1][1],dp[i][j]+(A[i]?A[i]%2:2));
		rep(j,3)chmin(dp[i+1][2],dp[i][j]+!(A[i]%2));
		rep(j,4)chmin(dp[i+1][3],dp[i][j]+(A[i]?A[i]%2:2));
		rep(j,5)chmin(dp[i+1][4],dp[i][j]+A[i]);
	}
	int ans=inf;
	rep(i,5)chmin(ans,dp[N][i]);
	cout<<ans<<endl;
}


Measured memory_bytes: 9600
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		try {
            String inputStr = br.readLine();
			String[] inputNumbers = inputStr.split(" ");
            double T = Double.parseDouble(inputNumbers[0]);
        	double X = Double.parseDouble(inputNumbers[1]);
        	if (1<=T && T<=100 && 1<=X && X<= 100) {
            	double result = T/X;
            	System.out.println(result);
        	} else {
            	System.exit(1);
        	}
		} catch (IOException e) {
			e.printStackTrace();
		}
        
    }
}

Measured memory_bytes: 21204
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vel;
typedef vector<int> vei;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> ve_vel;
typedef vector<vector<int>> ve_vei;
typedef vector<vector<char>> ve_vec;
typedef vector<vector<bool>> ve_veb;
typedef vector<vector<string>> ve_ves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pub push_back
#define pob pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
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 (a>b) { a=b; return 1; } return 0; }


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

    ld r1, r2; cin >> r1 >> r2;
    ld r3 = (ld) r1 * r2 / (r1 + r2);
    cout << fixed << setprecision(10) << r3 << endl;
    return 0;
}

Measured memory_bytes: 256
import math

a,b,h,m = map(int, input().split())

m_radians = 360 * m / 60
h_radians = 360 * ((h * 5 + 5 * m / 60) / 60)

cos_ab = math.cos(math.radians(h_radians-m_radians))
c = math.sqrt(a**2 + b**2 - 2*a*b*cos_ab)

print(c)

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

int main()
{
	int n, i, j;
	double d;
	vector<int> num(6);
	cin>>n;
	while (cin>>d) {
		if (d < 165.0) num[0]++;
		else if (d < 170.0) num[1]++;
		else if (d < 175.0) num[2]++;
		else if (d < 180.0) num[3]++;
		else if (d < 185.0) num[4]++;
		else num[5]++;
	}
	for (i = 0; i < 6; i++) {
		cout<<i+1<<":";
		for (j = 0; j < num[i]; j++) cout<<"*";
		cout<<endl;
	}
	return 0;
}

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

int main() {
    
    int h,a;
    cin>>h>>a;
    if(h>a && h%a!=0){
        cout<<(h/a)+1<<endl;
    }else if(h%a==0){
        cout<<h/a<<endl;
        
    }
        else if(h<=a){
        cout<<"1"<<endl;
    }
	return 0;
}

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

#define ALL(a) begin(a), end(a)
#define TPL template
#define TNM typename

using ll = long long;
using ull = unsigned long long;

TPL<TNM T> using vec = vector<T>;
TPL<TNM T> using vec2 = vec<vec<T>>;
TPL<TNM T> using vec3 = vec<vec2<T>>;
TPL<TNM T> using vec4 = vec<vec3<T>>;
TPL<TNM T> using vec5 = vec<vec4<T>>;

TPL<TNM T> inline istream& operator >> (istream& is, vector<T>& vec) { for (T& x : vec) is >> x; return is; }
TPL<TNM V, TNM H> void resize(vector<V>& _v, const H _h) { _v.resize(_h); }
TPL<TNM V, TNM H, TNM ... T> void resize(vector<V>& _v, const H& _h, const T& ... _t) { _v.resize(_h); for (auto& __v : _v) resize(__v, _t ...); }
TPL<TNM V, TNM T> TNM enable_if<!is_class<V>::value>::type fill(vector<V>& _v, const T& _t) { std::fill(ALL(_v), _t); }
TPL<TNM V, TNM T> TNM enable_if<is_class<V>::value>::type fill(vector<V>& _v, const T& _t) { for (auto& _e : _v) fill(_e, _t); }
TPL<TNM T> inline void UNIQUE(vector<T>& _v) { sort(ALL(_v)); _v.erase(unique(ALL(_v)), _v.end()); }
struct pre_ { pre_() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(6); } } pre__;



int main(void) {
	string S;
	cin >> S;
	if (S[0] == S[1] || S[1] == S[2] || S[2] == S[3]) {
		cout << "Bad" << endl;
	}
	else {
		cout << "Good" << endl;
	}
	return 0;
}

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

inline int gcd(int a, int b){
  if(b<a) std::swap(a, b);
  int r = a % b;
  if(r==0) return b;
  while(r!=0) r = a % b, a = b, b = r;
  return a;
}

inline int read(){
	int x=0,f=1;char c=getchar();
	while(!isdigit(c)){if(c=='-')f=-1;c=getchar();}
	while(isdigit(c)){x=x*10+c-'0';c=getchar();}
	return x*f;
}

int cnt[1000001];
int main(){
  int n = read();
  int num = read();
  int o = 0, g = num;
  if(num==1) o=1;
  int ex = (n-1)/8;
  cnt[num] = 1;

  for(int i=0;i<ex;i++){
    int num = read();
    if(num==1) o++;
    g = std::gcd(g, num);
    cnt[num]++;

    num = read();
    if(num==1) o++;
    g = std::gcd(g, num);
    cnt[num]++;

    num = read();
    if(num==1) o++;
    g = std::gcd(g, num);
    cnt[num]++;

    num = read();
    if(num==1) o++;
    g = std::gcd(g, num);
    cnt[num]++;

    num = read();
    if(num==1) o++;
    g = std::gcd(g, num);
    cnt[num]++;

    num = read();
    if(num==1) o++;
    g = std::gcd(g, num);
    cnt[num]++;

    num = read();
    if(num==1) o++;
    g = std::gcd(g, num);
    cnt[num]++;

    num = read();
    if(num==1) o++;
    g = std::gcd(g, num);
    cnt[num]++;
  }

  for(int i=0;i<(n-1)%8;i++){
    int num = read();
    if(num==1) o++;
    g = std::gcd(g, num);
    cnt[num]++;
  }

  if(n - o > 80000){
    if(g==1) printf("setwise coprime\n");
    else printf("not coprime\n");
    return 0;
  }

  int max_S = 0;
  for(int i=2;i<=1000000;i++){
    int S = 0;
    for(int j=i;j<=1000000;j+=i) S += cnt[j];
    if(max_S<S) max_S = S;
  }
  if(max_S<2) printf("pairwise coprime\n");
  else if(max_S != n) printf("setwise coprime\n");
  else printf("not coprime\n");
}


Measured memory_bytes: 7512
h,w,a,b = map(int,input().split())
p = -1
q = -1
for i in range(h+1):
    if p != -1:
        break
    for j in range(w+1):
        if i*a + (h-i)*(w-a) == j*b + (w-j)*(h-b):
            p = i
            q = j
            break

Row = [w-a]*(h-p)+[a]*p
Column = [h-b]*(w-q)+[b]*q

Ans = [[0 for i in range(w)] for j in range(h)]

for i in range(h):
    for j in range(w):
        if Column[j] != 0 and Row[i] != 0:
            Column[j] -= 1
            Row[i] -= 1
            Ans[i][j] = 1
        elif Row[i] == 0:
            break
        elif Column[j] == 0:
            continue
if p == -1:
    print('No')
else:
    for ans in Ans:
        print(''.join(map(str,ans)))

Measured memory_bytes: 12916
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
int main() {
  string a,b;
  cin>>a>>b;
  int kazu_a=a.size();
  int kazu_b=b.size();
  rep(i,max(kazu_a,kazu_b)-1)
    cout<<a[i]<<b[i];
  if(kazu_a>kazu_b)cout<<a[kazu_a-1];
  else if(kazu_a<kazu_b)cout<<b[kazu_b-1];
  else cout<<a[kazu_a-1]<<b[kazu_b-1];
  cout<<endl;
  return 0;
}

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

int main(){
	int n;
	cin >> n;
	int a[n];
	for(int i = 0;i < n;i++){
		scanf("%d",&a[i]);
	}
	int f = 1;
	for(int i = n - 1;i >= 1;i--){
		if(a[i] < a[i-1]) a[i-1]--;
		if(a[i] < a[i-1]){
			f = 0;
			break;
		}
	}
	if(f) cout << "Yes" << endl;
	else cout << "No" <<endl;
    return 0;
}


Measured memory_bytes: 640
from collections import defaultdict
N, X, Y = map(int, input().split())
Y -= 1
X -= 1
dic =  defaultdict(int)
for i in range(N):
  for j in range(i):
    m = min(abs(i-Y)+abs(j-X)+1,i-j)
    dic[m] += 1
for i in range(1,N):
  print(dic[i])

Measured memory_bytes: 48988
#include <iostream>
#include <vector>
#include <cmath>
#include <queue>
#include <iomanip>

using namespace std;

typedef pair<double, int> P;

double G[1002][1002];
double d[1002];

const double INF = 1e+20;

int N;

void dijkstra(int s){
    priority_queue<P, vector<P>, greater<P>> que;
    fill(d, d+N+2, INF);
    d[s] = 0;
    que.push(P(s, 0));
    while(!que.empty()){
        P p = que.top();que.pop();
        int v = p.second;
        if(d[v] < p.first) continue;
        for(int i = 0; i <= N+1; i++){
            double e = G[v][i];
            if(d[v] + e < d[i] && v != i){
                d[i] = d[v] + e;
                que.push(P(d[i], i));
            }
        }
    }
}


int main(){
    double xs, ys, xt, yt;
    double x[1002];
    double y[1002];
    double r[1002] = {0};
    cin >> xs >> ys >> xt >> yt;
    cin >> N;
    x[0] = xs;
    y[0] = ys;
    x[N+1] = xt;
    y[N+1] = yt;
    for(int i = 1; i <= N; i++){
        cin >> x[i] >> y[i] >> r[i];
    }
    for(int i = 0; i <= N+1; i++){
        for(int j = 0; j < i; j++){
            double l = sqrt((double)((x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j]))) - (r[i]+r[j]);
            l = max(0.0, l);
            G[i][j] = l;
            G[j][i] = l;
            //cout << l << ' ';
        }
    }
    dijkstra(0);
    std::cout << std::fixed;
    cout << std::setprecision(15) << d[N+1] << endl;
}


Measured memory_bytes: 13552
#include <iostream>
#include <cmath>


using namespace std;

int main(void) {

	int n;
	cin >> n;

	long min = 1000000;
	long max = -1000000;
	long sum = 0;

	int a;
	for(int i=0;i<n;i++) {
		cin >> a;
		sum += a;
		if(min > a)	min = a;
		if(max < a)	max = a;
	}

	cout << min << " " << max << " " << sum << endl;


	return 0;
}

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

#define fs first
#define sc second
#define mp make_pair
#define eb emplace_back
#define sz(s) ((int) s.size())
#define all(s) s.begin(), s.end()

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef unsigned long long ull;

const ll linf = (ll) 1e18;

const int A = 26;
const int L = 17;
const int B = 315;
const int N = (int) 1e5;
const int inf = (int) 1e9;
const int mod = (int) 1e9 + 7;

const int di[] = {-1, +0, +1, +0};
const int dj[] = {+0, +1, +0, -1};

const ull pr = 31;
const ull hmod = (ull) 1e9 + 7;

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

inline void init() {
	
}
inline void solve() {
	string s; cin >> s;
	cout << s.substr(0, sz(s) - 8);		
}
int main() {
	#ifdef LOCAL
		#define name ""
		freopen(name".in", "r", stdin);
		freopen(name".out", "w", stdout);
	#endif
	int tests = 1;
	while (tests--) {
		init();
		solve();
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cctype>


using namespace std;

int main(){

    string W,T;
    int counter=0;

    cin >> W;

    while(cin >> T){
        if(T == "END_OF_TEXT"){break;}
        for(int i=0;i<T.size();i++){
            T[i] = tolower(T[i]);
        }
        counter += (T==W);

    }

    cout << counter << endl;

    return 0;
}


Measured memory_bytes: 3148
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define SZ(x) ((int)(x).size())
#define m0(x) memset(x,0,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))



int main() {
  ll N;
  ll H;
  ll W;
  cin >> N;
  cin >> H;
  cin >> W;
  ll count = 0;
  for (int i = 0; i < N; i++)
  {
    ll A;
    ll B;
    cin >> A;
    cin >> B;
    if (A >= H & B >= W) {
      count++;
    }
  }
  cout << count << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <map>
#include <deque>

int main(){
  int A, B, C;
  scanf("%d", &A);
  scanf("%d", &B);
  scanf("%d", &C);
  int odd = 0;
  int even = 0;
  if(A%2==0){
    even++;
  } else {
    odd++;
  }
  if(B%2==0){
    even++;
  } else {
    odd++;
  }
  if(C%2==0){
    even++;
  } else {
    odd++;
  }
  //printf("even=%d\n", even);
  int ans = 0;
  int max;
  int max_orig = std::max(std::max(A, B), C);
  //printf("max=%d\n", max);
  if (even==3 || even==0){
    max = std::max(std::max(A, B), C);
    ans += (max-A)/2 + (max-B)/2 +(max-C)/2;
    //printf("%d, %d, %d\n", (max-A)/2, (max-B)/2, (max-C)/2);
  } else if (even==2){
    if (A%2==0) A++;
    if (B%2==0) B++;
    if (C%2==0) C++;
    ans++;
    max = std::max(std::max(A, B), C);
    ans += (max-A)/2 + (max-B)/2 +(max-C)/2;
  } else if (even==1){
    if (A%2==1) A++;
    if (B%2==1) B++;
    if (C%2==1) C++;
    ans++;
    max = std::max(std::max(A, B), C);
    ans += (max-A)/2 + (max-B)/2 +(max-C)/2;
  }
  printf("%d\n", ans);
  return 0;
}


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

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

using namespace std;

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

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

  int result = 700;
  rep(i, s.size()) {
    if (s[i] == 'o') {
      result += 100;
    }
  }
  cout << result << endl;

  return 0;
}


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

int main()
{
  int n;
  cin >> n;
  
  int x[n],y[n];
  rep(i,n) cin >> x[i] >> y[i];
  
  int town[n];
  rep(i,n) town[i] = i+1;
  
  ld ans = 0.0;
  int count = 0;
  do{
    ld dist = 0.0;
    for(int i = 0; i < n-1; i++)
    {
      dist += hypotl(x[town[i]-1] - x[town[i+1]-1], y[town[i]-1] - y[town[i+1]-1]);
    }       
    count++;
    ans += dist;
  }while(next_permutation(town,town+n));
  
  cout << fixed;
  cout << setprecision(20);
  cout << (long double)(ans/count) << endl;
}

Measured memory_bytes: 3808
N = int(input())

ans = []
ans_num = 0
for i in range(N):
    s = i+1
    if(s%3 == 0 and s%5 == 0):
        ans.append("FizzBuzz")
    elif(s%3 == 0):
        ans.append("Buzz")
    elif(s%5 == 0):
        ans.append("Buzz")
    else:
        ans.append(s) 
        ans_num += s

print(ans_num)


Measured memory_bytes: 33476
#include <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <cmath>
#define rep(i,cc,n) for(int i=cc;i<=n;++i)
#define drep(i,cc,n) for(int i=cc;i>=n;--i)
typedef long long ll;
using namespace std;

int main(){
    int a[3][3];
    rep(i,0,2){
        rep(j,0,2) cin>>a[i][j];
    }
    int n;
    cin>>n;
    int b[n];
    rep(i,0,n-1) cin>>b[i];

    bool ans[3][3];
    rep(i,0,2){
        rep(j,0,2) ans[i][j] = false;
    }

    rep(i,0,2){
        rep(j,0,2){
            rep(k,0,n-1){
                if(a[i][j]==b[k]) ans[i][j] = true;
            }
        }
    }
    bool flag = false;
    rep(i,0,2){
        if(ans[i][0]==true&&ans[i][1]==true&&ans[i][2]==true) flag = true;
    }
    rep(i,0,2){
        if(ans[0][i]==true&&ans[1][i]==true&&ans[2][i]==true) flag = true;
    }
    if(ans[0][0]==true&&ans[1][1]==true&&ans[2][2]==true) flag = true;
    if(ans[2][0]==true&&ans[1][1]==true&&ans[0][2]==true) flag = true;
    if(flag) cout<<"Yes"<<endl;
    else cout<<"No"<<endl; 
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
constexpr int MOD = 998244353;
template<int mod> struct ModInt {
    int x;
    ModInt() : x(0) {}
    ModInt(long long y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}
    ModInt &operator+=(const ModInt &p) { if((x += p.x) >= mod) x -= mod; return *this; }
    ModInt &operator-=(const ModInt &p) { if((x += mod-p.x) >= mod) x -= mod; return *this; }
    ModInt &operator*=(const ModInt &p) { x = (int)(1LL*x*p.x%mod); return *this; }
    ModInt &operator/=(const ModInt &p) { *this *= p.inverse(); return *this; }
    ModInt operator-() const { return ModInt(-x); }
    ModInt operator+(const ModInt &p) const { return ModInt(*this) += p; }
    ModInt operator-(const ModInt &p) const { return ModInt(*this) -= p; }
    ModInt operator*(const ModInt &p) const { return ModInt(*this) *= p; }
    ModInt operator/(const ModInt &p) const { return ModInt(*this) /= p; }
    bool operator==(const ModInt &p) const { return x == p.x; }
    bool operator!=(const ModInt &p) const { return x != p.x; }
    ModInt inverse() const{
        int a = x, b = mod, u = 1, v = 0, t;
        while(b > 0) { t = a / b; a -= t * b; swap(a, b); u -= t * v; swap(u, v); }
        return ModInt(u);
    }
    ModInt pow(int e){
        long long a = 1, p = x;
        while(e > 0) {
            if(e%2 == 0) {p = (p*p) % mod; e /= 2;}
            else {a = (a*p) % mod; e--;}
        }
        return ModInt(a);
    }
    friend ostream &operator<<(ostream &os, const ModInt<mod> &p) {
        return os << p.x;
    }
    friend istream &operator>>(istream &is, ModInt<mod> &a) {
        long long x;
        is >> x;
        a = ModInt<mod>(x);
        return (is);
    }
};

int main() {
    using mint = ModInt<MOD>;
    int n, s;
    cin >> n >> s;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    
    mint ans = 0;
    mint dp[n+1][s+1]; dp[0][0] = 1;
    for (int i = 0; i < n; i++) {
        // 1 つ前の状態を持ってくる
        for (int j = 0; j <= s; j++) {
            dp[i+1][j] += dp[i][j];
        }
        // A_i を左端にした時の状態数
        if (a[i] <= s) {
            dp[i+1][a[i]] += i + 1;
        }
        // A_i を和として追加するときの遷移
        for (int j = 1; j <= s; j++) {
            if (a[i] + j <= s) {
                dp[i+1][j+a[i]] += dp[i][j];
            }
        }
        // A_i 単体で S になるとき(A_i が左端かつ右端になる)
        if (a[i] == s) {
            ans += (i + 1) * (n - i);
        }
        // A_i が右端になるとき
        if (a[i] < s) {
            ans += (dp[i][s - a[i]] * (n - i));
        }
    }
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 35456
n,m=map(int,input().split())

r=""
for i in range(n):
    if n > 1 and i == 0:r += '1'
    else : r+='0'
r = list(r)

k ={}
for _ in range(m):
    x,y = map(int,input().split())

    if n > 1 and x == 1 and y == 0: print('-1');exit()

    if k.get(x) and k[x] != str(y): print('-1');exit()
    else: k[x] = str(y)

for i,j in k.items():
    r[i-1] = j

print(int(''.join(r)))


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

#define ll long long
#define vecll vector<long long>
#define vec2ll vector<vector<long long>>
#define vecpairll vector<pair<long long,long long>>
#define forll(s,a,b) for(long long s = a;s < b;s++)
#define forllde(s,a) for(long long s = a;s > 0;s--)


int main()
{
  ll n, g;
  cin >> n;
  vecll b(n);
  vecll a(n);
  forll(i, 0, n)
	cin >> b[i];
  forll(i, 0, n){
	g = -1;
	forll(j, 0, b.size()){
	  if(b[j] == j+1)
		g = j;
	}
	if (g == -1 ){
	  cout << -1 << endl;
	  return 0;
	}
	a[n-i-1] = b[g];
	b.erase(b.begin() + g);
  }
  forll(i, 0, n)
	cout << a[i] << endl;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, n) for (int i = 1; i <= (int)(n); i++)
#define ll long long
#define umap unordered_map
using graph = vector<vector<int>>;
using graph2 = vector<vector<pair<int, int>>>;

ll mod(ll x, ll y){if(x>=0||x%y==0) return x%y;return y+x%y;} //mod including minus
ll dv0(ll x, ll y){if(x>=0||x%y==0)return x/y;return x/y-1;} //rnd down
ll dv1(ll x, ll y){if(x%y==0) return dv0(x,y);return dv0(x,y)+1;} //rnd up
ll M=1e9+7;
int quick_pow(int x,int p){
    int a=1,po=x;
    while(p){
        if(p&1)  a=1ll*a*po%M;
        po=1ll*po*po%M;p>>=1;
    }
    return a;
}
//Start from Here
int main(){
    string S;
    cin>>S;
    if(S=="ABC"){
        cout<<"ARC"<<endl;
    }else{
        cout<<"ABC"<<endl;
    }
}

Measured memory_bytes: 3628
import sys
s = list(sys.stdin.readline())
n = len(s)

ans = 0
for i in range(n-1):
    if s[i] != s[i+1]: continue
    if s[i] == '0': s[i+1] = '1'
    else: s[i+1] = '0'
    ans += 1
print(ans)

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

#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;

typedef long long ll;

const int INF = 1 << 30;
const ll LLINF = 1LL << 62;

int mod = 1000000007;

const int MAX = 510000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}


int main(void){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    COMinit();
    int N; cin >> N;
    int cnt[N+1] = {};
    int fst, snd;
    int A[N+1];
    rep(i, N+1){
        int a; cin >> a;
        cnt[a]++;
        A[i] = a;
        if(cnt[a] == 2){
            snd = i;
            rep(j, i) if(A[j] == A[i]) fst = j; 
        }
    }

    for(int k = 1; k <= N+1; k++){
        ll res = COM(N+1, k);
        //fstの左側と右側から合わせてk-1個取る
        ll choice = fst + (N - snd);
        res = (res - COM(choice, k-1)) % MOD;
        if(res < 0) res += MOD;
        printf("%d\n",res);
    }
    return 0;
}

Measured memory_bytes: 13952
#include <stdio.h>
void battle(int t_attack, int my_hp); // 戦闘
int main() {
  int a, b, c, d; // 変数宣言
  scanf("%d%d%d%d", &a, &b, &c, &d); // 標準入力
  for(int i=0; a>0&&c>0; i++) { // 戦闘ループ
    if (i%2==0) {
      c-=b; // 高橋君→青木君 : 攻撃
    } else {
      a-=d; // 青木君→高橋君 : 攻撃
    }
  }
  if (a<=0) { // 結果
    printf("No\n");
  } else {
    printf("Yes\n");
  }
  return 0;
}

Measured memory_bytes: 1648
open System
open System.Collections.Generic
open System.Linq
open System

// Following contents are my library. The Main processes are on the bottom of this code.

let puts = Console.WriteLine : 'a -> unit
let put = Console.Write : 'a -> unit
let Read() = Console.ReadLine()
let Reads () = Console.ReadLine().Split()
let ReadInt () = Read() |> int
let ReadDouble () = Reads() |> (fun x -> x.[0], x.[1])
let ReadTriple () = Reads() |> (fun x -> x.[0], x.[1], x.[2])
let ReadQuadruple () = Reads() |> (fun x -> x.[0], x.[1], x.[2], x.[3])
let FuncDouble f1 f2 (t1, t2) = (f1 t1, f2 t2)
let FuncTriple f1 f2 f3 (t1, t2, t3) = (f1 t1, f2 t2, f3 t3)
let FuncQuadruple f1 f2 f3 f4 (t1, t2, t3, t4) = (f1 t1, f2 t2, f3 t3, f4 t4)

let ReadIntQuadruple () = ReadQuadruple() |> FuncQuadruple int int int int
let ReadIntTriple () = ReadTriple () |> FuncTriple int int int
let ReadIntDouble () = ReadDouble () |> FuncDouble int int
let ensmallen l = l % 1000000007L
let manhattan x y = abs (fst x - fst y) + abs (snd x - snd y)
let sayYESNO b = if b then puts "YES" else puts "NO"


// The main contents of this submission are below this line.

let cs = Read().ToCharArray() |> Seq.distinct
let alphabet = "abcdefghijklmnopqrstuvwxyz".ToCharArray() |> Seq.distinct
let diff = alphabet |> Seq.filter (fun c -> not(Seq.contains c cs)) |> Seq.sort
if Seq.isEmpty diff then puts "None" else Seq.head diff |> puts


Measured memory_bytes: 15200
#include<cstdio>
#include<vector>
#define intv vector<long>
#define FOR(i, a, b) for((i)=(a);(i)<(b);(i)++)

using namespace std;

int main(void) {
  int n;
  intv a;
  scanf("%d", &n);
  int i;
  FOR(i, 0, n) {
    long j;
    scanf("%ld", &j);
    a.push_back(j);
  }


  long b = a[0];
  int c = 0;
  int r = 0;
  FOR(i, 1, n) {
    if((c>0&&b<=a[i])||(c<0&&b>=a[i])){
    } else if (c>0&&b>a[i]) {
      c = 0;
      r++;
    } else if (c<0&&b<a[i]) {
      c = 0;
      r++;
    } else if(c==0){
      if(b==a[i]){
      } else if(b>a[i]){
        c = -1;
      } else{
        c = 1;
      }
    }
    b = a[i];
  }
  r++;
  printf("%d", r);

  return 0;
}

Measured memory_bytes: 1400
#include<bits/stdc++.h>
using namespace std;
int n,a[100002],k;
long long f[100002];
int main(){
    cin>>n>>k;
    for(int i=1;i<=n;i++)
        cin>>a[i];
    /*f[1]=0;
    f[2]=abs(a[2]-a[1]);*/
    for(int i=1;i<=k+1;i++){
        f[i]=abs(a[i]-a[1]);
        //cout<<f[i]<<endl;
    }
    if(k+2<=n){
        for(int i=k+2;i<=n;i++){
            f[i]=20000000000;
            for(int j=i-1;j>=(i-k);j--){
                f[i]=min(f[i],f[j]+abs(a[i]-a[j]));
            }
        }
    }
    cout<<f[n];
}

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

namespace ConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {
            var ss = Console.ReadLine().Split();
            var N = int.Parse(ss[0]);
            var D = int.Parse(ss[1]);

            var n = N / ((D * 2.0) + 1);
            if (n > (int)n)
            {
                n++;
            }

            Console.WriteLine((int)n);
        }
    }
}

Measured memory_bytes: 13140
import math

def main():
    H, W = [int(_) for _ in input().split()]
    ans = (H // 2) * (W // 2) + (H // 2 + H % 2) * (W //2 + W % 2)
    if H > 1 and W > 1:
        print(ans)
    else:
        print(1)
main()

Measured memory_bytes: 3060
N, M, C = map(int, input().split())
B = list(map(int, input().split()))
A = [list(map(int, input().split())) for _ in range(N)]
 
cnt = 0
 
for a in A:
    
    if(sum([ta * tb for ta, tb in zip(a, B)]) + C > 0):
        cnt += 1
 
print(cnt)

Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#define N 100
using namespace std;

struct item {
    string city;
    int score, id;
};

bool cmp(item a, item b) {
    if (a.city == b.city)
        return a.score > b.score;

    for (int i = 0; i < min(a.city.size(), b.city.size()); ++i) {
        if (a.city[i] != b.city[i])
            return a.city[i] < b.city[i];
    }
    return a.city.size() < b.city.size();
}

int main() {
    int n;
    item num[N];
    cin >> n;
    for (int i = 0; i < n; ++i)
        cin >> num[i].city >> num[i].score, num[i].id = i;

    sort(num, num + n, cmp);

    for (int i = 0; i < n; ++i)
        cout << num[i].id + 1 << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <algorithm>
#include <limits.h>
#include <cmath>
#include <time.h>
#include <functional>
#include <cstdio>
#define REP(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
#define MOD1 1000000007;
#define MOD2 1000007
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
/* ここからが本編 */
/*  */
int dic[18000000];
ull pow(ull x,ull n) {
  ull res = 1;
  while(n > 0) {
    if(n&1) res = res * x;
    x = x * x;
    n >>= 1;
  }
  return res;
}
int dic_op(char str[14],int& key)
{
  int j;
  int f = 1;
  int g = 0;
  for(j = 0;j<10;j++) {
    if(str[j] == 'A')
      g += f * 1;
    else if(str[j] == 'C')
      g += f * 2;
    else if(str[j] == 'G')
      g += f * 3;
    else if(str[j] == 'T')
      g += f * 4;
    else break;
    f *= 5;
  }
  key = 0;
  if(j == 10) {
    f = 1;
    for(;j<10;j++) {
      if(str[j] == 'A')
        key += f * 1;
      else if(str[j] == 'C')
        key += f * 2;
      else if(str[j] == 'G')
        key += f * 3;
      else if(str[j] == 'T')
        key += f * 4;
      else break;
        f *= 5;
    }
  }
  return g;
}
int main()
{
  int i,j,k,l;
  long n;
  long ans = 0;
  char opstr[7];
  char str[13];
  int key;
  int a = 1;
  cin >> n;
  for (i = 0; i < n; i++) {
    scanf("%s %s",opstr,str);
    if(opstr[0] == 'i') {
      int tmp = dic_op(str,key);
      if( (dic[tmp] >> key) % 2 == 0) {
        dic[tmp] += 1 << key;
      }
    }
    else if(opstr[0] == 'f') {
      int tmp = dic_op(str,key);
      /*
      printf("tmp = %d\n",tmp);
      printf("key = %d\n",key);
      printf("dic[tmp] = %d\n",dic[tmp]);
      */
      if( (dic[tmp] >> key) % 2 == 1) {
        puts("yes");
      }
      else {
        puts("no");
      }
    }
  }
  return 0;
}

Measured memory_bytes: 39168
A, B, ANGC = gets.split.map &:to_i
CR = ANGC * Math::PI / 180.0
C = Math.sqrt(A*A + B*B - A * B * Math.cos(CR) * 2)
SS = A * B * Math.sin(CR)
puts SS / 2
puts A + B + C
puts SS / A

Measured memory_bytes: 8944
/*****/

#include <iostream>
#include <array>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <iomanip>	//cout << fixed << setprecision(桁数);
#include <stdexcept>

//#define int long long

using namespace std;
using ll = long long;
using ld = long double;
using vecll = vector<ll>;

#define nextline() (std::cerr << "\n")
#define debug(x) (#x " : " + (x))
#define debug_cout(x) (std::cerr << #x << " : " <<  (x) << "\n")
#define debug_tabcout(n, x) (std::cerr << strMulti("\t",n) << #x << " : " <<  (x) << "\n")
#define debug_headcout(h, x) (std::cerr << h << " : " <<  (x) << "\n")
#define debug_tabheadcout(n, h, x) (std::cerr << strMulti("\t",n) << h << " : " <<  (x) << "\n")

#define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; i++)
#define rep1(i, n) for(int i=1, i##_len=(n); i<=i##_len; i++)
#define rrep(i, n) for(int i=(n)-1; i >= 0; i--)
#define rrep1(i, n) for(int i=(n); i > 0; i--)
#define all(x) (x).begin(), (x).end()
#define pair(a, b) make_pair(a, b);
constexpr int INF = 2000000100;
constexpr ll DIV = 1000000007;	// 10e9+7
template<class T> bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
//template<class T> T divup(T a, T b) { if (a % b == 0) { return a / b; } return a / b + 1; }
#define diup(a, b) (a % b == 0 ? a / b : a / b + 1)
#define exist_in(list, value) (list.end() != std::find(all(list),value))
std::string strMulti(std::string t, int n) { std::string out = ""; for (int i = 0; i < n; i++) { out += t; } return out; }
//template<class T> T math_P(T m, T n) { T ret = 1; for (T i = m; i > m - n; i--) { ret *= i; } return ret; }
//template<class T> T math_C(T m, T n) { T ret = mathP(m, n); for (T i = 2; i <= n; i++) { ret /= i; } return ret; }
//template<class T> bool compare_by_b(pair<T, T> a, pair<T, T> b) { if (a.second != b.second) { return a.second < b.second; } return a.first < b.first; }
//template<class T> T math_gcd(T a, T b) { a = abs(a); b = abs(b); if (a < b) { std::swap(a, b); } T tmp; while (b != 0) { tmp = b; b = a % b; a = tmp; } return a; }
//template<class T> T math_lcm(T a, T b) { a = abs(a); b = abs(b); if (a > b) { std::swap(a, b); } if (a == 1) { return b; } T i = a; while (i % b != 0) { i += a; } return i; }
//template<class T1, class T2> bool exist_in(const T1& list, const T2& v) { return (list.end() != std::find(list.begin(), list.end(), v)); }
//template<class T> bool exist_in(const T& c, const typename T::value_type& v) {	return (c.end() != std::find(c.begin(), c.end(), v));}

/*****/

void Main()
{
	string n;
	cin >> n;
	if ((n[0] == n[1] && n[1] == n[2])
		|| (n[1] == n[2] && n[2] == n[3]))
		cout << "Yes";
	else
		cout << "No";
}

/*****/

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

	std::cout << std::fixed << std::setprecision(10);


	/*
	while (true)
	{
		Main();
		cout << endl;
	}
	//*/


	Main();

	return 0;
}


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

using namespace std;

struct Edge {
	int to, cap, rev;
};

int cap[500][500] = {0};
void addEdge(int from, int to) {
	cap[from][to] = cap[to][from] = 1;
}

#define INF 1000000000

int N;
bool used[500];
int dfs(int s, int t) {
	if (s == t) return 1;
	used[s] = true;

	for (int i = 0; i < N; ++i) {
		if (!used[i] && cap[s][i] > 0) {
			int d = dfs(i, t);
			if (d > 0) {
				--cap[s][i];
				++cap[i][s];
				return 1;
			}
		}
	}
	return 0;
}
int dfs2(int s, int t) {
	if (s == t) return 1;
	used[s] = true;

	for (int i = 0; i < N; ++i) {
		if (!used[i] && cap[s][i] > 1) {
			int d = dfs2(i, t);
			if (d > 0) {
				--cap[s][i];
				++cap[i][s];
				return 1;
			}
		}
	}
	return 0;
}
int flow(int s, int t) {
	int res = 0;
	while (1) {
		memset(used, false, sizeof(used));
		int f = dfs(s, t);
		if (f > 0) {
			res += f;
		}
		else {
			break;
		}
	}
	return res;
}

/*
bool used2[500][2];
bool dfs2(int s, int t, int from, int to, bool flag) {
	if (s == t) return flag;
	if (s == to && !flag) return false;
	used2[s][(int)flag] = true;

	for (int i = 0; i < N; ++i) {
		if (s == from && i != to) continue;
		bool nf = flag || (s == from && i == to);
		if (!used2[i][(int)nf] && cap[s][i] > 0) {
			bool f = dfs2(i, t, from, to, nf);
			if (f) {
				--cap[s][i];
				++cap[i][s];
				return true;
			}
		}
	}
	return false;
}
*/

int removeEdge(int a, int b) {
	int res = 0;
	if (cap[a][b] > 1) {
		return removeEdge(b, a);
	}
	else {
		int c = cap[a][b];
		cap[a][b] = cap[b][a] = 0;
		if (c < 1) {
			memset(used, false, sizeof(used));
			if ( !dfs(a, b) ) {
				memset(used, false, sizeof(used)); int x = dfs(N-1, b);
				memset(used, false, sizeof(used)); int y = dfs(a, 0);
				if (x + y < 2) {
					cout << x << " " << y << endl;
					exit(1);
				}
				res = -1;
			}
//			fill(&used2[0][0], &used2[0][0]+500*2, false);
//			if ( !dfs2(N-1, 0, b, a, false) ) {
//				cout << "ERROR" << endl;
//				while (1);
//			}
		}
	}
	return res;
}

int main() {
	int E, Q; cin >> N >> E >> Q;
	for (int i = 0; i < E; ++i) {
		int F, T; cin >> F >> T; --F, --T;
		addEdge(F, T);
	}
	int f = flow(0, N-1);
	for (int t = 0; t < Q; ++t) {
		int m, a, b; cin >> m >> a >> b; --a, --b;
		if (m == 1) {
			addEdge(a, b);
		}
		else if (m == 2) {
			f += removeEdge(a, b);
		}
		memset(used, false, sizeof(used)); f += dfs(0, N-1);
		cout << f << endl;
	}
}

Measured memory_bytes: 2160