akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include<iomanip>
#include <algorithm>
#include <vector>
#include <string>
#include <utility>
#include <queue>
#define INF 1e9+7
#define rep(i,n) for(int i=0;i<n;i++)
#define NO cout<<"NO"<<endl;
#define YES cout << "YES"<<endl;
#define No cout << "No"<<endl;
#define Yes cout << "Yes"<<endl;
#define all(a) a.begin(),a.end()
#define P pair<int,int>
#define space ' '
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;

//(int)'a'は97 (int)'A'は65 (int)'1'は49
//おまじない

const int maxn = 100000;

vector<vector<int> > v(3*maxn);
int dis[3*maxn]={0};
queue<int> que;
int n,m;
int s,t;

void cal(){
    while(!que.empty()){
        int arg_node=que.front();que.pop();
        if(arg_node==t)break;
        rep(i,v[arg_node].size()){
            if(dis[v[arg_node][i]]==-1){
                dis[v[arg_node][i]]=dis[arg_node]+1;
                que.push(v[arg_node][i]);
            }
        }
    }
    
    return;
}

int main(){
    
    cin >> n>>m;
    
    rep(i,m){
        int p,q;
        cin >> p>>q;
        p--;q--;
        v[p].push_back(n+q);
        v[n+p].push_back(2*n+q);
        v[2*n+p].push_back(q);
    }
    
    cin >> s>>t;
    s--;t--;
    fill(dis,dis+3*n,-1);
    dis[s]=0;
    
    rep(i,v[s].size()){
        que.push(v[s][i]);
        dis[v[s][i]]=1;
    }
    
    cal();
    
    //cout << dis[t]<<endl;
    
    if(dis[t]==-1)cout << -1<<endl;
    else cout << dis[t]/3<<endl;
    
    return 0;
}


Measured memory_bytes: 17792
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
const int maxn=200005;
ll n,d,k;
ll a[maxn];
int main()
{
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
        a[i]-=i;
    }
    sort(a+1,a+n+1);
    ll b=0;
    if(n%2==0)
    b=(a[n/2]+a[n/2+1])/2;
    else
    b=a[n/2+1];
    ll ans=0;
    for(int i=1;i<=n;i++)
    {
        ans=ans+abs(b-a[i]);
    }
    cout<<ans<<endl;
    return 0;
}

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

int main() {

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



Measured memory_bytes: 3100
#include <iostream>

using namespace std;

int main() {
    long long int x,f,s;
    cin>>x;
    long long int a[150];
    for(long int i=0;i<150;i++)
    {
        a[i]=i*i*i*i*i;
    }
    for(long int i=0;i<150;i++)
    {
        f=x+a[i];
        s=x-a[i];
        //cout<<f<<" "<<s<<endl;
        for(long int j=0;j<150;j++)
        {
            if(f==a[j])
            {
                cout<<j<<" "<<i;
                return 0;
            }
            else if(s==a[j])
            {
                cout<<j<<" "<<(-1*i);
                return 0;
            }
        }
    }
	return 0;
}


Measured memory_bytes: 3532
O = input()
E = input()
n = 0
i = len(E)
while(n <= i):
  if(n == i and len(O) == len(E)):
    pass
  else:
    print(O[n],end = "")
  if(n == i):
    pass
  else:
    print(E[n],end = "")
  n += 1

Measured memory_bytes: 3060
//#if 1
//#include"pch.h"
//#define _CRT_SECURE_NO_WARNINGS
//#endif
#include<stdio.h>
#include<stdlib.h>
#include<cmath>
#include<math.h>
#include<string>
#include<string.h>
#include<algorithm>
#include<iostream>
using namespace std;
int main() {
	int N;
	char S[100];
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> S[i];
		if (S[i] == 'Y') {
			puts("Four");
			return 0;
		}
	}
	puts("Three");
	return(0);
}

Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var (
		a, b, c int
	)
	fmt.Scanf("%d %d %d\n", &a, &b, &c)
	listenCount := b/a
	if listenCount > c {
		listenCount = c
	}
	fmt.Println(listenCount)
}

Measured memory_bytes: 512
#include<iostream>
#include<vector>
#include<sstream>
#include<string>
#include<numeric>
#include <algorithm>
#include<math.h>
#include<cstdio>
#include<string.h>
#include<unistd.h>
#include <array>
#include <map> 




using namespace std;
typedef long long ll;
struct point{
  int x;
  int y;

};
int gcd(int m, int n )
{
	// 引数に０がある場合は０を返す
	if ( ( 0 == m ) || ( 0 == n ) )
		return 0;
	
	// ユークリッドの方法
	while( m != n )
	{
		if ( m > n ) m = m - n;
		else         n = n - m;
	}
	return m;
}//gcd
int lcm( int m, int n )
{
	// 引数に０がある場合は０を返す
	if ( ( 0 == m ) || ( 0 == n ) )
		return 0;
	
	return ((m / gcd(m, n)) * n); // lcm = m * n / gcd(m,n)
}//lcm
int input(){
  int x;
  cin>>x;
  return x;
}

int moji(char in)
{
    int ans = (int)in-(int)'a';
    if((ans < 0) || (ans > 25)){
        ans = 26;
    }
    return ans;
}
const int VV=10;//場合に応じてVVの値のみ変更する必要あり
//dijkstra(s)sがスタート地点でそこからの最短距離を配列dで表す。正の重みのみ使用可能
int cost[VV][VV];
int d[VV];
bool used[VV];
void dijkstra(int s){
  fill(d,d+VV,100000);
  fill(used,used+VV,false);
  d[s]=0;
  while(true){
    int v=-1;
    for(int u=0;u<VV;u++){
      if(!used[u]&&(v==-1||d[u]<d[v]))v=u;
    }
    if(v==-1)break;
    used[v]=true;
    for(int u=0;u<VV;u++){
      d[u]=min(d[u],d[v]+cost[v][u]);
    }
  }

}

int compare_int(const void *a, const void *b)//qsort(quick sort利用時に使用)
{
    return *(int*)a - *(int*)b;
}

int binary_searchh(long long x,long long k[],int n){
  int l=0;
  int r=n;
  while(r-l>=1){
    int i=(l+r)/2;
    if(k[i]==x)return i;
    else if(k[i]<x)l=i+1;
    else r=i;
  }
  return -1;
}

struct File {
    int aa;
    int bb;

    File(const int& aa, const int& bb)
        : aa(aa), bb(bb) {}
};

bool operator<(const File& a, const File& b)
{
    // ファイル種別、ファイル名の順番で優先順位を付けて比較
    return std::tie(a.aa, a.bb) < std::tie(b.aa, b.bb);
}


const int limit=50;
int n,m;
int a[limit],b[limit];
bool graph[limit][limit];
bool visited[limit];

void dfs(int v){
  //訪問判定
  visited[v]=true;
  for(int v2=0;v2<n;v2++){
    if(graph[v][v2]==false)continue;
    if(visited[v2]==true)continue;
    dfs(v2);
  }
}





int main(){
  cin>>n>>m;
  for(int i=0;i<m;i++){
    cin>>a[i]>>b[i];
    a[i]--;
    b[i]--;
    graph[a[i]][b[i]]=graph[b[i]][a[i]]=true;
  }
  int ans=0;
  for(int i=0;i<m;i++){
    //一つの辺を落とす
    graph[a[i]][b[i]]=graph[b[i]][a[i]]=false;
    //初期化
    for(int j=0;j<n;j++){
      visited[j]=false;
    }
    dfs(0);
    bool bridge=false;
    for(int j=0;j<n;j++){
      if(visited[j]==false){
        bridge=true;
      }
    }
    if(bridge){
      ans++;
    }
    //元に戻す
    graph[a[i]][b[i]]=graph[b[i]][a[i]]=true;

  }
  cout<<ans<<endl;

}



  

Measured memory_bytes: 256
from collections import defaultdict

MOD = 10**9+7
n, x = map(int, input().split())
S = sorted(map(int, input().split()), reverse=True)
dp = [defaultdict(int) for _ in range(n+1)]
dp[0][x] = 1
for i in range(n):
  now = S[i]
  for j in dp[i]:
    dp[i+1][j%now] += dp[i][j]
    dp[i+1][j] += dp[i][j] * (n-1-i)
    dp[i+1][j%now] %= MOD
    dp[i+1][j] %= MOD
ans = 0
for k, v in dp[n].items():
  ans += k*v
  ans %= MOD
print(ans)

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

int main() {
  int N,K;
  cin >> N>>K;
  vector<int> a(N); 
    for(int i=0;i<N;i++) cin>>a[i];

  sort(a.begin(),a.end());
  reverse(a.begin(),a.end());
  int sum=0;
  for(int i=0;i<K;i++) sum += a[i];
  cout<<sum<<endl;

  }


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

using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define all(i) (i).begin(), (i).end()
#define rall(i) (i).begin(), (i).end(), greater<int>()
#define int long long
#define elif else if
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fst first
#define sec second
#define mod 1000000007
#define INF 10e10
template <typename T>

void print(T x)
{
	std::cout << x << " ";
}

template <typename T>

void println(T x)
{
	std::cout << x << "\n";
}


signed main(void) {
	int d,t,s;
	cin >> d >> t >> s;
	if(t*s-d>=0)print("Yes");
	else print("No");
}

Measured memory_bytes: 3632
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<limits>
#include<set>
#include<deque>
#include<queue>
#include<stack>
using namespace std;
#define int long long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define dup(x,y) (((x)+(y)-1)/(y))
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }
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; }
typedef pair<int, int>P;
const int MOD = 1e9 + 7;
//const int MOD = 998244353;
const int INF = 1e18;
const long double PI = (acos(-1));


signed main() {
	int N;
	cin >> N;
	vector<int>A(N), B(N);
	rep(i, N)cin >> A[i];
	rep(i, N)B[i] = A[i];
	rep(i, N)B[i] -= i + 1;
	sort(B.begin(), B.end());
	if (N & 1) {
		int b = B[N / 2];
		int ans = 0;
		rep(i, N)ans += abs(A[i] - (i + 1 + b));
		cout << ans << endl;
	}
	else {
		int b;
		b = B[N / 2];
		int ans1 = 0;
		rep(i, N)ans1 += abs(A[i] - (i + 1 + b));

		b = B[N / 2 - 1];
		int ans2 = 0;
		rep(i, N)ans2 += abs(A[i] - (i + 1 + b));
		int ans = min(ans1, ans2);
		cout << ans << endl;
	}
}

Measured memory_bytes: 6328
//Om Sree Sai Ram
#include "bits/stdc++.h"
using namespace std;


const int mod = 1e9+7;


int add_self(int &a,int b)
{
  a +=b;
  if(a>=mod)
  {
    a-=mod;
  }
}

int sub_self(int &a,int b)
{
  a -=b;
  if(a<=0)
  {
    a+=mod;
  }
}


int main() 
{

int n,k;
cin>>n>>k;
vector<int> dp(k+1);
//dp[i] represents number of ways to get into state in which i candies are distributed.
dp[0] = 1;

for(int i=0;i<n;i++)
{
  int upto;
  cin>>upto;
  vector<int> diff(k+1);
  for(int j=k;j>=0;j--)
  {
    int tmp = dp[j];
    //for order(n*k^2) algorithm
    int L = j+1;
    int R = j+min(upto,k-j);
    if(L<=R)
    {
    add_self(diff[L],tmp);
    if(R+1<=k)
    {
    sub_self(diff[R+1],tmp);
    }
   }
  // for(int dat=L;dat<=R;dat++)
  // {
  //   if(dat<=k)
  //   {
  //   dp[dat] += tmp;
  //   } 
  // }
   }

  int prefix = 0;
for(int i=0;i<=k;i++)
{
  //cout<<"diff "<<i<<endl;
 add_self(prefix,diff[i]);
 //cout<<"prefix "<<prefix<<endl;
 add_self(dp[i],prefix);
}

}

cout<<dp[k]<<endl;

}


Measured memory_bytes: 1024
#include<iostream>
#include<math.h>
using namespace std;

int main(){
	unsigned long sum = 0;
	unsigned long n;
	cin >> n;
	for(unsigned long i=1;i<=(unsigned long)sqrt(n);i++){
		if(n % i != 0) continue;
		unsigned long j = n/i;
		//check i-1
		if((i-1)!=0){
			if(n/(i-1) == n%(i-1)) sum += (i-1);
		}
		//check j-1
		if((j-1)!=0){
			if(n/(j-1) == n%(j-1)) sum += (j-1);
		}
	}
	cout << sum << endl;
}


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

int COUNT=0;

void dfs(vector<string> map,int state[20][20],int x,int y,int W,int H){
  int dx[4]={-1,0,1,0};
  int dy[4]={0,-1,0,1};
  if(x<0 || x>H-1 || y<0 || y>W-1)return; //????????????
  if(state[x][y]!=0 || map[x][y]=='#')return; //?????§????????£??????????????????????????????
  ++COUNT;
  state[x][y]=1;
  for(int i=0;i<4;++i)dfs(map,state,x+dx[i],y+dy[i],W,H); //??????????????¨??¢?´¢
}

int main(){
  int W,H,x,y;
  vector<string> map;
  string a;
  while(true){
    COUNT=0;
    cin >> W >>H;
  if(!W && !H)break;
  int state[20][20]={0}; //?????§????????£???????????????
  for(int i=0;i<H;++i){ //???????????\???
    cin >> a;
    map.push_back(a);
  }
  for(int i=0;i<H;++i){//????????????????????¢?´¢
    if(0<=map[i].find('@') && map[i].find('@')<W){
      y=map[i].find('@');
      x=i;
      break;
    }
  }
    dfs(map,state,x,y,W,H);
    cout << COUNT << endl;
    map.clear();
  }
}

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

using namespace std;

#define int 		long long
#define endl 		"\n"
#define mod 		1000000007
#define inf 		1e18
#define IOS 		ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)

int32_t main() {

	IOS;

	int n;
	cin >> n;

	vector<pair<int, int>> v(n);

	for (int i = 0; i < n; i++) {
		cin >> v[i].first >> v[i].second;
	}


	int mx = v[0].first + v[0].second, mn = v[0].first + v[0].second, ans = -1;

	for (int i = 1; i < n; i++) {
		mx = max(mx, v[i].first + v[i].second);
		mn = min(mn, v[i].first + v[i].second);
	}

	ans = max(ans, mx - mn);
	mx = v[0].first - v[0].second, mn = v[0].first - v[0].second;

	for (int i = 1; i < n; i++) {
		mx = max(mx, v[i].first - v[i].second);
		mn = min(mn, v[i].first - v[i].second);
	}

	ans = max(ans, mx - mn);

	cout << ans;

	return 0;
}

Measured memory_bytes: 6352
n,k=map(int,input().split())
if k%2==0:
    zero=0
    half=0
    for i in range(1,n+1):
        if i%k==0:
            zero+=1
            continue
        if i%k==(k//2):
            half+=1
    print(zero**3+half**3)
else:
    zero=0
    for i in range(1,n+1):
        if i%k==0:
            zero+=1
    print(zero**3)

Measured memory_bytes: 3064
#include<stdio.h>
#include<string.h>
int main(){
    int n,a=0,i,j;
    char c[100],d[100];
    scanf("%s",c);
    j=strlen(c);
    for(i=j-1;i>=0;i--){
        d[i]=c[j-i-1];
    }
    for(i=0;i<=j;i++){
            if(d[i]!=c[i]){
                a=a+1;
            }
    }
    printf("%d",a/2);

}


Measured memory_bytes: 128
#pragma region

#include "bits/stdc++.h"
using namespace std;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define _rep3(i, begin, end) for (register int i = (begin); i < (end); i++)
#define _irep3(i, begin, end) for (register int i = (end)-1; i >= (begin); i--)
#define _rep2(i, n) _rep3(i, 0, n)
#define _irep2(i, n) _irep3(i, 0, n)
#define _overload3(_1, _2, _3, name, ...) name
#define rep(...) _overload3(__VA_ARGS__, _rep3, _rep2, )(__VA_ARGS__)
#define irep(...) _overload3(__VA_ARGS__, _irep3, _irep2, )(__VA_ARGS__)
#define out(x) cout << (x) << '\n';
#define debug(x) cerr << #x << " = " << (x) << " (line: " << __LINE__ << ") " << endl;
typedef long long ll;

template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
  for (auto &v : vec) is >> v;
  return is;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
  os << "vec[ ";
  rep(i, vec.size()) i == 0 ? os << vec[i] : os << ", " << vec[i];
  os << " ]";
  return os;
}

#pragma endregion

#define MOD 1000000007
#define INF 2147483647

vector<vector<int>> nodes(100000, vector<int>());

bool findPath(int target, int node, vector<int> &path, int from) {
  if (node == target) {
    path.push_back(node);
    return true;
  }
  rep(i, nodes[node].size()) {
    if (nodes[node][i] == from) continue;
    if (findPath(target, nodes[node][i], path, node)) {
      path.push_back(node);
      return true;
    }
  }
  return false;
}

int maxDistance(int from, int node) {
  vector<int> dist;
  rep(i, nodes[node].size()) {
    if (nodes[node][i] != from) {
      dist.push_back(maxDistance(node, nodes[node][i]));
    }
  }
  if (dist.size() == 0) {
    return 0;
  }
  int maxDist = 0;
  rep(i, dist.size()) {
    maxDist = max(maxDist, dist[i]);
  }
  return maxDist + 1;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(16);

  ll N, A, B;
  cin >> N >> A >> B;

  if ((A + B) % 2 == 0) {
    out((B - A) / 2);
    return 0;
  }
  out(min(A - 1, N - B) + (B - A) / 2 + 1);
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
 
int main() {
	int A,B,K;
	cin >> A >> B >> K;
 
	int count = 0;
 
  for(int i = min(A,B);1<=i;i--){
		if((A%i) == 0 && (B%i) == 0) count++;
 
		if(count == K){
			cout << i << endl;
			return 0;
		}
	}
}

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

int main(void) {
  int n;
  cin >> n;
  int x[n];
  rep(i, n) cin >> x[i];
  int ans = 1001001001;
  f1(p, 1, 100) {
    int now = 0;
    rep(i, n) now += (x[i] - p) * (x[i] - p);
    ans = min(ans, now);
  }
  cout << ans << '\n';
  return 0;
}

Measured memory_bytes: 3564
#include<stdio.h>
int main(){
	double a,b,c,d,e,f,g,h,k,n,y[1000],x[1000];
	int i,j=0;
	while(scanf("%lf%lf%lf%lf%lf%lf",&a,&b,&c,&d,&e,&f)!=EOF){
		//printf("%f%f%f",a,b,c);
		g=c*d;
		h=a*f;
		k=g-h;
		g=b*d;
		h=a*e;
		n=g-h;
		y[j]=k/n;
		if(y[j]>=-0.0004&&y[j]<=0)y[j]=0;
//		if(y[j]>=0){
//			y[j]=y[j]+0.0005;
//		}else{
//			y[j]=y[j]-0.0005;
//		}
			
		g=b*f;
		h=c*e;
		k=g-h;
		g=b*d;
		h=a*e;
		n=g-h;
		x[j]=k/n;
		if(x[j]>=-0.0004&&x[j]<=0)x[j]=0;
//		if(x[j]>=0){
//			x[j]=x[j]+0.0005;
//		}else{
//			x[j]=x[j]-0.0005;
//		}
		j++;
	}
	for(i=0;i<j;i++){
	printf("%.3f %.3f\n",x[i],y[i]);
}
	return 0;
	
	
}

Measured memory_bytes: 664
#include<cstdio>
int n,v[1<<17],cnt,x,i;
int main(){
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",&x);
		cnt+=v[x];
		v[x]=1;
	}
	printf("%d\n",n-(cnt+1)/2*2);
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define repr(i,from,to) for(int (i)=(from);(i)<(to);(i)++)
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
// const bool debug=true;
const bool debug=false;
#define DEBUG if(debug==true)
#define vprint(x) for(auto a:(x)) cout << x << endl;
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll MOD = 1000000007;

int main(void) {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;cin>>n;
    vector<double> prob(n);rep(i,n){cin>>prob[i];}
    double dp[n+1][n+1];
    rep(i,n+1){
        rep(j,n+1){
            dp[i][j]=0;
        }
    }
    dp[0][0]=1;
    rep(j,n/2+2){
        repr(i,1,n+1){
            if(j==n/2+1){dp[i][j]+=dp[i-1][j];}
            else{dp[i][j] += dp[i-1][j]*(1-prob.at(i-1));}
            if(j!=0){
                dp[i][j] += dp[i-1][j-1]*prob.at(i-1);
            }
        }
    }
    // double res=0;
    DEBUG{
        rep(i,n+1){
            cout << dp[n][i] << endl;
        }
    }
    // repr(i,n/2+1,n+1){
    //     res += dp[n][i]; 
    // } 
    printf("%.10f\n",dp[n][n/2+1]);
    return 0;
}


Measured memory_bytes: 70656
n = int(input())
ans = [0]*10000
for i in range(1,101):
    for j in range(1,101):
        for k in range(1,101):
            x = i*i+j*j+k*k+i*j+j*k+k*i
            if (x<=10**4):
                ans[x-1] += 1
ans = ans[:n]
print(*ans ,sep="\n")

Measured memory_bytes: 9204
#include<bits/stdc++.h>
using ll = int_fast64_t;

std::map<ll, ll> prime_factor(ll n){
        std::map<ll, ll> ret;
        for(ll i=2; i*i<=n; i++){
                while(n%i==0){
                        ret[i]++;
                        n /= i;
                }
        }
        if(n!=1) ret[n]++;
        return ret;
}

int main(){
        ll x;
        scanf("%lld", &x);
        printf("%lld:", x);
        for(auto p: prime_factor(x)){
                ll v = p.first, c = p.second;
                for(ll i=0; i<c; i++){
                        printf(" %lld", v);
                }
        }
        puts("");
        return 0;
}



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

int main(int argc, char const *argv[]) {
	int N;
	cin >> N;
	int map[100001] = {0};
	int tmp;
	for (size_t i = 0; i < N; i++) {
		cin >> tmp;
		map[tmp]++;
	}
	int dups = 0;
	for (size_t i = 1; i < 100000; i++) {
		if (map[i] >= 2) {
			dups += map[i] - 1;
		}
	}

	cout << N - (dups + 1) / 2 * 2 << endl;

	return 0;
}


Measured memory_bytes: 640
def main():
    a, b, m = map(int, input().split())
    a_list = list(map(int, input().split()))
    b_list = list(map(int, input().split()))
    waribiki = []
    waribiki_result = 0

    for i in range(m):
        waribiki = list(map(int, input().split()))
        tmp_result = a_list[waribiki[0] - 1] + \
            b_list[waribiki[1] - 1] - waribiki[2]
        if i == 0:
            waribiki_result = tmp_result
        else:
            if tmp_result < waribiki_result:
                waribiki_result = tmp_result

    a_list.sort()
    b_list.sort()
    if a_list[0] + b_list[0] < waribiki_result:
        print(a_list[0] + b_list[0])
    else:
        print(waribiki_result)


if __name__ == "__main__":
    main()


Measured memory_bytes: 18688
N = int(input())
dic = {}
for i in range(1,N+1):
    s,p = input().split()
    if not s in dic.keys():
        dic[s] = {int(p):i}
    else:
        dic[s][int(p)] = i
#print(dic)
for adic in sorted(dic.keys()):
    d = dic[adic]
    #print(d)
    for s in sorted(d.keys(),reverse=True):
        print(d[s])

Measured memory_bytes: 3068
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <climits>
#include <cmath>
#include <utility>
#include <string>
#include <cstring>
#include <functional>

using namespace std;

int n, ans = 0;

int main() {

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	string s[3];

	cin >> n;
	for (int i = 0; i < 3; ++i)
		cin >> s[i];

	for (int i = 0; i < n; ++i) {
		unordered_set<char> vis;
		for (int j = 0; j < 3; ++j)
			vis.insert(s[j][i]);

		// cout << i << " " << vis.size() << endl;

		ans += vis.size()-1;
	}

	cout << ans << endl;

	return 0;
}

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

int main(){
  string c1, c2;
  cin >> c1 >> c2;
  if(c1[0]==c2[2] && c1[1]==c2[1] && c1[2]==c2[0])cout << "YES";
  else cout << "NO";
  return 0;
}

Measured memory_bytes: 256
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
use std::io::{BufWriter, Write};
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};
    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, [ $t:tt ]) => {{
        let len = read_value!($next, usize);
        (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    }};

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused)]
macro_rules! debug {
    ($($format:tt)*) => (write!(std::io::stderr(), $($format)*).unwrap());
}
#[allow(unused)]
macro_rules! debugln {
    ($($format:tt)*) => (writeln!(std::io::stderr(), $($format)*).unwrap());
}

fn solve() {
    let out = std::io::stdout();
    let mut out = BufWriter::new(out.lock());
    macro_rules! puts {
        ($($format:tt)*) => (write!(out,$($format)*).unwrap());
    }
    input! {
        x: i64,
        y: i64,
    }
    let mut cnt = 0i64;
    let mut x = x;
    while x <= y {
        x *= 2;
        cnt += 1;
    }
    puts!("{}\n", cnt);
}

fn main() {
    let stack_size = 104_857_600;
    let thd = std::thread::Builder::new().stack_size(stack_size);
    thd.spawn(|| solve()).unwrap().join().unwrap();
}

Measured memory_bytes: 8572
#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> vl;
typedef vector<int> vi;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> vvl;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvec;
typedef vector<vector<bool>> vveb;
typedef vector<vector<string>> vves;
#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 pb push_back
#define pp 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)
typedef long long int64;
//const int64 INF = 1LL << 58;
#define dame { puts("-1"); return 0;}
#define YES { cout << "YES" << endl; return 0; }
#define NO { cout << "NO" << endl; return 0; }
#define Yes { cout << "Yes" << endl; return 0; }
#define No { cout << "No" << endl; return 0; }
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 dx[] = {0, 0, -1, 1};
int dy[] = {1, -1, 0, 0};

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

	int x;
  	cin >> x;
  	bool s = false;
  	if(x==2){cout << x << endl;return 0;}
  	if(x==3){cout << x << endl;return 0;}
  	while(true){
    	int ers = sqrt(x);
      	rep2(i,ers+1){
          if(x%i==0){break;}
          if(i==ers){s=true;}
        }
      if(s){cout << x << endl;return 0;}  
      x++;
      
    }
  	
  	return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
	
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        
        String A = sc.next();
        String B = sc.next();
        String C = sc.next();
        
        if (A.charAt(A.length()-1) == B.charAt(0) && B.charAt(B.length()-1) == C.charAt(0)) {
        	System.out.println("YES");
        } else {
        	System.out.println("NO");
        }
    }
}

Measured memory_bytes: 21460
import java.util.*;

public class Main {

	public static long f(long a, long b) {
		long ans = 0;
		if (b == 0) 
			return -a;
		if (a > b) {
			long tmp = a;
			a = b;
			b = tmp;
		}
		if (a == b)
			return a;
		ans = 2 * (b / a) * a + f(a, b % a);
		return ans;
	}

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long n = sc.nextLong(), x = sc.nextLong();
		sc.close();
		long ans = n + f(n - x, x);
		System.out.println(ans);
	}

}


Measured memory_bytes: 22740
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(){
  int r,d,x;
  scanf("%d%d%d",&r,&d,&x);
  
  for(int i=0;i<10;i++){
    int a = r*x-d;
    printf("%d\n",a);
    x = a;
  }
}

Measured memory_bytes: 128
package main

import (
	"fmt"
	"strconv"
)

func main() {
	// Code for B - Some Sums
	var N, A, B int
	fmt.Scanf("%d %d %d", &N, &A, &B)

	var sum int = 0
	var temp2 int = 0
	for i := 1; i <= N; i++ {
		temp1 := strconv.Itoa(i)
		temp2 = 0
		for j := 0; j < len(temp1); j++ {
			temp2 += int(temp1[j] - '0')
		}
		//temp := i/10 + i%10
		//fmt.Println(temp2)
		if A <= temp2 && temp2 <= B {
			sum += i
		}

	}

	fmt.Println(sum)
}


Measured memory_bytes: 1872
#include<bits/stdc++.h>
// __builtin_ctz : no of trailing zeros
#define ll long long
#define pp pair<ll,ll>
#define mod 1000000007
#define trace(x) cerr<<#x<<": "<<x<<" "<<endl
#define trace2(x, y) cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z) cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define sa(a,n) for(int i =0 ; i<n ; i++) cin>>a[i]
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define scan() int n; cin>>n ; int a[n]; for(int i = 0 ; i<n ; i++) cin>>a[i]
#define print(a,n) for(int i = 0 ; i < n ; i++) cout<<a[i]<<' '
using namespace std;
ll max(ll x, ll y)
{
    return x>y ? x : y;
}
ll min(ll x, ll y)
{
    return x<y ? x : y;
}
ll m;
void _(ll&a , ll b)
{
    a=(a%m+b%m)%m;
    a=(a+m)%m;
}
int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n;cin >> n >> m;ll a[n];
    for (int i = 0; i < n; ++i)
    {
        cin >> a[i];a[i]--;
    }
    // for (int i = 0; i < n; ++i)
    // {
    //     cout << a[i] << " ";
    // }
    cout << "\n";
    map<ll,vector<ll> > mp;ll ans=0;ll d=0;mp[0].push_back(-1);
    for (int i = 0; i < n; ++i)
    {
        _(d,a[i]);
        //if(!d)continue;
        auto it=upper_bound(mp[d].begin(),mp[d].end(),i-m);
        if(it!=mp[d].end())
        {
            ll dd=it-mp[d].begin();
            ans+=mp[d].size()-dd;
        }
        mp[d].push_back(i);
    }
    cout << ans;

    }

Measured memory_bytes: 23680
#include <iostream>

using namespace std;

using ll = long long;

#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define REP(i, n) for(int i=0;i<(n);++i)
#define ALL(v) (v).begin(),(v).end()

typedef pair<int, int> P;

const int MOD = (int) 1e9 + 7;

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

int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }

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

int main(void) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	char grid[100][100];
	FOR(i, 0, 50) {
		REP(j, 100) {
			grid[i][j] = '#';
		}
	}
	FOR(i, 50, 100) {
		REP(j, 100) {
			grid[i][j] = '.';
		}
	}
	
	int a, b;
	cin >> a >> b;
	--a, --b;
	
	int whiteX = 0, whiteY = 0;
	while (a > 0) {
		grid[whiteX][whiteY] = '.';
		whiteY += 2;
		if (whiteY >= 50) {
			whiteX += 2;
			whiteY -= 50;
		}
		--a;
	}
	
	int blackX = 99, blackY = 0;
	while (b > 0) {
		grid[blackX][blackY] = '#';
		blackY += 2;
		if (blackY >= 50) {
			blackX -= 2;
			blackY -= 50;
		}
		--b;
	}
	
	cout << "100 100" << endl;
	REP(i, 100) {
		REP(j, 100) {
			cout << grid[i][j];
		}
		cout << endl;
	}
	
	return 0;
}

Measured memory_bytes: 256
import heapq
from collections import defaultdict, deque
from math import ceil, factorial
from fractions import gcd
import sys

sys.setrecursionlimit(10 ** 7)
INF = float("inf")
MOD = 10 ** 9 + 7

si = lambda: input().strip()
ii = lambda: int(input())
mii = lambda: map(int, input().split())
lmii = lambda: list(map(int, input().split()))
smii = lambda: sorted(map(int, input().split()))


def func(a, b, c):
    if a % 2 or b % 2 or c % 2:
        return 0
    if a == b == c:
        return -1
    return func((b + c) // 2, (a + c) // 2, (b + c) // 2) + 1


A, B, C = mii()

print(func(A, B, C))


Measured memory_bytes: 5052
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <vector>
#include <map>
#include <utility>
#include <complex>
#include <stack>

using namespace std;

typedef complex<double> P;

int main(){

	stack<int> d;
	int x;
	while(cin>>x){
		if(x == 0){
			cout << d.top() << endl;
			d.pop();
		}else {
			d.push(x);
		}
	}

	return 0;
}

Measured memory_bytes: 0
n,k=map(int,input().split())
ans=0
mod=10**9+7
l=[i for i in range(n+1)]
mi=sum(l[:k])
ma=sum(l[n+1-k:])
ans=(ans+(ma-mi+1))%(10**9+7)
for i in range(k+1,n+2):
    mi+=l[i-1]
    ma+=l[-i]
    ans=(ans+(ma-mi+1))%(10**9+7)
print(ans)

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

int main()
{
    int n;
    cin >> n;
    map<string, int> mp;
    int l = 0;
    for(int i = 0; i < n; i++){
        string s;
        cin >> s;
        mp[s]++;
        l = max(l, mp[s]);
    }
    for(auto itr = mp.begin(); itr != mp.end(); itr++){
        if(itr->second == l) cout << itr->first << endl;
    }
}

Measured memory_bytes: 25216
import java.util.*;
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    // 整数の入力
    int a = sc.nextInt();
    // スペース区切りの整数の入力
    int b = sc.nextInt();
    int h = sc.nextInt();
    // 出力
    System.out.println((a+b)*h/2 );
  }
}

Measured memory_bytes: 22740
n = int(input())
s = input()

l = 0
r = 0
p = []
for i in range(n):
  if s[i] == "(": p.append("(")
  else:
    if p == []: l += 1
    else: p.pop()
r = p.count("(")
print("("*l + s + ")"*r)

Measured memory_bytes: 9068
s = input().strip()
l = len(s)

def f(s,c,l,v=1):
    n = 0
    for i in range(l-1):
        if s[i] != c:
            if s[i+1] == c:
                s = s[:i] + c + s[i+1:]
                n += 1
        else:
            n += 1
    # print(s[:-1],v)
    if n < l-1:
        return f(s[:-1], c, l-1, v+1)
    else:
        return v

if s.count(s[0]) == l:
    print(0)
    exit()

min = l 
for i in set(s):
    x = f(s, i, l)
    if min > x:
        min = x
print(min)


Measured memory_bytes: 3064
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <utility>
#include <cmath>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>


using namespace std;

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


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

	int count = 0;
	while(n > 0) {
		n = n / k;
		count++;
	}
	cout << count << endl;

	
	return 0;
}

Measured memory_bytes: 888
import java.util.Scanner;

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

        System.out.println(isTuyoiKaibun(S) ? "Yes" : "No");
    }

    private static boolean isTuyoiKaibun(String s) {
        if (!isKaibun(s)) {
            return false;
        }

        String s2 = s.substring(0, (s.length() - 1) / 2);

        if (!isKaibun(s2)) {
            return false;
        }

        String s3 = s.substring((s.length() + 3 - 1) / 2);

        if (!isKaibun(s3)) {
            return false;
        }

        return true;

    }

    private static boolean isKaibun(String s) {
        String r = new StringBuilder(s).reverse().toString();
        return s.equals(r);
    }
}


Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define de cout<<"debuglandınız\n";
#define N 1048576

int main(){
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	int a,b,c;
  	cin>>a>>b>>c;
  	cout<<min(a+b,min(a+c,b+c));
}

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

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

	cout << (a <= b ? a : (a - 1)) << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<iomanip>
#include<algorithm>
#include<math.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i = 0; i < n; i++)
#define INF (long long)(1e18)
#define MOD (int)(1e9+7)
#define min(a,b) (a>b?b:a)
#define max(a,b) (a>b?a:b)
#define yn(f) (f?"Yes":"No")
#define YN(f) (f?"YES":"NO")s
#define MAX 100100

int A[MAX], B[MAX];
signed main(){
	cout<<fixed<<setprecision(7);
	
	int n, a, t, ans = 0;
	
	cin>>n;
	// cout<<n<<endl;
	for(int i = 0; i < n; i++){
		cin>>A[i];
		
	}
	
	sort(A,A+n);
	// for(int i = 0; i < n; i++){
		// cout<<A[i]<<endl;
	// }
	t = n/2;
	B[t] = A[0];
	for(int k = 1, a = A[0], b = A[0], i = 1, j = n - 1, x = 1; k < n; k++){
		if(x%2==0){
			if(k >= n-1){
				if(abs(a-A[i]) <= abs(b-A[i])){
				ans += abs(b-A[i]);
				b = A[i];
				
				} else {
				ans += abs(a-A[i]);
				a = A[i];
				}
				continue;
			}
			if(k%2){
			// if(abs(a-A[i]) <= abs(b-A[i])){
				ans += abs(b-A[i]);
				b = A[i];
				
			} else {
				ans += abs(a-A[i]);
				a = A[i];
			}
			i++;
		} else{
			// if(abs(a-A[j]) <= abs(b-A[j])){
				if(k >= n-1){
					 if(abs(a-A[j]) <= abs(b-A[j])){
					ans += abs(b-A[j]);
					b = A[j];
				} else {
				
					ans += abs(a-A[j]);
					a = A[j];
				}
				continue;
				}
			if(k%2){
				ans += abs(b-A[j]);
				b = A[j];
			} else {
				
				ans += abs(a-A[j]);
				a = A[j];
			}
			j--;
		}
		if(k%2==0)x++;
		// cout<<a<<" "<<b<<endl;
	}
	// for(int i = 1, j = n-1, x = 1, count = 1; count < n;count++){//cout<<i<<" "<<j<<" "<<x<<" "<<A[i]<<" "<<endl;
		// if(x%2==0){
			// if(count%2==0){
			// B[t+x] = A[i];
			// } else {
			// B[t+(x*(-1))] = A[i];
			// }
			// i++;
		// } else{
			// if(count%2==0){
			// B[t+x] = A[j];
			// } else {
			// B[t+(x*(-1))] = A[j];
			// }
			// j--;
		// }
		// if(count%2==0)x++;
	// }
	cout<<ans<<endl;
	
	return 0;
}

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

using namespace std;

#define INF 100000000
#define YJ 1145141919
#define INF_INT_MAX 2147483647
#define INF_LL 9223372036854775
#define INF_LL_MAX 9223372036854775807
#define EPS 1e-10
#define MOD 1000000007
#define MOD9 998244353
#define Pi acos(-1)
#define LL long long
#define ULL unsigned long long
#define LD long double

#define int long long

using II = pair<int, int>;

int gcd(int a, int b) { return b != 0 ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a * b / gcd(a, b); }
int extgcd(int a, int b, int &x, int &y) { int g = a; x = 1; y = 0; if (b != 0) g = extgcd(b, a % b, y, x), y -= (a / b) * x; return g; }

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(a)  begin((a)), end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())

const int MAX_N = 105;
const int MAX_M = 5;

int N, M;

int myPow(int k) 
{
  if(k <= 0) return 1;
  else return 2 * myPow(k-1);
}

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

  cout << ((N-M) * 100 + M * 1900) * myPow(M) << endl;

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <cmath>
#include <cctype>
#include <sstream>
#include <algorithm>
using namespace std;
#define all(c) (c).begin(), (c).end()
#define iter(c) __typeof((c).begin())
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define tr(c, i) for (iter(c) i = (c).begin(); i != (c).end(); ++i)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)
#define pr(a) cout << (a) << endl
typedef long long ll;
typedef pair<int,int> P;
const int MAX=1000000000;

int main() {
  int d;
  cin >> d;
  vector<P> v;
  for(int j=0; j<2; j++) {
    int n;
    cin >> n;
    for(int i=0; i<n; i++) {
      string s;
      int a;
      cin >> s >> a;
      if(s=="D") v.pb(P(a,1));
      if(s=="DD") v.pb(P(a,2));
    }
  }
  int dp[d+1];
  fill(dp,dp+d+1,0);
  for(int i=0; i<v.size(); i++) {
    for(int j=d; j>=0; j--) {
      if(j+v[i].second<=d) dp[j+v[i].second]=max(dp[j+v[i].second],dp[j]+v[i].first);
    }
  }
  int ans=0;
  for(int i=0; i<=d; i++) ans=max(ans,dp[i]);
  pr(ans);
  return 0;
}


Measured memory_bytes: 1216
#include <iostream>
#include <algorithm>
#include <vector> //動的配列
#include <string>
#include <list> //双方向リスト
#include <map> //連想配列
#include <set> //集合
#include <stack>
#include <queue>
#include <deque>
#include <cmath>
#include <bitset>
#include <numeric>
#include <tuple>



typedef long long ll;


using namespace std;

typedef pair<int, int> P;
#define FOR(i,a,b) for(int i=(int)(a) ; i < (int) (b) ; ++i )
#define rep(i,n) FOR(i,0,n)
#define sz(x) int(x.size())


template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

//小さい順から取り出すヒープ
//priority_queue<ll, vector<ll>, greater<ll> > pque1;

const ll mod = 1e9+7;

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

int main(){
    ll n,k;
    cin >> n>>k;
    vector<ll> di(k+1,0);
    
    
    for (int i=1; i<=k; i++){
        di[i] = modpow( ll(k/i), n, mod);
    }
    
    
    for (int i=k; i>0;i--){
        for (int j=2*i; j<=k; j+=i){
            di[i] += mod-di[j];
            if (di[i]<0) di[i] += mod;
            di[i] %= mod;
        }
    }
    
    //for (auto x:di) cout<<x<<" ";
    ll ans=0;
    for(int i=1; i<=k;i++){
        ans = ( ans+ i*di[i]) % mod;
    }
    
    cout<<ans<<endl;
    
    return 0;
}


Measured memory_bytes: 4032
//
// Created by nhatminh2947 on 7/3/19.
//

#include <bits/stdc++.h>

using namespace std;

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

    int count = 0;

    for (int i = 0; i < s.size(); ++i) {
        for (int j = i + 1; j < s.size(); ++j) {
            if(s[i] == s[j]) {
                count++;
            }
        }
    }

    if(count == 2) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}

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

class Dmondai
{
    static void Main()
    {
        var N = Int32.Parse(Console.ReadLine());
        var listAB = new List<int[]>();
        var listCD = new List<int[]>();
        var count = 2 * N;
        for (int i=0;i<count;++i)
        {
            var line = Console.ReadLine().Split(' ').Select(x => Int32.Parse(x)).ToArray();
            if (i < N) listAB.Add(new int[] { line[0], line[1] });
            else listCD.Add(new int[] { line[0], line[1] });
        }
        listAB = listAB.OrderByDescending(x => x[1]).ThenByDescending(x => x[0]).ToList();
        listCD = listCD.OrderBy(x => x[0]).ThenBy(x => x[1]).ToList();
        var ans = 0;
        for (int i=0;i<N;++i)
        {
            for (int j = 0; j < listAB.Count(); ++j)
            {
                if(listAB[j][0]<listCD[i][0] && listAB[j][1] < listCD[i][1])
                {
                    ans++;
                    listAB.RemoveAt(j);
                    break;
                }
            }
        }
        Console.WriteLine(ans);
    }
}

Measured memory_bytes: 13524
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int n;
int main (){
    cin >> n;
    vector<ll>V(n);

    for(int i=0;i<n;i++)cin>>V[i];

    sort(V.rbegin(),V.rend());
    ll ret=V[0];
    int m = n/2;
    for(int i=2;i<n;i++)ret+=V[i/2];
    cout<<ret<<endl;
    //main();

    return 0;
}

Measured memory_bytes: 4852
#include <iostream>
#include <iomanip>
#include <vector>
#include <unordered_map>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <array>
#include <tuple>
#include <string>
#include <algorithm>
#include <functional>
#include <cmath>
#include <numeric>
#include <bitset>
#include <cstdint>
#include <stdexcept>
using namespace std;

// 整数型

using i32 = int32_t;
using i64 = int64_t;
using u32 = uint32_t;
using u64 = uint64_t;

// [0,n)を昇順/降順でループ

#define rep(i, n) for (int i = 0; i < static_cast<int>(n); ++i)
#define repd(i, n) for (int i = static_cast<int>(n) - 1; i >= 0; --i)

// [a,b)を昇順/降順でループ

#define FOR(i, a, b) for (int i = static_cast<int>(a); i < static_cast<int>(b); ++i)
#define FORD(i, a, b) for (int i = static_cast<int>(b) - 1; i >= static_cast<int>(a); --i)

// デバッグ

#ifdef DEBUG
#include <cassert>
#define my_assert(x) assert(x)
#else
#define my_assert(x)
#define assert(x)
#endif

//////////////// //////////////// //////////////// //////////////// ////////////////
//////////////// //////////////// //////////////// //////////////// ////////////////

int main()
{
    // 高速な入出力
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    // 浮動小数の表示の精度
    cout << setprecision(15);

    int r, c, k;
    cin >> r >> c >> k;
    vector<vector<vector<i64>>> m(r, vector<vector<i64>>(c, vector<i64>(4, 0LL)));
    vector<vector<i64>> items(r, vector<i64>(c, 0LL));
    rep(i, k)
    {
        int ri, ci, vi;
        cin >> ri >> ci >> vi;
        --ri;
        --ci;
        items[ri][ci] = vi;
    }
    rep(cur_row, r)
    {
        rep(cur_column, c)
        {
            rep(cnt, 4)
            {
                if (cur_row > 0)
                {
                    m[cur_row][cur_column][cnt] = m[cur_row - 1][cur_column][0];
                }
                if (cur_column > 0)
                {
                    m[cur_row][cur_column][cnt] = max(m[cur_row][cur_column][cnt], m[cur_row][cur_column - 1][cnt]);
                }
            }
            rep(cnt, 3)
            {
                m[cur_row][cur_column][cnt] = max(m[cur_row][cur_column][cnt], m[cur_row][cur_column][cnt + 1] + items[cur_row][cur_column]);
            }
        }
    }
    cout << m[r - 1][c - 1][0] << endl;

    return 0;
}


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

int main(){
  int N,x;
  cin>>N>>x;
  vector<int> a(N);
  for(int i=0; i<N; i++){
    cin>>a[i];
  }
  sort(a.begin(),a.end());
  int ans=0;
  int tmp=x;
  int cnt=0;
  while(tmp>0 && cnt<N){
    tmp-=a[cnt];
    cnt++;
    if(tmp>=0 && cnt<N){
      ans++;
    }else if(tmp==0){
      ans++;
    }
  }
  cout<<ans<<endl;
  return 0;
}


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

using namespace std;

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

int main() {
	long long a, b;
	cin >> a >> b;
	cout << a * b / gcd(a, b) << endl; 
	return 0;
}

Measured memory_bytes: 256
/********   All Required Header Files ********/
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
using namespace std;
// ****  All Required define Pre-Processors and typedef Constants *******/
#define mem(a, b) memset(a, (b), sizeof(a))
#define FOR(i, j, k, in) for (int i=j ; i<k ; i+=in)
#define RFOR(i, j, k, in) for (int i=j ; i>=k ; i-=in)
#define fl(i, j) FOR(i, 0, j, 1)
#define RREP(i, j) RFOR(i, j, 0, 1)

#define fi(it, l) for (auto it = l.begin(); it != l.end(); it++)

#define PB push_back
#define INF (int)1e9
#define EPS 1e-9
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
const double pi=acos(-1.0);
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<PII> VII;
typedef vector<VI> VVI;
typedef map<int,int> dmap;
typedef set<int> dset;
typedef long int int32;
typedef unsigned long int uint32;
typedef long long int int64;
typedef unsigned long long int  uint64;
/********** solver function **********/
// int solve(){
	
// }
/********** Main()  function **********/
int main()
{
	int N,X,T;
    cin>>N>>X>>T;
    //long long int x=N/x;
    int r=N%X;
    if( r==0)
    cout<<(((N/X))*T)<<endl;
    else
    cout<<(((N/X)+1)*T)<<endl;
	return 0;
}

Measured memory_bytes: 3604
#include <algorithm>
#include <array>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <vector>
using namespace std;
#define int long long

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

    cout << fixed << setprecision(16);

    int r;
    cin >> r;

    cout << 2 * M_PI * r << endl;
}


Measured memory_bytes: 3788
#include <bits/stdc++.h>
using namespace std;
const int N=3050;
const int mod=1e9+7;
int add(int x, int y){ x+=y;return x>=mod?x-mod:x;}
int sub(int x, int y){ x-=y;return x<0?x+mod:x;}
int dp[N],p[N];
char str[N];
int main()
{
	int n;
	scanf("%i",&n);
	scanf("%s",str+2);
    dp[1]=1;
	for(int i=2;i<=n;i++)
	{
		for(int j=1;j<i;j++)
			p[j]=add(p[j-1],dp[j]);
		for(int j=1;j<=i;j++)
		{
			if(str[i]=='<')
			{
				dp[j]=p[j-1];
			}
			else
			{
				dp[j]=sub(p[i-1],p[j-1]);
			}
		}
	}
	int ans=0;
	for(int i=1;i<=n;i++)
		ans=add(ans,dp[i]);
	printf("%i\n",ans);
	return 0;
}

Measured memory_bytes: 256