akhauriyash/Code-Regression huggingface dataset:
using System.Collections.Generic;
using System.Linq;
using System;

public class P
{
    public int x { get; set; }
    public int y { get; set; }
}

public class Q
{
    public int x { get; set; }
    public int y { get; set; }
    public int L { get; set; }
}

public class Hello
{
    public static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var h = int.Parse(line[0]);
        var w = int.Parse(line[1]);
        var n = int.Parse(line[2]);
        var map = new int[h, w];
        var d = new Dictionary<int, P>();
        for (int i = 0; i < h; i++)
        {
            var s = Console.ReadLine().Trim();
            for (int j = 0; j < w; j++)
            {
                if (s[j] == 'S') { d[0] = new P { x = i, y = j }; map[i, j] = -10; }
                else if (s[j] == 'X') map[i, j] = -1;
                else if (s[j] == '.') map[i, j] = -10;
                else
                {
                    var wt = int.Parse(s[j].ToString());
                    map[i, j] = -10;
                    d[wt] = new P { x = i, y = j };
                }
            }
        }
        var count = 0;
        for (int i = 1; i <= n; i++)
        {
            var start = new P { x = d[i - 1].x, y = d[i - 1].y };
            var g = new P { x = d[i].x, y = d[i].y };
            var map2 = new int[h, w];
            Array.Copy(map, map2, map.Length);
            count += goBfs(map2, start, g);
        }
        Console.WriteLine(count);
    }
    public static int goBfs(int[,] map, P s, P g)
    {
        var h = map.GetLength(0);
        var w = map.GetLength(1);
        var dx = new int[] { 0, 1, 0, -1 };
        var dy = new int[] { 1, 0, -1, 0 };
        var q = new Queue<Q>();
        q.Enqueue(new Q { x = s.x, y = s.y, L = 0 });
        map[s.x, s.y] = 0;
        while (q.Count() > 0)
        {
            var t = q.Dequeue();
            if (t.x == g.x && t.y == g.y) return t.L;
            for (int i = 0; i < 4; i++)
            {
                var nx = t.x + dx[i];
                var ny = t.y + dy[i];
                if (nx >= 0 && nx < h && ny >= 0 && ny < w && map[nx, ny] == -10)
                { map[nx, ny] = t.L + 1; q.Enqueue(new Q { x = nx, y = ny, L = t.L + 1 }); }
            }
        }
        return 0;
    }
}






Measured memory_bytes: 32944
def main():
  N = int(input())
  s = str(input())
  num_bit = 0
  for i in range(N):
    if s[i] == '1':
      num_bit += 1
  ans_1 = 0#bit 0 to 1のときpopcount (n) = num_bit + 1
  for i in range(N):
    if s[N-1-i] == "1":
      ans_1 += pow(2, i, num_bit+1)
      ans_1 %= (num_bit+1)
  ans_2 = 0
  if num_bit > 1:
    for i in range(N):
      if s[N-1-i] == "1":
        ans_2 += pow(2, i, num_bit-1)
        ans_2 %= (num_bit-1)
  ans = [0] * N
  for i in range(N):
    ans_temp = 1
    if s[N-1-i] == '1':
      if num_bit == 1:
        f = 0
        ans_temp = 0
      else:
        f = ans_2 - pow(2, i, num_bit-1)#1bitだけ1に注意
        f %= (num_bit-1)
    else:
      f = ans_1 + pow(2, i, num_bit + 1)
      f %= (num_bit+1)
    while f != 0:
      f = f % bin(f).count('1')
      ans_temp += 1
    ans[N-1-i] = ans_temp
  for i in ans:
    print(i)
  
if __name__ == "__main__":
  main()

Measured memory_bytes: 11112
#include <bits/stdc++.h>
using namespace std;
using ll = long long;


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

    if (s.size() <= k) cout << s << endl;
    else
    {
        for (int i = 0;i < k;i++)
        {
            cout << s[i];
        }
        cout << "..." << endl;
    }
    
    return 0;
}


Measured memory_bytes: 3624
from operator import itemgetter
N, M = map(int, input().split())
c=[]
for i in range(M):
	c.append(list(map(int, input().split())))
for i in range(M):
	c[i].append(i)
C = sorted(sorted(c,key=itemgetter(1)), key=itemgetter(0))
x = 0
for i in range(M):
	if i > 0  and C[i][0] - C[i-1][0] != 0:
		x = 1
	else:
		x += 1
	C[i].append(x)
c = sorted(C, key=itemgetter(2))
for i in range(M):
	print("{:06d}{:06d}".format(c[i][0], c[i][3]))

Measured memory_bytes: 37356
using System;
public class Program {
	public static void Main() {
		int N = int.Parse(Console.ReadLine());
		if(N == 1) {
			Console.WriteLine("Hello World");
		}
		else {
			int A = int.Parse(Console.ReadLine());
			int B = int.Parse(Console.ReadLine());
			Console.WriteLine(A + B);
		}
	}
}

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

using namespace std;
const int MAX = 1e5 + 5;

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    
    int n , k ;
    cin>>n>>k;
    
    priority_queue<int>pq;
    for(int i =0 ; i < n ; i++) {
        int tmp;
        cin>>tmp;
        pq.push(tmp);
    }
    
    for(int i =0 ; i <k ; i++ ) {
        int top = pq.top();
        pq.pop();
        pq.push(top/2);
    }
    long long int ans = 0;
    while( !pq.empty()) {
        ans += pq.top();
        pq.pop();
    }
    cout<<ans<<'\n';
    return 0;
}

Measured memory_bytes: 892
#include<cstdio>
#include<functional>
#include<algorithm>
#include<cstring>
using namespace std;
int main(void)
{
	char s[11];
	int i,len,cnt,mx;
	scanf("%s",s);
	len=strlen(s);
	cnt=0;	mx=0;
	for(i=0;i<len;i++)	{
		if(s[i]=='A' || s[i]=='C' || s[i]=='G' || s[i]=='T')	{
			cnt++;
			mx=max(cnt,mx);
		}
		else cnt=0;
	}
	printf("%d\n",mx);
	return 0;
}


Measured memory_bytes: 128
import Data.List

toInt :: String -> Int
toInt = read :: String -> Int

main = do
  [a, b, c, x, y] <- map toInt . words <$> getLine
  print $ minimum [a*x+b*y, c*x*2+b*(max (y-x) 0), a*(max (x-y) 0)+c*y*2]


Measured memory_bytes: 3936
#include <iostream>
#include <string>
#include <cstring>
#include <cmath>
#include <cstdio>
#include <algorithm>
using namespace std;
#define ll long long
int main (){
    int x,y,z;
    int count = 0;
    cin >> x >> y >> z;
    x -= z*2;
    while (1){
        x -= y+z;
        if (x<0) {
            if (x+z>=0) count++;
            break;
        }
        count++;
    }
    cout << count << endl;
    return 0;
}



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


int main()
{

  ios::sync_with_stdio(0);
  cin.tie(0);
  int a,b;
  cin>>a>>b;
  if(a<10&&b<10){cout<<a*b;}
  else{cout<<-1;}

  return 0;
}

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

// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// #include <ext/pb_ds/detail/standard_policies.hpp>

using namespace std;
// using namespace __gnu_pbds;
typedef long double ld;
typedef long long ll;
#define int ll
#define endl "\n"
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(c) c.begin(), c.end()
#define vi vector<int>
#define pii pair<int,int>
#define For(i,s,e) for (ll i=(s); i<(e); i++)
#define initialize(arr,elem) memset(arr,elem,sizeof(arr))
#define sz size
const int MOD = 1e9+7;
const int MAX_SZ = 2e5+9;
const int INF = 1e18+9;

// typedef tree< int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
int n,d;
string s;
int dp[10003][101][2];


void rand_shuff(vi &arr){
	random_device rd;
	mt19937 g(rd());
	shuffle(all(arr),g);
}
int solve(int k, int su, int check){
	if (k<=0) return 0;
	if (dp[k][su][check] != -1) return dp[k][su][check];
	int cur = s[n-k] - '0';
	if (k==1){
		if (check){
			int res = 0;
			For(i,0,10){
				if (i%d == su) res++;
			}
			return dp[k][su][check] = res%MOD;
		}
		else{
			int res = 0;
			For(i,0,cur+1){
				if (i%d == su) res++;
			}
			return dp[k][su][check] = res%MOD;
		}
	}

	if (check){
		int res = 0;
		For(i,0,10){
			res += solve(k-1,(su-(i%d)+d)%d,check);
			res %= MOD;
		}
		return dp[k][su][check] = res%MOD;
	}
	else{
		int res = 0;
		//cout<<"in\n";
		res += solve(k-1,(su-cur+d)%d,0);
		res%= MOD;
		For(i,0,cur){
			res += solve(k-1,(su-i+d)%d,1);
			res %= MOD;
		}
		return dp[k][su][check] = res%MOD;
	}


}

signed main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	
	cin>>s;
	cin>>d;
	n = s.sz();

	initialize(dp,-1);

	cout<<(solve(n,0,0)-1+MOD)%MOD<<endl;

	return 0;
}


Measured memory_bytes: 16896
//ITP1_8_C
#include<iostream>
#include<stdio.h>
using namespace std;
	
int moji[26];

int main(){
	int i;
	char ch;
	
	while(cin>>ch){
		if('a'<=ch&&ch<='z')
			moji[ch-'a']++;
			
		else if('A'<=ch&&ch<='Z')
			moji[ch-'A']++;
		else if(cin.eof())
			break;
	}
	
	for(i=0;i<26;i++)
		cout<<(char)('a'+i)<<" : "<<moji[i]<<endl;
	
	return 0;
}

Measured memory_bytes: 1140
#include <stdio.h>

int main(void) {
	int i,j,k,n,b,f,r,v,p[4][3][10]={0};
	char fence[]="####################";
	scanf("%d",&n);
	while (n--){
		scanf("%d %d %d %d",&b,&f,&r,&v);
		p[b-1][f-1][r-1]+=v;
	}
	for (i=0;i<4;i++){
		for (j=0;j<3;j++){
			for (k=0;k<10;k++){
				printf(" %d",p[i][j][k]);
			}
			printf("%c",'\n');
		}
		if (i!=3) printf("%s\n",fence);
	}
	return 0;
}

Measured memory_bytes: 612
#include<bits/stdc++.h>
#define int           long long
#define pb            push_back
#define ppb           pop_back
#define si            set <int>
#define endl          '\n'
#define fr            first
#define sc            second     
#define rep(i,a,b)    for(int  i=a;i<b;i++)
#define repr(i,a,b)      for(int i=b-1;i>=a;i--)
#define trav(it,v)      for(auto it=v.begin();it!=v.end();it++)
#define all(v)        v.begin(),v.end()
#define srt(v)        sort(all(v))
#define vs            vector<string>
#define sz(x)         (int )x.size()
#define M             1000000007
#define bs            binary_search
#define sp(n)         setprecision(n)
#define spl           " "
#define arr(a,n)      rep(i,0,n) cin>>a[i]
#define mod           998244353
#define MAXN          1000000000000000000

using namespace std;

bool sortinrev(const pair<int,int> &a,  
               const pair<int,int> &b) 
{ 
       return (a.first > b.first); 
} 


//int dx[4]={0,0,1,-1};
//int dy[4]={1,-1,0,0};
// vector<int>adj[100001];
// int vis[100001]={0};
// vector<int>v1;

void solve()
{
    int n;
    cin>>n;
    int sum=0;
    rep(i,1,n+1)
    {
        if(i%3!=0 && i%5!=0)
            sum+=i;
    }
    cout<<sum;



}   
    


signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    
    int t=1;
    //cin>>t;
    while(t--)
    {
        solve();
    }
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A, B,C;

  cin >> A >> B;

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

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;


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

	int dp[100001][3];

	for (int j = 0; j < 3; j++) dp[0][j] = 0;

	for (int i = 1; i <= n; i++) {
		int k[3];

		for (int j = 0; j < 3; j++) {
			cin >> k[j];
			dp[i][j] = 0;
			for (int l = 0; l < 3; l++) {
				if (j == l) continue;
				dp[i][j] = max(dp[i - 1][l] + k[j], dp[i][j]);
			}
		}
	}

	cout << max(max(dp[n][0], dp[n][1]), dp[n][2]) << endl;
}

Measured memory_bytes: 1408
#include <iostream>


#include <stdlib.h>
#include <stdio.h>
#include <iostream>
#include <string.h>
#include <string>
#include <vector>
using namespace std;
#include <stdio.h>
#include <vector> 
#include <map> 
#include <algorithm>
#include <functional>
#include <algorithm>
#include <functional>
#include <array>
#include <iostream>

#include<iostream>
using namespace std;
int main()
{
	std::vector<int> aa;
	int nn[1000];
	int a, c;
	std::string s;
	cin >> a;


	for (int i = 0; i < a; ++i) {
		int n;
		cin >> n;
		aa.push_back(n);
	}
	std::sort(aa.begin(), aa.end());
	
	double d = aa[0];
	for (int i = 1; i < aa.size(); ++i) {
		d += aa[i];
		d /= 2.0;
	}

	printf("%f\n", d);


	return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <iomanip>



int main()
{
    long A,B,M;
    std::cin >> A >> B >> M;
    std::vector<long> a,b,x,y,c;

    for(long i=0; i<A; i++){
        long temp;
        std::cin >> temp;
        a.push_back(temp);
    }
    for(long i=0; i<B; i++){
        long temp;
        std::cin >> temp;
        b.push_back(temp);
    }
    for(long i=0; i<M; i++){
        long temp1,temp2,temp3;
        std::cin >> temp1 >> temp2 >> temp3 ;
        x.push_back(temp1);
        y.push_back(temp2);
        c.push_back(temp3);
    }

    std::vector<long> result;
    for(long i=0; i<M; i++){
        result.push_back(a[x[i]-1]+b[y[i]-1]-c[i]);
    }
    std::sort(a.begin(),a.end());
    std::sort(b.begin(),b.end());
    result.push_back(a[0]+b[0]);
    std::sort(result.begin(),result.end());
    std::cout << result[0] << std::endl;
    return 0;
}

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



int main()
{
    int n, i, ii, j, k, m, p=0, c;
    cin>>n>>m;
    for(ii=4; ii<=n; ii++){
        for(i=2; i<=9; i++){
            c=0;
            for(j=2; j<=9; j++){
                k=i*10+j;
                if(i*j==ii && k<=m){
                    p++;
                }
                if(k>m){
                    c=1;
                    break;
                }
            }
            if(c==1)break;
        }
    }
    cout<<p<<endl;


    return 0;
}





Measured memory_bytes: 256
#include <bits/stdc++.h>  
using namespace std;
#define _GLIBCXX_DEBUG
typedef long long  ll;
void x(){
  int n,m;
  cin>>n>>m;
  if(n==1&&m==0){
    cout<<0;
    return;}
  vector<int> number(n,0);
  
  
  vector<vector<int>> vec(m,vector<int>(2));
  for(int i=0; i<m; i++)cin>>vec.at(i).at(0)>>vec.at(i).at(1);
  if(n==1&&m==1&&vec.at(0).at(0)==1&&vec.at(0).at(1)==0){cout<<0;return;}
  for(int i=0; i<m; i++){
      if((vec.at(i).at(0)==1&&vec.at(i).at(1)==0)){cout<<-1;return;}
    for(int j=0; j<i; j++)
      if(vec.at(i).at(0)==vec.at(j).at(0)
          &&vec.at(i).at(1)!=vec.at(j).at(1)){
        cout<<-1;
        return;
      }
    }
  
  for(int i=0; i<m;i++)number.at(vec.at(i).at(0)-1)=vec.at(i).at(1);
  if(number.at(0)==0)number.at(0)=1;
  for(int i=0; i<n; i++){cout<<number.at(i);}
  return;
}

int main() {
  
  x();
}






Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int nc = n;
        int sn = 0;
        while (true) {
            sn += nc % 10;
            nc /= 10;
            if (nc == 0)
                break;
        }
        if (n % sn == 0)
            System.out.println("Yes");
        else
            System.out.println("No");
    }
}

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

class Main {

	public static void main(String[] args) throws Exception {
		final Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int K = sc.nextInt();

		int[][] sum = new int[K * 2][K * 2];
		for (int i = 0; i < N; i++) {
			int x = sc.nextInt();
			int y = sc.nextInt();
			String c = sc.next();
			if (c.charAt(0) == 'W') {
				x += K;
			}
			x %= (2 * K);
			y %= (2 * K);
			sum[x][y]++;
		}

		for (int i = 0; i < K * 2; i++) {
			for (int j = 0; j < K * 2; j++) {
				if (i >= 1) sum[i][j] += sum[i - 1][j];
				if (j >= 1) sum[i][j] += sum[i][j - 1];
				if (i >= 1 && j >= 1) sum[i][j] -= sum[i - 1][j - 1];
			}
		}

		int answer = 0;
		for (int i = 0; i < K; i++) {
			for (int j = 0; j < K; j++) {
				int a = 0;
				a += sum[i][j];
				a += sum[i + K][j + K] - sum[i][j + K] - sum[i + K][j] + sum[i][j];
				a += sum[i][2 * K - 1] - sum[i][j + K];
				a += sum[2 * K - 1][j] - sum[i + K][j];
				a += sum[2 * K - 1][2 * K - 1] - sum[i + K][2 * K - 1] - sum[2 * K - 1][j + K] + sum[i + K][j + K];
				answer = Math.max(answer, Math.max(a, N - a));
			}
		}

		System.out.println(answer);
	}
}


Measured memory_bytes: 107588
#include <cstdio>
#include <iostream>
#include <vector>
#include <list>
#include <cmath>
#include <algorithm>
#include <fstream>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <complex>
#include <iterator>
#include <cstdlib>
#include <cstring>
#include <sstream>
#include <stack>
#include <climits>

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
double EPS =1e-10;
double EQ(double a,double b){
	return abs(a-b)<EPS;
}

void fast_stream(){
	std::ios_base::sync_with_stdio(0);
}

void solve(){
	int n;
	while(cin>>n,n){
		int y,b,r,t,ans=-1;
		cin>>y;
		double p=0,q;
		for(int i=0;i<n;i++){
			cin>>b>>r>>t;
			if(t==1) q=(double)(1+y*(double)r/100);
			else{
				q=1;
				for(int j=0;j<y;j++){
					q*=(double)(1+(double)r/100);
				}
			}
			if(p<q) ans=b,p=q;
		}
		cout<<ans<<endl;
	}
}

int main(){
	solve();
}

Measured memory_bytes: 0
#include<stdio.h>
#include<stdlib.h>

int pop();
void push(int);
int stack[1000];
int ppp=0;
void push(int o){
  stack[ppp++]=o;
}
int pop(){
  if(ppp<=0)return 0;
  return stack[--ppp];
}

int main(){
  int o,k=0,Ans,a,b;
  char t[100];
  while(scanf("%s",t)!=EOF){
    if(t[0]=='+'){
      a=pop();
      b=pop();
      Ans=a+b;
      push(Ans);
    }
    else if(t[0]=='-'){
      a=pop();
      b=pop();
      Ans=b-a;
      push(Ans);
    }
    else if(t[0]=='*'){
      a=pop();
      b=pop();
      Ans=a*b;
      push(Ans);
    }
    else{
      o=atoi(t);
      push(o);
    }
  }
  Ans=pop();
  printf("%d\n",Ans);
  return 0;
}



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

#define rep(i,n) for(i = 0;i < n;++i)
#define all(v) v.begin(), v.end()
using ll = long long;

int main()
{
    ll i,j;
    double n,m,d;
    cin >> n >> m >> d;
    double ans;
    if(abs(d) > 0.1){
        ans = 2*(n-d)/(n*n)*(m-1.0);
    }else{
        ans = (n-d)/(n*n)*(m-1.0);
    }
    
    cout << fixed << setprecision(10) << ans << endl;

    return 0;
}

Measured memory_bytes: 256
import itertools

N,M,X = map(int, input().split())

C = []
for c in range(N):
    C.append(list(map(int, input().split())))

ans = float('inf')
L = list(range(N))
for i in range(1, N+1):
    for comb in itertools.combinations(L, i):
        kingaku = 0
        TM = [0]*M
        for c in comb:
            kingaku += C[c][0]
            for i in range(1,M+1):
                TM[i-1] += C[c][i]
        isOk = True
        for m in TM:
            if m < X:
                isOk = False
                break

        if isOk:
            ans = min(ans, kingaku)

if ans == float('inf'):
    print("-1")
else:
    print(ans)

Measured memory_bytes: 9152
#pragma GCC optimize(3,"Ofast","inline")
#pragma GCC target("avx")
#include <bits/stdc++.h>
using namespace std;
template<class t> inline t read(t &x){
	char c=getchar();bool f=0;x=0;
	while(!isdigit(c)) f|=c=='-',c=getchar();
	while(isdigit(c)) x=(x<<1)+(x<<3)+(c^48),c=getchar();
	if(f) x=-x;return x;
}
template<class t> inline void write(t x){
	if(x<0) putchar('-'),write(-x);
	else{if(x>9) write(x/10);putchar('0'+x%10);}
}

#define int long long

const int mod=1e9+7,N=4e6+5;
int n,m,pw0[N],pw1[N],ans,fac[N],ifac[N],inv[N];
char s[N];

int C(int n,int m){
	return fac[n]*ifac[m]%mod*ifac[n-m]%mod;
}

signed main(){
  	read(n);
	scanf("%s",s+1);
	m=strlen(s+1);n+=m;
	if(n<m) return write(0),0;
	pw0[0]=pw1[0]=fac[0]=inv[1]=ifac[0]=1;
	for(int i=1;i<=n+n;i++) fac[i]=fac[i-1]*i%mod;
	for(int i=2;i<=n+n;i++) inv[i]=(mod-mod/i)*inv[mod%i]%mod;
	for(int i=1;i<=n+n;i++) ifac[i]=ifac[i-1]*inv[i]%mod;
	for(int i=1;i<=n+n;i++) pw0[i]=pw0[i-1]*25%mod,pw1[i]=pw1[i-1]*26%mod;
	n-=m;
	for(int i=0;i<=n;i++) ans=(ans+pw0[i]*pw1[n-i]%mod*C(i+m-1,m-1)%mod)%mod;
	write(ans);
}


Measured memory_bytes: 160888
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define endl "\n"
#define se second
#define ll long long
//priority_queue<int, vector<int>, greater<int> > pq;
#define _CRT_SECURE_NO_DEPRECATE
const int N = 300030;
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
const ll mod =  1e9+7;
   ll dam[N];
int main()
{
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
   ll n;
   ll sum=0;
   cin>>n;
   ll arr[n];


   rep(i,0,n){

   cin>>arr[i];
   sum+=arr[i];}

	 ll x=(sum);
	 for(ll i=1;i<n;i+=2)
	 {

	x-=2*arr[i];

	 }
	 cout<<x<<" ";
rep(i,0,n-1)
{
	cout<<2*arr[i]-x<<" ";
	x=2*arr[i]-x;
}
   

}






Measured memory_bytes: 2176
import sys

read = sys.stdin.read
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7


def main():
    n = int(input())
    a = list(map(int, input().split()))
    b = sum(a) / n
    c = [abs(b - a[i]) for i in range(n)]
    print(c.index(min(c)))


if __name__ == '__main__':
    main()


Measured memory_bytes: 9192
import heapq as hq
class UnionFind(object):
    def __init__(self, size):
        self.parent = [i for i in range(size)]
        self.rank = [0]*size
    def find(self, x):
        if self.parent[x] == x:
            return x
        self.parent[x] = self.find(self.parent[x])
        return self.parent[x]
    def unite(self, x, y):
        x, y = self.find(x), self.find(y)
        if x == y:
            return
        if self.rank[x] < self.rank[y]:
            self.parent[x] = y
        else:
            self.parent[y] = x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1
    def same(self, x, y):
        return self.find(x) == self.find(y)
N = int(input())
ls = []
rs = []
ind = 0
inds = dict()
for _ in range(N):
    x,y = map(int,input().split())
    if (x,y) not in inds.keys():
        ls.append((x,y))
        rs.append((y,x))
        inds[(x,y)] = ind
        ind += 1
N = ind
ls.sort()
rs.sort()
uf = UnionFind(N)

edges = []
for i in range(N-1):
    x = ls[i][0]
    a = ls[i+1][0]
    y = ls[i][1]
    b = ls[i+1][1]
    d = min(abs(x-a), abs(y-b))
    edges.append((d,(x,y),(a,b)))
    x = rs[i][1]
    a = rs[i+1][1]
    y = rs[i][0]
    b = rs[i+1][0]
    d = min(abs(x-a), abs(y-b))
    edges.append((d,(x,y),(a,b)))
edges.sort(key=lambda x:x[0])
ans = 0
for d,i,j in edges:
        # 閉路ができない場合追加する
        if not uf.same(inds[i],inds[j]):
            uf.unite(inds[i],inds[j])
            ans += d
print(ans)

Measured memory_bytes: 95880
#include <stdio.h>

int main() {
	int a = 0;
	int b = 0;
	scanf("%d %d", &a, &b);

	if (a < b) {
		printf("a < b\n");
	}
	else if (b < a) {
		printf("a > b\n");
	}
	else {
		printf("a == b\n");
	}

	return 0;
}

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

//////全探索したいときに開けよ////////
vector<vector<int>> fspattern;
vector<int> fspattern_draft;
int fspcnt = 0;

void setfspattern_core(int floor,int number,int degree){
  if(floor==degree){
    fspattern.at(fspcnt) = fspattern_draft;
    fspcnt++;
  }else{
    rep(i,number){
      fspattern_draft.at(floor) = i;
      setfspattern_core(floor+1,number,degree);
    }
  }
}

void setfspattern(int number,int degree){
  int64_t array_num = 1;
  rep(i,degree){
    array_num *= number;
  }
  fspattern = vector<vector<int>>(array_num,vector<int>(degree));
  fspattern_draft = vector<int>(degree);
  setfspattern_core(0,number,degree);
}

//////nCrのmodを求めたいときに開けよ/////////
//int64_t univMod = 1000000007;
//int64_t factnum = 100000
//vector<int64_t> modfact(factnum);
//vector<int64_t> modinvfact(factnum);

/*void setmodfact(){
  for(int i=0;i<factnum;i++){
    if(i == 0){
      modfact.at(i) = 1;
    }else{
      modfact.at(i) = (modfact.at(i-1)*i)%univMod;
    }
  }
}

int64_t calcmodpower(int64_t a,int64_t n){
  int64_t res = 1;
  while(n != 0){
    if(n & 1){
      res = (res * a) % univMod;
    }
    a = (a*a) % univMod;
    n = n >> 1;
  }
  return res;
}

int64_t calcinverse(int64_t n){
	return calcmodpower(n,univMod-2);
}

void setmodinvfact(){
  for(int i=0;i<factnum;i++){
    if(i==0){
      modinvfact.at(i) = 1;
    }else{
      modinvfact.at(i) = calcmodpower(modfact.at(i),univMod-2);
    }
  }
}

int64_t calcmodcomb(int64_t n,int64_t r){
  return (((modfact.at(n)*modinvfact.at(r))%univMod)*modinvfact.at(n-r))%univMod;
}

int64_t calcmodpositive(int64_t n){
  return (n + ((abs(n)+univMod-1)/univMod)*univMod)%univMod;
}
  
    */


/*
int64_t calcGCD(int64_t a,int64_t b){
	int64_t p = a;
	int64_t q = b;
	int64_t c = a%b;
	while(c != 0){
		p = q;
		q = c;
		c = p%q;
	}
	return q;
}
*/

int main(){
  int a,b,c;
  cin >> a >> b >> c;
  if(a+b == c || a+c == b || b+c == a){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
var
    x:int64;
    n:longint;
function ans(x,y:longint):int64;
var 
    i:longint;
    s:int64;
begin
    s:=1;
    for i:=1 to x do s:=s shl 1+y;
    exit(s);
end;
function fac(a:longint; b:int64):int64;
var
    t1,t2:int64;
begin
    if b<=0 then exit(0);
    if (a>0) and (b=1) then exit(0);
    if a=0 then 
        if b>=1 then exit(1)
        else exit(0);
    t1:=ans(a-1,1);
    t2:=ans(a-1,3);
    if b<=t2+1 then exit(fac(a-1,b-1));
    exit(t1+1+fac(a-1,b-t2-2));
end;
begin
    read(n,x);
    writeln(fac(n,x));
end.

Measured memory_bytes: 128
import java.util.*;
import java.io.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
import static java.lang.Math.*;

public class Main{

	int INF = 1 << 28;
	//long INF = 1L << 62;
	double EPS = 1e-10;

	void run() {
		Scanner sc = new Scanner(System.in);
		for(;;) {
			int n = sc.nextInt(), m = sc.nextInt();
			if( (n|m) == 0) break;
			
			int[][] cost, time;
			cost = new int[m][m]; time = new int[m][m];
			for(int[] a: cost) fill(a, INF);
			for(int[] a: time) fill(a, INF);
			
			
			for(int i=0;i<n;i++) {
				int x = sc.nextInt()-1, y = sc.nextInt() -1,
					c = sc.nextInt(), t = sc.nextInt();
				cost[x][y] = cost[y][x] = min(cost[x][y], c);
				time[x][y] = time[y][x] = min(time[x][y], t);
			}
			for(int i=0;i<m;i++) cost[i][i] = time[i][i] = 0;

			for(int k=0;k<m;k++) for(int i=0;i<m;i++) for(int j=0;j<m;j++) {
				cost[i][j] = min(cost[i][j], cost[i][k] + cost[k][j]);
				time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
			}
			
			int k = sc.nextInt();
			for(int i=0;i<k;i++) {
				int p = sc.nextInt() - 1, q = sc.nextInt() - 1, r = sc.nextInt();
				if(r == 0) {
					System.out.println(cost[p][q]);
				}
				else {
					System.out.println(time[p][q]);
				}
			}
		}
	}

	void debug(Object... os) {
		System.err.println(Arrays.deepToString(os));
	}

	public static void main(String[] args) {
		new Main().run();
	}
}

Measured memory_bytes: 64252
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <iostream>

using namespace std;

const int MAX = 2000000;
int S[MAX + 1];
int H = 0;

void maxHeapify(int A[], int n, int i) {

	int largest = i;
	int l = i * 2;
	int r = i * 2 + 1;

	if (l <= n && A[l] > A[i])
		largest = l;
	if (r <= n && A[r] > A[largest])
		largest = r;

	if (largest != i) {
		swap(A[i], A[largest]);
		maxHeapify(A, n, largest);
	}
}
void buildMaxHeap(int A[], int n) {
	for (int i = n / 2; i >= 1; --i)
		maxHeapify(A, n, i);
}
void insert(int S[], int k) {
	++H;
	S[H] = k;

	int i = H;
	while (i > 1 && S[i / 2] < S[i]) {
		swap(S[i / 2], S[i]);
		i = i / 2;
	}

}

int extract(int S[]) {
	int ret = S[1];
	swap(S[1], S[H]);
	--H;
	maxHeapify(S, H, 1);

	return ret;
}

int main() {

	while (1) {
		char order[7];
		scanf("%s", order);

		int k;
		if (strcmp(order, "insert") == 0) {
			scanf("%d", &k);
			insert(S, k);
		} else if (strcmp(order, "extract") == 0) {
			cout << extract(S) << endl;
		} else {
			break;
		}
	}
	return 0;

}

Measured memory_bytes: 6920
#include<iostream>
#include<vector>

using namespace std;

void PutBlock(vector< vector<int> >&, int, int, int, int);
void CheckMaze1(vector< vector<int> >&, int&, int, int, int, int, int);
void CheckMaze2(vector< vector<int> >&, int&, int, int, int, int, int);

int main(){
  int i, w, h, n, xs, ys, xg, yg, c, d, x, y, color, ans;
  vector<int> _data;
  vector< vector<int> > data;

  while(1){
    cin >> w >> h;
    if(w == 0 && h == 0) break;

    for(i=0; i<w; ++i)
      _data.push_back(0);

    for(i=0; i<h; ++i)
      data.push_back(_data);

    cin >> ys >> xs;
    cin >> yg >> xg;
    --xs;
    --xg;
    --ys;
    --yg;

    cin >> n;

    for(i=0; i<n; ++i){
      cin >> c >> d >> y >> x;
      PutBlock(data, c, d, x-1, y-1);
    }

    color = data[xs][ys];

    ans = 0;
    CheckMaze1(data, ans, color, xs, ys, xg, yg);

    if(ans == 1)
      cout << "OK" << endl;
    else
      cout << "NG" << endl;

    _data.clear();
    data.clear();
  }

  return 0;
}

void PutBlock(vector< vector<int> >& data, int c, int d, int x, int y){
  int i, j;
  if(d == 0){
    for(i=x; i<x+2; ++i){
      for(j=y; j<y+4; ++j)
	data[i][j] = c;
    }
  }else{
    for(i=x; i<x+4; ++i){
      for(j=y; j<y+2; ++j)
	data[i][j] = c;
    }
  }
}

void CheckMaze1(vector< vector<int> >& data, int& ans, int color, int x, int y, int xg, int yg){
  data[x][y] = -1;
  if(x == xg && y == yg) ans = 1;

  CheckMaze2(data, ans, color, x-1, y, xg, yg);
  CheckMaze2(data, ans, color, x, y-1, xg, yg);
  CheckMaze2(data, ans, color, x+1, y, xg, yg);
  CheckMaze2(data, ans, color, x, y+1, xg, yg);
}

void CheckMaze2(vector< vector<int> >& data, int& ans, int color, int x, int y, int xg, int yg){
  if(x > -1 && x < data.size() && y > -1 && y < data[0].size() && data[x][y] == color)
    CheckMaze1(data, ans, color, x, y, xg, yg);
}

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

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

#define rep(i,cc,n) for(int i=cc;i<n;++i)
#define lrep(i,cc,n) for(long long i=cc;i<n;++i)
#define sqrep(i,cc,n) for(long long i=cc;i*i<=n;++i)
#define rrep(i,cc,n) for(long i=cc;i>n;--i)
#define pii pair<int, int>
#define pll pair<long long, long long>
 
using ll = long long;

const vector<int> dx = {1, 0, -1, 0};
const vector<int> dy = {0, 1, 0, -1};
const double PI = 3.1415926535;
const ll inf = 1001001001;
const ll e9  = 1000000000;
const ll mod = 1000000007;

int main(){
    int n;
    string s;
    cin >> n >> s;
    vector<int>cntw(n+1);
    int ans = 200200, cntr=0, p=0;
    rep(i, 0, n){
        if(s[i]=='W')p++;
        cntw[i+1]=p;
        if(s[i]=='R')cntr++;
    }
    rep(i, 0, n+1){
        int leftw = cntw[i];
        int rightr=cntr-(i-cntw[i]);
        int temp = min(leftw,rightr)+abs(rightr-leftw);
        ans = min(temp,ans);
        //cout << leftw << " " << rightr << endl;
        //cout << ans << endl;
    }
    cout << ans << endl;
}

Measured memory_bytes: 4384
#include<bits/stdc++.h>
using namespace std;
int main(){
    int N, D, ans=0;
    double tmp=0;
    cin >> N >>D;
    int x[2*N][2*D];

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

    for(int i=0; i<N; i++){
	for(int j=i+1; j<N; j++){
	    tmp=0;
	    for(int k=0; k<D; k++){
		tmp+=pow(x[i][k]-x[j][k], 2);
	    }

	    tmp = sqrt(tmp);
	    if(tmp==(int)tmp)
		ans++;
	}	
    }

    cout << ans << endl;    
}



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

struct node{
    int key;
    node* right;
    node* left;
    node* parent;
};

node *root;
node *NIL;

//?????\
void insert(int k){
    node *y = NIL;
    node *x = root;
    node *z;

    z = new node;
    z->key=k;
    z->left=NIL;
    z->right=NIL;

    while(x!=NIL){
        y=x;
        if(z->key<x->key)
            x=x->left;
        else
            x=x->right;
    }

    z->parent=y;
    if(y==NIL)
        root=z;
    else{
        if(z->key<y->key)
            y->left=z;
        else
            y->right=z;
    }

}

//????´¢
node* find(node* u,int k){
    while(u!=NIL&&k!=u->key){
        if(k<u->key)
            u=u->left;
        else
            u=u->right;
    }
    return u;
}

void inorder(node* u){
    if(u==NIL)
        return;
    inorder(u->left);
    printf(" %d",u->key);
    inorder(u->right);
}

void preorder(node* u){
    if(u==NIL)
        return;
    printf(" %d",u->key);
    preorder(u->left);
    preorder(u->right);
}

int main(){
    int n,i,x;
    string com;

    scanf("%d",&n);

    for(i=0;i<n;i++){
        cin>>com;
        if(com[0]=='f'){
            scanf("%d",&x);
            node* t=find(root,x);
            if(t!=NIL)
                printf("yes\n");
            else
                printf("no\n");
        }
        else if(com=="insert"){
            scanf("%d",&x);
            insert(x);
        }
        else if(com=="print"){
            inorder(root);
            printf("\n");
            preorder(root);
            printf("\n");
        }
    }
}

Measured memory_bytes: 21928
#include<bits/stdc++.h>
#define mod (ll)1e19//1000000007
using namespace std;
typedef pair<int,int> pi;
typedef long long int ll;
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int n;
    cin>>n;
    int o = (1+n)/2;
    int e = n-o;
    cout<<o*e;
}


Measured memory_bytes: 256
//???????????????????????????????????????????????¢?????????
#include<stdio.h>

int main(void){
    int h, w;
    int i,j;
    
    while(1){
        scanf("%d", &h);
        scanf("%d", &w);
        
        if(h == 0) break;
        
        for(i = 0; i < h; i++){
            for(j =0; j < w; j++){
                if(i == 0 || i == h-1 || j==0 || j==w-1) putchar('#');
                else putchar('.');
            }
            putchar('\n');
        }
        putchar('\n');
    }
    return 0;
}

Measured memory_bytes: 572
#include<bits/stdc++.h>
using namespace std;
typedef  long long ll;

int main() {
	ll n,m;
	cin>>n>>m;
	if(n*2<=m){
		cout <<(m-n*2)/4+n;
		return 0;
	}
	else{
		cout << m/2;
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
using namespace std;
const int MAXN  = 100005;
int a[MAXN]={0};
int b[MAXN]={0};
int c[MAXN]={0};
int d[MAXN]={0};
int dfn[MAXN]={0};
int ans[MAXN]={0};
vector<int>x[MAXN];
vector<int>G;int cnt = 0;
void dfs(int u,int fa){
    G.push_back(u);
    dfn[u]=cnt;
    for(auto V:x[u]){
        if(!dfn[V])
            dfs(V,u);
    }
}

int main()
{
    ios::sync_with_stdio(false);
    int n,m,k;
    cin >> n >> m >> k;
    int u,v;

    for(int i=0;i<m;i++){
        cin >> u >> v;
        x[u].push_back(v);
        x[v].push_back(u);
        ans[u]--;
        ans[v]--;
    }
    for(int i=0;i<k;i++)
        cin >> d[i] >> c[i];
    for(int i=1;i<=n;i++){
        if(!dfn[i]){
            ++cnt;
            G.clear();
            dfs(i,i);
            for(auto v:G){
                ans[v]+=G.size()-1;
            }
        }
    }
    for(int i=0;i<k;i++){
        if(dfn[c[i]]==dfn[d[i]])
            ans[c[i]]--,ans[d[i]]--;
    }
    for(int i=1;i<=n;i++)
        cout << ans[i] << " \n"[i==n];
    return 0;
}


Measured memory_bytes: 11720
#include<iostream>
#include<algorithm>
#include<string>
#include<sstream>
using namespace std;
int main() {
  int n;
  cin >> n;
  long* a = new long[200000];
  for(int i=0;i<n;i++){
    long b;
    cin >> b;
    a[i] = b-1-i;
  }
  sort(a,a+n);
  long diff=0;
  for(int i=0;i<n/2;i++){
    diff += a[n-1-i] - a[i];
  }
  cout << diff << endl;
  return 0;
}


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

int main()
{
    int a, b;
    bool *table;
    table = new bool[10000];
    std::fill(table, table + 5000, false);
    std::fill(table + 5000, table + 10000, true);
    scanf("%d%d", &a, &b);
    a--; b--;
    int add = -100;
    for (int i = 0; i < a; i++)
    {
        if (i % 50 == 0) add += 100;
        table[i * 2 + add] = true;
    }
    add = 5000;
    for (int i = 0; i < b; i++)
    {
        if (i % 50 == 0) add += 100;
        table[i * 2 + add] = false;
    }
    printf("100 100\n");
    for (int i = 0; i < 100; i++)
    {
        for (int j = 0; j < 100; j++)
            printf("%c", table[i * 100 + j]?'.':'#');
        printf("\n");
    }
    
    delete[] table;
    return 0;
}

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

using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
	REP(i, v.size()) { if (i)os << " "; os << v[i]; }return os;
}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
	REP(i, v.size()) { if (i)os << endl; os << v[i]; }return os;
}

const ll INF = LLONG_MAX;
ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

#define int long long

inline void my_io() {

	std::ios::sync_with_stdio(false);

	std::cin.tie(0);

	cout << fixed << setprecision(16);

	//cout << setprecision(10) << scientific << ans << endl;
}

signed main() {
	ll n, h;

	cin >> n;

	ll prev = 0;

	REP(i, n) {
		cin >> h;
		if (i == 0) {
			prev = h - 1;
		}
		else {
			if (prev > h) {
				cout << "No" << endl;
				return 0;
			}
			else {
				if (prev == h) {
					prev = h;
				}
				else {
					prev = h - 1;
				}
			}
		}
	}

	cout << "Yes" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#define ll long long
#define MP make_pair
#define PB push_back
#define PF push_front
#define F first
#define S second
#define endl "\n"
#define pi 3.14159265358979323846264338327950288
#define MOD 1000000
#define INF -100000000000000
#define ordered_set tree<pair< ll int ,ll  int>, null_type,less<pair<ll int, ll int>>, rb_tree_tag,tree_order_statistics_node_update> 
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
using namespace std;
#define lld long double
using namespace __gnu_pbds;
int main()
{
    fast;
    //#ifndef ONLINE_JUDGE
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    //#endif
    ll int n;
    cin>>n;ll int a[n+1];ll int i,c=0;
    for(i=1;i<=n;i++)
    {
    	cin>>a[i];
    	if(i%2!=0 && a[i]%2!=0)
    		c++;
    }
    cout<<c<<endl;
}

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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

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

#define rep(i, e) for(int i = 0; i < e; i++)
#define repp(i, s, e) for(int i = s; i < e; i++)
#define MAX_N 100
#define Card_Max 36
#define p(a) printf("%d\n", a);
#define ll long long
#define ull unsigned long long
#define MAX 1e9
#define NIL -1
typedef pair<ll, ll> P;

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

void print(vector<ll> &v) {
    rep(i, v.size()) {
        if(i)
            cout << " ";
        cout << v[i];
    }
    cout << endl;
}

int main() {
    int N, M, C, A[25] = {}, B[25] = {}, sum = 0, cnt = 0;
    cin >> N >> M >> C;
    rep(i, M) cin >> B[i];
    rep(i, N) {
        sum = 0;
        rep(j, M) {
            cin >> A[j];
            sum += A[j] * B[j];
        }
        // cout << sum << endl;
        if(sum + C > 0) {
            cnt++;
        }
    }
    cout << cnt << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define fast { ios :: sync_with_stdio(false); cin.tie(0); cout.tie(0); }
#define pb push_back
#define ll long long
 
#define vi vector<int>
#define vl vector<long>
#define vll vector<long long>
 
#define infi INT_MAX
#define infl LONG_MAX
#define f(i,a,b) for(ll i=a;i<b;i++)
#define fi(i,a,b) for(ll i=(b-1);i>=a;i--)
#define F first
#define S second
#define G(a,b) get<a>(b)
#define MP make_pair
#define MT make_tuple
 
ll gcd(ll a, ll b) 
{ 
    if (a == 0) 
        return b; 
    return gcd(b % a, a); 
} 

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

 
void func()
{
  ll a,b;
  cin>>a>>b;
  ll ans=lcm(a,b);
  cout<<ans<<endl;
}
 
int main() 
{
    fast
    //freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
    
    ll q=1;
    //cin>>q;
    while(q)
    {
      func();
      q--;
    }
 
    return 0;
}

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

int main() {
    ios::sync_with_stdio(false), cin.tie(nullptr);
    int64_t n, x, m;
    cin >> n >> x >> m;
    vector<int> cnt(m), cand, cand2;
    for (int64_t i = x; cnt[i] < 2;) {
        cnt[i]++;
        if (cnt[i] == 1)
            cand.push_back(i);
        else if (cnt[i] == 2)
            cand2.push_back(i);
        i = i * i % m;
    }
    int len1 = 0, len2 = 0;
    int64_t sum1 = 0, sum2 = 0;
    for (int i : cand) {
        if (cnt[i] == 1)
            len1++, sum1 += i;
        else if (cnt[i] == 2)
            len2++, sum2 += i;
        else 
            assert(false);
    }
    // cout << len1 << ' ' << len2 << '\n';
    int64_t ans = 0;
    if (n <= len1 + len2) {
        for (int i = 0; i < n; i++) {
            ans += cand[i];
        }
    } else {
        n -= len1;
        int64_t l = n / len2;
        int64_t r = n % len2;
        int64_t sum3 = 0;
        for (int i = 0; i < r; i++)
            sum3 += cand2[i];
        ans = sum1 + sum2 * l + sum3;
    }
    cout << ans << '\n';
    return 0;
}

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

int main(){
  char s1, s2, s3;
  int num;
  
  cin >> s1 >> s2 >> s3;
  num = (s1 - '0') + (s2 - '0') + (s3 - '0');
  cout << num << endl;
}

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

typedef long long ll;

int main() {
    int N, a;
    cin >> N;
    vector<ll> s(N + 1, 0);
    rep(i, N) {
        cin >> a;
        s[i + 1] = s[i] + a;
    }
    ll ans = 1e18;
    rep(i, N - 1) {
        ans = min(ans, abs(s[N] - s[i + 1] - s[i + 1]));
    }
    cout << ans << "\n";
}

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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
  os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
  for(int i = 0; i < v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
  for(int i = 0; i < v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}

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

    ll N, C, K;
    cin >> N >> C >> K;
    vector<ll> T(N);
    REP(i, N) cin >> T[i];
    sort(T.begin(), T.end());
    ll res = 0;
	REP(i, N){
		int j = i;
		while(T[j]<=T[i]+K && j-i<C) j++;
		res++;
		i = j-1;
	}
	cout << res << endl;  
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define fastio (cin.tie(0), cout.tie(0), ios::sync_with_stdio(false))
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define precise(i) fixed << setprecision(i)
using lint = long;
using llint = long long;
using namespace std;

int main() {
    fastio;
    char x, y;
    cin >> x >> y;
    if (x == y)
        cout << "=" << endl;
    else if (x > y)
        cout << ">" << endl;
    else
        cout << "<" << endl;
}

Measured memory_bytes: 3596
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <complex>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;


#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 100010

// a[1001] = a[1001] + a[1000] + a[0001] + a[0000];

pair<int,int> marge(pair<int,int> a, pair<int,int> b){
  int v[4] = {a.first, b.first, a.second, b.second};
  sort(v, v+4);
  return {v[3], v[2]};
}

void FZT(int n,  pair<int,int> *a){
  for(int i=0;i<n;i++)
    for(int j=0;j<(1<<n);j++)
      if(j & (1<<i)) a[j] = marge(a[j], a[j ^ (1<<i)]); //総和
}

int main(){
  int n, a[1<<18];
  pair<int,int> b[1<<18];

  scanf("%d", &n);
  for(int i=0;i<(1<<n);i++){
    scanf("%d", a+i);
    b[i] = {a[i], -1};
  }

  FZT(n, b);
  /*
  for(int i=0;i<(1<<n);i++)
    debug(b[i].first);
  */
  
  int ans = 0;
  
  for(int i=1;i<(1<<n);i++){
    ans = max(ans,  b[i].first + b[i].second);
    printf("%d\n", ans);
  }
  
  
  return 0;
}


Measured memory_bytes: 6272
#pragma GCC optimize ("O3")

#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#include <prettyprint.hpp>
#define debug(...)  cerr << "[" << #__VA_ARGS__ << "]: ", d_err(__VA_ARGS__);
#else
#define debug(...) 83;
#endif

void d_err() {
    cerr << endl;
}

template <typename H, typename... T>
void d_err(H h, T... t) {
    cerr << h << " ";
    d_err(t...);
}

template <typename T>
void print(T x) {
    cout << x << endl;
}

#define ALL(x) (x).begin(), (x).end()
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REVFOR(i, m, n) for (int i = (n - 1); i >= (m); --i)
#define REP(i, n) FOR(i, 0, n)
#define REVREP(i, n) REVFOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> Pin;

ll INF = 1e16;
int inf = 1e9;
ll MOD = 1e9+7;

int D;
vi c(26);
vector<vector<ll>> s(365, vector<ll>(26));
vi ans(365);

ll eval() {
    vi last(26, 0);

    ll score = 0;
    REP(i, D) {
        int t = ans[i];

        score += s[i][t];
        last[t] = i + 1;

        REP(j, 26) {
            score -= c[j] * (i + 1 - last[j]);
        }
    }

    return score;
}

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    
    cin >> D;

    std::random_device rd;
    std::mt19937 mt(rd());
    std::uniform_int_distribution<int> d_rng(0, 364);
    std::uniform_int_distribution<int> t_rng(0, 25);

    REP(i, 26) cin >> c[i];

    vi last(26, 0);
    REP(i, D) {
        vll s(26);
        REP(j, 26) cin >> s[j];

        vll p(26);
        ll p_all = 0;
        REP(j, 26) {
            p[j] = c[j] * (i + 1 - last[j]);
            p_all += p[j];
        }

        REP(j, 26) {
            s[j] -= p_all - p[j];
        }

        int idx = max_element(ALL(s)) - s.begin();

        last[idx] = i + 1;
        ans[i] = idx;
    }

    ll score = eval();

    REP(i, 1e4) {
        int d = d_rng(mt), t = t_rng(mt);
        if (ans[d] == t) {
            --i;
            continue;
        }

        int old = ans[d];

        ans[d] = t;
        ll new_score = eval();
        if (score < new_score) {
            score = new_score;
        } else {
            ans[d] = old;
        }
    }

    for (auto &e: ans) {
        print(e + 1);
    }

}


Measured memory_bytes: 3760
#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long a,b,c,d;
	cin>>a>>b>>c>>d;	
	
	long long ans = a*c;
	if(ans<a*d)
	{
		ans = a*d;
	}
	if(ans < b*c)
	{
		ans = b*c;
	}
	if(ans< b*d )
	{
		ans = b*d;
	}
	
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 3548