akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;
typedef  long long ll;
typedef unsigned long long ull;
int inf_int=1e8;
ll inf_ll=4e18;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define pb push_back
const double pi=3.1415926535898;
#define dout if(debug) cout
#define fi first
#define se second
#define sp setprecision
#define siz(a) a.size()
#define sz size()


void solve(){
   ll a,b,c,k;
   cin >> a >> b >> c >> k;
   if(k%2==0){
    cout << a-b;
   } else{
    cout << b-a;
   }
   cout << endl;
}

int main()
{
        #ifdef ta
           //freopen("input.txt","r",stdin);
        //    freopen("output.txt","w",stdout);
        #else
        #endif // ta
        ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
        solve();
}


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

int main(){
    int x[10000], a, i, j;
    for (i = 0; i < 10000; ++i){
        cin >> x[i];
        a = x[i];
        if (a == 0){
            break;
        }
    }
    for (j = 0; j < i; ++j){
        cout << "Case " << j + 1 << ": " << x[j] << endl;
    }
return 0;
}



Measured memory_bytes: 3132
#include <bits/stdc++.h>
using namespace std;
#define loop(i,n) for (int i =0;i<(n);i++)
typedef long long ll;



int main(){

    int n,r;
    cin >> n>>r;
    int ans  = r+100*max(0,10-n);
    cout<<ans<< endl;
    return 0;
}

Measured memory_bytes: 256
import math
n = int(input())

ans = []
d = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j']

todo = ['a']
while len(todo)>0:
    p = todo.pop(-1)
    l = len(p)
    cou = len(set(p))
    if l < n:
        for i in range(cou+1):
            todo.append(p+d[i])
    else:
        ans.append(p)


print('\n'.join(sorted(set(ans))))

Measured memory_bytes: 17464
import io.{StdIn => in}

object Main extends App {
  val s = in.readLine.map(c => if(c == 'W') true else false).toBuffer

  val ans = s./:((0, s.head))((acc, e) => {
    if(acc._2 != e) (acc._1 + 1, e)
    else (acc._1, e)
  })._1
  println(ans)
}


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

int main(void){
   long long x,y;
   cin>>x>>y;
   long long ans=0;
   if(x<0&&y>0){
      ans+=1;
      x=x*(-1);
      if(x>y){
         ans=0;
         ans+=(x-y);
         ans+=1;
         cout<<ans<<endl;
      }else{
         ans+=(y-x);
         cout<<ans<<endl;
      }
   }else if(x>0&&y>0){
      if(x>y){
         ans+=1;
         ans+=(x-y);
         ans+=1;
         cout<<ans<<endl;
      }else{
         ans+=(y-x);
         cout<<ans<<endl;
      }
   }else if(x<0&&y<0){
      if(x>y){
         ans+=1;
         ans+=(x-y);
         ans+=1;
         cout<<ans<<endl;
      }else{
         ans+=(y-x);
         cout<<ans<<endl;
      }
   }else if(x>0&&y<0){
      ans+=1;
      x=x*(-1);
      if(x>y){
         ans=0;
         ans+=(x-y);
         ans+=1;
         cout<<ans<<endl;
      }else{
         ans+=(y-x);
         cout<<ans<<endl;
      }
   }else if(y==0){
      if(x<y){
         cout<<y-x<<endl;
      }else{
         cout<<x-y+1<<endl;
      }
   }else if(x==0){
      if(x<y){
         cout<<y-x<<endl;
      }else{
         cout<<x-y+1<<endl;
      }
   }
   return 0;
}


Measured memory_bytes: 3640
// AOJ_C++.cpp : アプリケーションのエントリ ポイントを定義します。
//
#include <iostream>
#include <iomanip>

int main()
{
	int a, b;
	std::cin >> a >> b;
	double c = (double)a / (double)b;
	std::cout << std::fixed;
	std::cout << a / b << " " << a % b << " " << c << std::endl;
    return 0;
}


Measured memory_bytes: 3268
#include<iostream>
#include<algorithm>
#include<string>
#include<cmath>
#include<vector>
#include<functional>
#include<stack>

using namespace std;

int main() {
	int a, b;
	while (cin >> a >> b) {
		if (a == 0)break;
		for (int i = 0; i < a; i++) {
			for (int j = 0; j < b; j++)
				cout << "#";
			cout << endl;
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 3052
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<algorithm>
#include<queue>
#include<vector>
#include<set>
#include<set>
#include<map>
#include<ctime>
#include<iostream>
using namespace std;
typedef long long LL;
int main()
{
	int A,B,C,D;
	while( scanf(" %d %d %d %d",&A,&B,&C,&D) != EOF ){
		int sum = 0;
		if( A == B )
			sum += A;
		else
			sum += min(A,B);
		if( C == D )
			sum += C;
		else
			sum += min( C , D );
		printf("%d\n",sum);
	}
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <queue>
#include <sstream>
#include <string>
#include <utility>
#include <vector>

#define REP(i, n) for(int i = 0; i < (n); i++)
#define ALL(a) (a).begin(), (a).end()
#define AALL(a, n) (a), a + n
#define FILL(a, n) memset((a), n, sizeof(a))
#define FILLZ(a) FILL(a, 0)

using namespace std;

typedef long long ll;

const double EPS = 1e-10;
const double PI = acos(-1.0);

inline int toInt(string s) {
	int v;
	istringstream sin(s);
	sin >> v;
	return v;
}

int main() {
	string weather[3] = {"Sunny", "Cloudy", "Rainy"};
	string str;

	cin >> str;

	REP(i, 3) {
		if(str == weather[i]) {
			cout << weather[(i + 1) % 3] << endl;
			return 0;
		}
	}

	return 0;
}

Measured memory_bytes: 256
import math

n=int(input())
a=list(map(int, input().split()))  
b=[]
count=0




for i in range(n):
    if a[i]>=3200:
        count+=1
    else:
        b.append(a[i]//400)

ans=len(set(b))

if count==0:
    print(ans,ans)

else:
    if ans==0:
        print(1,count)
        
    else:
        print(ans,ans+count)
    
    



        
    

    





    





Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for(ll i = 0; i<(ll)(n); i++)
#define REPS(i,n) for (ll i = 1; i<=(ll)(n); i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define pb push_back
#define MOD 1000000007
#define MOD2 998244353
#define PI 3.141592653
#define INF 100000000000000

ll divn(ll a, ll x){
    if (a==-1){
        return 0;
    }
    else{
        ll y = a/x+1;
        return y;
    }
}

int main(){
    ll a, b, x; cin >> a >> b >> x;
    cout << divn(b,x)-divn(a-1,x) << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<set>
#include<stdio.h>
#include<ctype.h>
using namespace std;
int main()
{
	int n;
	cin >> n;
	int ans = 0;
	for (int i = 0; i < n; i++)
	{
		string s;
		cin >> s;
		if (s == "E869120")
		{
			ans++;
		}
	}
	cout << ans << endl;
}



Measured memory_bytes: 3176
#include<iostream>
#include<cstdio>
#include <cstring>
#include<map>
#include<string>
#include<stack>
#include <sstream>
#include<vector>
using namespace std;

bool ans(vector<int>n){
	int d=n[1]-n[0];
	for(int i=1; i<n.size(); ++i) if(n[i]-n[i-1] != d)return false;
	return true;
}

int main(void){
	int n;
	while(cin>>n && n)
	{
		vector<int> h;
		h.resize(n+1);
		for (int i=0; i<n+1; ++i) cin>>h[i]; 
		for (int i=0; i<n+1; ++i)
		{
			vector<int>kari=h;
			kari.erase(kari.begin()+i);
			if(ans(kari)) {
				cout<<h[i]<<endl;
				break;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 1224
// B.

#include <iostream>
#include <sstream>
#include <algorithm>

using namespace std;

typedef long long LL;

int main(int argc, char *argv[]) {
	LL r, d, x;
	cin >> r >> d >> x;
	for (int i = 1; i <= 10; ++i) {
		x = r * x - d;
		cout << x << endl;
	}
	return 0;
}


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

#define mod 1000000007

using namespace std;

int main() {
#ifdef orange
	freopen("input.txt", "r", stdin);
#endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int k;
	string s;
	cin >> k;
	cin >> s;
	long long pow26[k + 1], pow25[k + 1], inv[k + 2];

	pow25[0] = 1;
	pow26[0] = 1;
	for (int i = 1; i <= k; i++) {
		pow26[i] = (pow26[i - 1] * 26) % mod;
		pow25[i] = (pow25[i - 1] * 25) % mod;
	}

	long long ways = 0;
	long long choose = 1;
	int len = s.size();
	inv[1] = 1;
	for (int i = 2; i <= k + 1; i++) {
		inv[i] = (mod + (-(mod / i) * inv[mod % i]) % mod) % mod;
	}
	for (int first = k; first >= 0; first--) {
		//cout << choose << "\n";
		ways = (ways
				+ ((pow26[first] * pow25[(k - first)]) % mod * choose) % mod)
				% mod;
		choose = ((choose * ((k - first) + len)) % mod * inv[k - first + 1])
				% mod;
	}
	cout << ways << "\n";
}



Measured memory_bytes: 27672
#include <iostream>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <math.h>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <climits>
#include <bitset>
#include <list>

using namespace std;

typedef unsigned long long ull;
typedef long long ll;

int main(){
	vector<int> c(4,0);
	for(int i=0; i<3; i++){
		int a, b;
		cin >> a >> b;
		c[a-1]++;
		c[b-1]++;
	}
	sort(c.begin(), c.end());
	if(c[0]==1 && c[1]==1 && c[2]==2 && c[3]==2) cout << "YES" << endl;
	else cout << "NO" << endl;
 	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-6;
const double PI=acos(-1.0);
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}

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

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

int main() {
    int n , x , y;
    cin>>n>>x>>y;
    vector<vector<int>>g(n + 1);
    for(int i = 1; i < n; ++i){
        g[i].push_back(i + 1);
        g[i + 1].push_back(i);
    }
    g[x].push_back(y);
    g[y].push_back(x);
    vector<int>ans(n + 1);
    for(int i = 1 ; i  <= n; ++i){
        vector<int>dist(n + 1 , -1);
        queue<int>q;
        q.push(i);
        dist[i] = 0;
        while(!q.empty()){
            int v = q.front();
            q.pop();
            for(int& u : g[v]){
                if(dist[u] == -1){
                    dist[u] = dist[v] + 1;
                    q.push(u);
                }
            }
        }
        for(int i = 1; i <= n; ++i){
            ans[dist[i]]++;
        }
    }
    for(int i = 1; i < n; ++i){
        cout<<ans[i] / 2<<"\n";
    }
    return 0;
}


Measured memory_bytes: 384
foods = [int(input()) for i in range(5)]
amari = [i % 10 for i in foods]
kiriage = [-(-i//10) for i in foods]
min_amari = 10
for i in amari:
    if 1 <= i < min_amari:
        min_amari = i
print(sum(kiriage) * 10 - (10 - (10 if max(amari) == 0 else min_amari)))

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

using namespace std;
using ll = long long;

ll powll(ll base,ll exp) {
    ll res = 1;
    while(exp>0){
        if(exp & 1)res = res * base % 2019;
        base = base * base % 2019;
        exp >>= 1;
    }
    return res % 2019;
}

int main()
{
    string s;
    cin >> s;
    for(auto &i : s)i -= '0';
    int n = s.size();
    vector<ll> am(2019);
    am[0]++;
    int an = 0;
    int cnt = 0;

    for(int i = n - 1; i >= 0; i--) {
        an = an + powll(10, cnt) * s[i];
        an %= 2019;
        am[an]++;   
        cnt++;
        //cout << an << endl;
    }
    ll sum = 0;

    for(int i = 0; i < 2019; i++) {
        sum += am[i] * (am[i] - 1) / 2;
    }
    cout << sum << endl;
}

Measured memory_bytes: 3760
#include <iostream>
#include <vector>
#include <bitset>
#include <utility>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>

#include <iomanip>

using namespace std;
typedef long long ll;
 
double rec(auto &dp, int N, int i, int j, int k){
  if(dp[i][j][k]>-1) return dp[i][j][k];
  dp[i][j][k]=0;
  if(i!=0) dp[i][j][k]+=rec(dp,N,i-1,j,k)*i;
  if(j!=0) dp[i][j][k]+=rec(dp,N,i+1,j-1,k)*j;
  if(k!=0) dp[i][j][k]+=rec(dp,N,i,j+1,k-1)*k;
  dp[i][j][k]+=N;
  dp[i][j][k]/=i+j+k;
  //cout << i << " " << j << " " << k << ":" << dp[i][j][k] << endl;
  return dp[i][j][k];
}



int main(){
  int N;
  cin >> N;
  vector<int> n(3,0);
  for(int i=0;i<N;i++){
    int t; cin >> t;
    n[t-1]++;
  }

  vector<vector<vector<double>>>
  dp(n[0]+n[1]+n[2]+1,vector<vector<double>>(n[1]+n[2]+1, vector<double>(n[2]+1,-2)));
  dp[0][0][0]=0;
  cout << std::fixed << std::setprecision(15) << rec(dp,N,n[0],n[1],n[2]) << endl;

  return 0;
}


Measured memory_bytes: 216960
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner stdIn = new Scanner(System.in);

		long i = stdIn.nextLong();
		long money = 100;
		int count = 0;

		while (money < i) {
			money = (long) (money * 1.01);
			count++;
		}

		System.out.println(count);

	}

}


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

using namespace std;

const int MX = 100000;

int dp[1 << 16];

int g(int mask) {
	if (mask == 0) return 0;
	if (dp[mask] != 0) return dp[mask];
	
	dp[mask] = 42;
	int j = 0;
	while ((mask >> j) % 2 == 0) j++;
	for (int k = j + 1; (1 << k) <= mask; k++)
		if ((mask >> k) % 2 == 1) {
			int val = g(mask ^ (1 << j) ^ (1 << k) ^ (1 << (k ^ j))) + 1;
			if ((mask >> (k ^ j)) % 2 == 1) val++;
			dp[mask] = min(dp[mask], val);
		}
	
	return dp[mask];
}

int f[MX], cnt[16];

int main() {
	int n;
	ignore = scanf("%d", &n);
	for (int i = 1, u, v, a; i < n; i++) {
		ignore = scanf("%d %d %d", &u, &v, &a);
		f[u] ^= a;
		f[v] ^= a;
	}
	
	for (int i = 0; i < n; i++) cnt[f[i]]++;
	
	int ans = 0, mask = 0;
	for (int i = 1; i < 16; i++) {
		ans += cnt[i] / 2;
		mask |= (cnt[i] & 1) << i;
	}
	
	printf("%d\n", ans + g(mask));
	
	return 0;
}


Measured memory_bytes: 896
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;

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

	long long n, m, s, i, j, k, x;
	cin >> n >> m;
	priority_queue<long long> q;
	for (i = 0; i < n; i++) {
		cin >> x;
		q.push(x);
	}

	for (i = 0; i < m; i++) {
		x = q.top();
		q.pop();
		q.push(x / 2);
	}

	s = 0;
	while (!q.empty()) {
		s += q.top();
		q.pop();
	}
	cout << s << "\n";

	return 0;
}


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

int main() {
 int N;
  cin >> N ;
  
  int i = 0;
    
 while (i < N ) {
    string S;
   cin >> S ;
 
   if ( S == "Y" ) {
    break;
   }
   i++;
 }
  if (i == N ) {
    cout << "Three" << endl;
  }
  
  else {
    cout << "Four" << endl;
  }
  
}



Measured memory_bytes: 256
n,s=0;
d(long x,int b){
if(x>n)return;
if(x<=n&&b==7)s++;
d(x*10+3,b|1);d(x*10+5,b|2);d(x*10+7,b|4);}
main(){scanf("%d",&n);d(0,0);printf("%d",s);}

Measured memory_bytes: 128
#include<iostream>
#include<fstream>
#include<vector>
#include<algorithm>
#include<queue>
#include <cmath>
#include <string>

int main() {
  std::string string;
  int N;
  std::cin >> N >> string;
  for(int i = 0; i < string.length(); ++i){
    string[i] = string[i] + N;
    if(string[i] > 'Z') {
      string[i] = 'A' + string[i] - 'Z' - 1;
    }
  }
  std::cout << string;
  return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using static Input;
using NX = System.Int64;


public class Prog
{
    public static void Solve()
    {
        long A = NextLong();
        long B = NextLong();
        Console.WriteLine(LCM(A,B));
    }
    public static long RepPow(long x, long p, long m = 1000000007)
    {
        if (p == 0) return 1;
        if (p == 1) return x % m;
        long b = RepPow(x, p / 2, m) % m;
        if (p % 2 == 0) { return (b * b) % m; }
        else { return (x * ((b * b) % m)) % m; }
    }
    public static void Main()
    {
        var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
        Console.SetOut(sw);
        Solve();
        Console.Out.Flush();
        return;
    }
    public static long GCD(long a, long b)
    {
        if (a < b) GCD(b, a);
        long d = a % b;
        while (b != 0)
        {
            d = a % b;
            a = b;
            b = d;
        }
        return a;
    }
    public static long LCM(long a, long b)
    {
        return a / GCD(a, b) * b;
    }
}
public class Input
{
    public const long MOD = 1000000007;
    public const int INF = 1000000007;
    private static Queue<string> q = new Queue<string>();
    private static void Confirm() { if (q.Count == 0) foreach (var s in Console.ReadLine().Split(' ')) q.Enqueue(s); }
    public static int NextInt() { Confirm(); return int.Parse(q.Dequeue()); }
    public static long NextLong() { Confirm(); return long.Parse(q.Dequeue()); }
    public static string NextString() { Confirm(); return q.Dequeue(); }
    public static double NextDouble() { Confirm(); return double.Parse(q.Dequeue()); }
    public static int[] LineInt() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
    public static long[] LineLong() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
    public static string[] LineString() { return Console.ReadLine().Split(' ').ToArray(); }
    public static double[] LineDouble() { return Console.ReadLine().Split(' ').Select(double.Parse).ToArray(); }
    public long Abs(long a, long b) => Math.Abs(a - b);
}


Measured memory_bytes: 13268
#include <algorithm>
#include <iostream>
#include <cstring>
#include <vector>
using namespace std;

typedef long long ll;
typedef pair <ll, ll> pii;

const ll MAX_N = 1e5 + 5;
ll n, tmp, val;
ll Arr[MAX_N];

int main() {
	ios::sync_with_stdio(false), cin.tie(0);
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> Arr[i];

	sort(Arr, Arr + n);
	tmp = 0, val = -1;
	for (int i = 0; i + 1 < n; i++)
		if (val < min(Arr[i], Arr[n - 1] - Arr[i])) {
			val = min(Arr[i], Arr[n - 1] - Arr[i]);
			tmp = Arr[i];
		}

	cout << Arr[n - 1] << " " << tmp << "\n";
	return 0;
}

Measured memory_bytes: 1656
#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define MAXX 10005
#define PI 3.14159265358979323846264338327950
#define ll signed long long int
using namespace std;
ll t , n, c[MAXX];
vector<ll> adj[MAXX];
bool used[MAXX];


signed main()
{
	FAST;
	ll a, b, r;
	cin >> r >> a >> b;
	c[0] = b;
	for(ll i = 1; i <= 10; i++){
		c[i] = r*c[i-1]  -a;
	}
	for(ll i = 1; i <= 10; i++){
		cout << c[i] << endl;
	}
}

Measured memory_bytes: 512
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
using namespace std;
const int MOD = 1000000007;
typedef long long ll;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
typedef unsigned int ui;
int main() {
	int n,t,v,T[100],V[100];
	cin >> n;
	int i,j;
	for (i = 0; i < n; i++) {
		cin >> t; T[i] = t;
	}
	int speed[101];
	speed[0] = 0; speed[n] = 0;
	for (i = 0; i < n; i++) {
		cin >> v; V[i] = v;
	}
	for (i = 1; i < n; i++) {
		speed[i] = min(V[i - 1], V[i]);
	}
	for (j = 0; j < n + 2; j++) {
		for (i = 0; i < n; i++) {
			speed[i + 1] = min(speed[i + 1], speed[i] + T[i]);
			speed[i] = min(speed[i + 1] + T[i], speed[i]);
		}
	}
	double dis = 0; double h, k,l,m;
	for (i = 0; i < n; i++) {
		h = (double)speed[i], k = (double)speed[i + 1]; l = (double)T[i]; m = double(V[i]);
		if (2 * V[i] - speed[i] - speed[i + 1] >= T[i]) {
			dis += (-h*h-k*k+l*l+2*h*k+2*h*l+2*k*l) / 4.0;
		}
		else {
			dis += l * m - (m - h)*(m - h) / 2.0 - (m - k)*(m - k) / 2.0;
		}
	}
	cout << fixed << setprecision(4) << dis << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep_(i, n, m) for (int i = n; i < (int)(m); i++)
#define all(v) v.begin(), v.end()
#define int long long
#define stoi stoll
//#define _GLIBCXX_DEBUG

signed main() {
  vector<vector<int>> c(3, vector<int>(3));
  rep(i, 3) rep(j, 3) cin >> c[i][j];
  
  
  if(c[0][2]+c[1][0]-c[0][0] != c[1][2]) {
    cout << "No" << endl;
    return 0;
  }
  if(c[2][0]+c[1][1]-c[1][0] != c[2][1]) {
    cout << "No" << endl;
    return 0;
  }
  if(c[0][2]+c[2][0]-c[0][0] != c[2][2]) {
    cout << "No" << endl;
    return 0;
  }
  cout << "Yes" << endl;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
					
public class my
{	
	public static void Main()
	{
		string s;
		
		while( null != ( s = Console.ReadLine()) ) {
			var A = my.GetIntArray(',', s);
			var L = new int[10];
			Array.Copy(A, 0, L, 0, 10);
			double v1= A[10];
			double v2 = A[11];
			
			var x = L.Sum() / (v1+v2) * v1;
			
			int i = 0;
			var sum = 0.0;
			foreach (var l in L) {
				sum += l;
				i++;
				if(sum >= x)	break;
			}
			
			Console.WriteLine(i);
		}
	}
	
	private static void Swap(int[] A, int i, int j)
	{
		int tmp = A[i];
		A[i] = A[j];
		A[j] = tmp;
	}
	
	private static int GetInt()
	{
		return int.Parse(Console.ReadLine());
	}
	
	private static int[] GetIntArray()
	{
		return Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
	}

	private static int[] GetIntArray(int n)
	{
		var A = new int[n];
		var s = Console.ReadLine().Split(' ');

		for(int i = 0; i < n; i++) {
			A[i] = int.Parse(s[i]);
		}
		return A;
	}
	
	private static int[] GetIntArray(int n, string t)
	{
		var A = new int[n];
		var s = t.Split(' ');

		for(int i = 0; i < n; i++) {
			A[i] = int.Parse(s[i]);
		}
		return A;
	}

	private static int[] GetIntArray(char c)
	{
		return Array.ConvertAll(Console.ReadLine().Split(c), int.Parse);
	}
	
	private static int[] GetIntArray(char c, string s)
	{
		return Array.ConvertAll(s.Split(c), int.Parse);
	}
	
	private static int[] GetIntArray(string s)
	{
		return Array.ConvertAll(s.Split(' '), int.Parse);
	}
	
	private static double[] GetDoubleArray()
	{
		return Array.ConvertAll(Console.ReadLine().Split(' '), double.Parse);
	}
	
	public static string Reverse(string s)
	{
		var c = s.ToCharArray();
		Array.Reverse(c);
		
		return new String(c);
	}
	
	private static void WriteArray(int[] a)
	{
		Console.WriteLine(string.Join(" ", Array.ConvertAll( a, x=>x.ToString() ) ) );
	}

	private static void WriteArray(long[] a)
	{
		Console.WriteLine(string.Join(" ", Array.ConvertAll( a, x=>x.ToString() ) ) );
	}
	
	private static void WriteVector(Vector v)
	{
		Console.WriteLine("{0:f8} {1:f8}", v.X, v.Y);
	}
}

public struct Vector
{
	public double X,Y;
}

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

using namespace std;


int main()
{
    string s;
    cin>>s;
    for(int i=0;i<s.size();i++)
    {
        if((s[i+2]==s[i+3])&& (s[i+4]==s[i+5]))
            {cout<<"Yes"<<endl;
            break;}
        else
            {cout<<"No"<<endl;
            break; }
    return 0;
}
}


Measured memory_bytes: 256
fn main() {
    let (r, w) = (std::io::stdin(), std::io::stdout());
    let mut sc = IO::new(r.lock(), w.lock());
    let n: usize = sc.read();
    let k: usize = sc.read();

    let mut prefix = vec![];
    let mut suffix = vec![];
    for i in 0..n {
        if i % 2 == 0 {
            prefix.push(k + i);
        } else {
            suffix.push(k + i);
        }
    }

    prefix.extend(suffix);
    let a = prefix;
    let mut max_b = vec![];
    for i in 0..n {
        let c = 2 * n + i + k;
        let a = a[i];
        if c < a {
            println!("-1");
            return;
        }
        let b = c - a;
        max_b.push((b, i));
    }

    max_b.sort();
    let mut ans_b = vec![0; n];
    for i in 0..n {
        let b = k + n + i;
        if max_b[i].0 < b {
            println!("-1");
            return;
        }
        ans_b[max_b[i].1] = b;
    }

    for i in 0..n {
        let a = a[i];
        let b = ans_b[i];
        let c = 2 * n + i + k;
        sc.write(format!("{} {} {}\n", a, b, c));
    }

    // k + x
    // k+2 + x-1
    // ...
    // k+2a + x-a = k+x +0..a
    // k+1 + y
    // k+1+2+y-1
    // ...
    // k+2b+1+y-b = k+y+1 +0..b

    // k, ... ,k+2n-1
    // k+x+a+1 = k+y+1
    // x+a=y

    // k + x <= k+2N
    // k+2 + x-1 <= k+2N+1
    // k+4 + x-2
    // ...
    // k+2a + x-a <= k+2N+a
    // k+1 + x+a
    // k+3 + x+a-1
    // ...
    // k+1+2b + 2N+a-b <= k+3N-1
    // k+1+2a-2 + 2N + a - (a-1)
    // 2a = N-1
    // x=2N,
    // b=a-1

    // k   + 2N
    // k+2 + 2N-1
    // k+4 + 2N-2
    // ...
}

pub struct IO<R, W: std::io::Write>(R, std::io::BufWriter<W>);

impl<R: std::io::Read, W: std::io::Write> IO<R, W> {
    pub fn new(r: R, w: W) -> IO<R, W> {
        IO(r, std::io::BufWriter::new(w))
    }
    pub fn write<S: std::ops::Deref<Target = str>>(&mut self, s: S) {
        use std::io::Write;
        self.1.write(s.as_bytes()).unwrap();
    }
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .0
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r' || b == b'\t')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r' && b != b'\t')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 10364
#include<stdio.h>
int main()
{
	int a=0, b=0, c=0, i;
    char s[3];
	scanf("%s", s);
	
	for(i=0;i<3;i++){
    if(s[i]=='a') a++;
      else if(s[i]=='b') b++;
      else if(s[i]=='c') c++;
      else printf("error\n");
    }
  
  if(a == 1 && b == 1 && c == 1 )
    printf("Yes\n");
  else
    printf("No\n");
 
	return 0;
}

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

using namespace std;


int main() {
  #ifdef LOCAL
  freopen("sol.in", "r", stdin);
  freopen("sol.out", "w+", stdout);
  #endif
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n, k;
  cin >> n >> k;
  vector<int> h(n);
  for (int i = 0; i < n; i++) {
    cin >> h[i];
  }
  const int inf = (int) 1e9;
  vector<int> dp(n, inf);
  dp[0] = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 1; j <= k; j++) {
      if (i - j >= 0) {
        dp[i] = min(dp[i], dp[i - j] + abs(h[i] - h[i - j]));
      }
    }
  }
  cout << dp[n - 1] << '\n';
  return 0;
}

Measured memory_bytes: 1024
use proconio::*;
use num::bigint::*;

fn calc(a: &[u64]) -> BigUint {
    if a.len() == 1 {
        BigUint::from(a[0])
    } else {
        let m = a.len() / 2;
        let (a, b) = a.split_at(m);
        let l = calc(a);
        let r = calc(b);
        l * r
    }
}

fn run() {
    input! {
        n: usize,
        a: [u64; n],
    }
    let ans = calc(&a);
    if ans > BigUint::from(10u64.pow(18)) {
        println!("-1");
    } else {
        println!("{}", ans);
    }
}

fn main() {
    run();
}


Measured memory_bytes: 9840
#include <bits/stdc++.h>
using namespace std::literals::string_literals;
using i64 = std::int_fast64_t;
using std::cout;
using std::cerr;
using std::endl;
using std::cin;

template<typename T>
std::vector<T> make_v(size_t a){return std::vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return std::vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

int main() {
	int n; scanf("%d", &n);
	std::string s; cin >> s;

	std::vector<std::map<std::string, bool>> vec(4); vec[0][""] = true;
	for(int i = 0; i < s.size(); i++) {
		for(int k = 2; k >= 0; k--) {
			for(auto v: vec[k]) {
				vec[k + 1][v.first + s[i]] = true;
			}
		}
	}

	int ans = 0;
	for(auto v: vec[3]) ans += v.second;
	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i < n; i++)
#define rep3(i, n) for(int i = n-1; i >= 0; i--)
#define rep4(i, x, n) for(int i = x; i > n; i--)
#define elif else if
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1e9+7;
const ll MOD2 = 998244353;
const ll INF = 1e15;

int main(){
    string S;
    cin >> S;
    int N = S.size();
    ll sum = 0;
    ll count = 0;
    rep(i, N){
        if(S[i] == 'W'){
            sum += i;
            count++;
        }
    }
    cout << sum - count*(count-1)/2 << endl;
}

Measured memory_bytes: 640
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		int n = Integer.parseInt(scan.nextLine());

		String[] value = scan.nextLine().split(" ");
		long[] list = new long[n];
		long[] abslist = new long[n];
		long count = 0;
		long max = 0;
		long min = Long.MAX_VALUE;

		for(int i = 0; i < n; i++) {
			list[i] = Long.parseLong(value[i]);
			if(list[i] < 0) {
				count ++;
			}
			abslist[i] = Math.abs(list[i]);
			max += abslist[i];
			min = Math.min(min, abslist[i]);
		}

		if(count % 2 == 0) {
			System.out.println(max);
		}else {
			System.out.println(max - min * 2);
		}



	}

}

Measured memory_bytes: 56980
#!/usr/bin/env python3
n = int(input())
R = []
for _ in range(n):
    i = int(input())
    R.append(i)

i = 0
j = 0
m = -float("inf")
while j < n - 1:
    j += 1
    if R[j] - R[i] > m:
        m = R[j] - R[i]
    if R[i] > R[j]:
        i = j
print(m)

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

int main(){
  int a,b;
  char c;
  while(true){
    cin>>a>>c>>b;
    if(c=='?')break;
    switch(c){
      case '+':cout<<a+b<<endl;break;
      case '-':cout<<a-b<<endl;break;
      case '*':cout<<a*b<<endl;break;
      case '/':cout<<a/b<<endl;break;
    }
  }
}


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

template<class T>
void WarshallFloyd(vector<vector<T>> &G, T INF) {
    for(int i = 0; i < G.size(); ++i) G[i][i] = 0;
    for(int k = 0; k < G.size(); ++k) {
        for(int i = 0; i < G.size(); ++i) {
            for(int j = 0; j < G.size(); ++j) {
                if(G[i][k] == INF || G[k][j] == INF) continue;
                G[i][j] = min(G[i][j], G[i][k] + G[k][j]);
            }
        }
    }
}

void solve() {
    int N, M, L;
    cin >> N >> M >> L;
    vector<vector<long long>> G(N, vector<long long>(N, INF));
    for(int i = 0; i < M; ++i) {
        int a, b;
        long long c;
        cin >> a >> b >> c;
        a--, b--;
        G[a][b] = G[b][a] = c;
    }
    WarshallFloyd(G, INF);
    vector<vector<long long>> A(N, vector<long long>(N, INF));
    for(int i = 0; i < N; ++i) {
        for(int j = 0; j < N; ++j) {
            if(G[i][j] <= L) A[i][j] = 1LL;
        }
    }
    WarshallFloyd(A, INF);
    int Q; cin >> Q;
    while(Q--) {
        int s, t;
        cin >> s >> t;
        --s, --t;
        if(A[s][t] == INF) cout << -1 << '\n';
        else cout << A[s][t] - 1 << '\n';
    }
}

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


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

const int INF = 2e5;

int x, max_prime, tmp, cnt;
vector<int> p_array(INF);
vector<int> p_flg(INF, 1);

int main(){

    cin >> x;

    /*
    for (auto z: p_flg){
        cout << z;
    }
    cout << endl;
    */

    for (int i=2; i<INF; i++){
        if (p_flg.at(i) == 1){
            cnt = 2;
            tmp = i*cnt;

            while (tmp<INF){
                p_flg.at(tmp) = 0;
                cnt++;
                tmp = i*cnt;
            }
        }
    }

    for (int i=x; i<=INF; i++){
        if (p_flg.at(i) == 1){
            max_prime = i;
            break;
        }
    }

    /*
    for (auto z: p_flg){
        cout << z;
    }
    cout << endl;
    */

    cout << max_prime << endl;
    return 0;
}


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


int main()
{
    int a,b,N,t=1;
    cin>>a>>b>>N;
    
    int s[N],f[N];
    int p[1001];
    int c[1001];
    
    loop(1000)p[i]=0,c[i]=0;

    loop(N){
        cin>>s[i]>>f[i];
        p[s[i]]+=1;
        p[f[i]]-=1;
    }
    p[a]+=1;
    p[b]-=1;
    if(c[0]==2){
    cout<<1<<endl;
    t=0;
    }
    loop(1000){
    c[i+1]=c[i]+p[i];
        if(c[i+1]==2){
        cout<<1<<endl;
        t=0;
        break;
    }
    }
    if(t==1)cout<<0<<endl;
}



Measured memory_bytes: 3120
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i=0; i < n; i++)
#define repd(i, n) for (int i = n-1; i > -1; i--)
#define repran(i, a,b) for (int i = a; i<b;i++)
#define all(x) (x).begin(), (x).end()
#define v(T) vector<T>
#define vv(T) vector<v(T)>
typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
template<class T>bool chmax(T &a, const T &b){
    if (a < b) {a = b; return true;}
    return false;
}
template<class T>bool chmin(T &a, const T &b){
    if (a > b) {a = b; return true;}
    return false;
}
int n, m;
vvi g(100005);
int memo[100005];
int dp(int s){
    if (g[s].size()==0) {return memo[s] = 0;}
    if (memo[s] > 0) return memo[s];
    int ret = 0;
    for (int v : g[s]){
        chmax(ret, dp(v)+1);
    }
    return memo[s] = ret;
}

int main()
{
    cin >> n >> m;
    rep(i, m){
        int a, b;
        cin >> a >> b;
        a--;b--;
        g[a].push_back(b);
    }
    int ans = 0;
    rep(i, n) chmax(ans, dp(i));
    cout << ans << endl;
}

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

typedef long long ll;
typedef pair<int,int> ii;

int eval(int x) {
	if(x==1) return 1000;
	return x;
}

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int a,b; cin>>a>>b;
	int x=eval(a), y=eval(b);
	if(x>y) cout << "Alice" << endl;
	else if(x==y) cout << "Draw" << endl;
	else cout << "Bob" << endl;
	return 0;
}


Measured memory_bytes: 256
import sys, bisect, math, itertools, string, queue, copy
# import numpy as np
# import scipy
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations
from heapq import heappop, heappush
input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(input()) # n=1
def inpm(): return map(int,input().split()) # x=1,y=2
def inpl(): return list(map(int, input().split())) # a=[1,2,3,4,5,...,n]
def inpls(): return list(input().split())  # a=['1','2','3',...,'n']
def inplm(n): return list(int(input()) for _ in range(n)) # x=[] 複数行
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return sorted([list(map(int, input().split())) for _ in range(n)]) # [[1,1,1,1],[2,2,2,2],[3,3,3,3]] 
def graph():
    n=inp()
    g=[[] for _ in range(n)]
    for i in range(n):
        a = inp()
        a -= 1
        g[i].append(a)
        g[a].append(i)
    return n,g

def main():
    n,m = inpm()
    cnt = [0 for _ in range(n)]
    for _ in range(m):
        a,b = inpm()
        a -= 1
        b -= 1
        cnt[a] += 1
        cnt[b] += 1
    for i in range(n):
        if cnt[i]%2 == 1:
            print('NO')
            return
    print('YES')
 
if __name__ == "__main__":
    main()

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

int main(void) {
    int h, w;
    cin >> h >> w;
    vector<vector<char>> color(h, vector<char>(w));
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            cin >> color.at(i).at(j);
        }
    }

    // 黒いマスが存在する行を記録
    vector<bool> check_row(h);
    for (int i = 0; i < h; i++) {
        check_row.at(i) = false;
        for (int j = 0; j < w; j++) {
            if (color.at(i).at(j) == '#') {
                check_row.at(i) = true;
            }
        }
    }
    // 黒いマスが存在する列を記録
    vector<bool> check_column(w);
    for (int j = 0; j < w; j++) {
        check_column.at(j) = false;
        for (int i = 0; i < h; i++) {
            if (color.at(i).at(j) == '#') {
                check_column.at(j) = true;
            }
        }
    }

    for (int i = 0; i < h; i++) {
        if (check_row.at(i) == false) {
            continue;
        }
        for (int j = 0; j < w; j++) {
            if (check_column.at(j) == false) {
                continue;
            }
            cout << color.at(i).at(j);
        }
        cout << endl;
    }
    cout << endl;
}

Measured memory_bytes: 256
/*input
7
1 1 1 1 1 1 1
*/
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
#include <iomanip>

using namespace std; 

int GCD(int x,int y){return y?GCD(y,x%y):x;}
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define rep(i,n) for(int i=0;i<(n);i++)
#define repl(i,a,b) for(int i=(a);i<(b);i++)
#define repm(i,a,b) for(int i=(a);i>(b);i--)
#define rept(v) for(auto it=v.begin();it<v.end();it++)
#define all(v) v.begin(),v.end()
const int INF = 1<<30;
typedef long long ll;
typedef pair<int,int> pii;


int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n;
	cin >> n;
	vector<int> a(n), ansv;
	rep(i,n) cin >> a[i];
	sort(all(a));
	reverse(all(a));
	ll ans=0;
	repl(i, 1, n) {
		if(i-1==(n+1)/2) break;
		ans+=a[i-1];
		ansv.push_back(a[i-1]);
	}
	ans-=ansv.back();
	// cout << ans << endl;
	// rept(ansv) cout << *it << " ";
	// cout << endl;
	repl(i, 1, ansv.size()) {
		ans+=ansv[i];
	}
	if(n%2==0) ans+=ansv.back();
	cout << ans;
	return 0;
}


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

using namespace std;

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

    if (N == 0)
    {
        printf("%d", X);
        return 0;
    }

    int p[110], t = 1;
    bool flag2 = false;

    for (int i = 0; i < N; i++)
        scanf("%d", &p[i]);

    for (int i = 0; i < N; i++)
    {
        if (X == p[i])
        {
            flag2 = true;
            break;
        }
    }
    if (!flag2)
    {
        printf("%d", X);
        return 0;
    }

    int check;
    bool flag = false;
    for (int i = 0; i < N; i++)
    {
        if (i % 2 == 0)
        {
            check = X - t;
            for (int j = 0; j < N; j++)
            {
                if (p[j] == check)
                {
                    flag = true;
                    break;
                }
            }
            if (flag)
            {
                flag = false;
                continue;
            }
            else
            {
                printf("%d", check);
                return 0;
            }
        }
        else
        {
            check = X + t;
            for (int j = 0; j < N; j++)
            {
                if (p[j] == check)
                {
                    flag = true;
                    break;
                }
            }
            t++;
            if (flag)
            {
                flag = false;
                continue;
            }
            else
            {
                printf("%d", check);
                return 0;
            }
        }
    }

    return 0;
}

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

using namespace std;

int n;
char str[100100];
int cnt[30];

int main() {
    int i;

    scanf("%d",&n);
    scanf("%s",str);
    for (i=0;i<n;i++) {
        cnt[str[i]-'a']++;
    }
    long long t = 1;
    for (i=0;i<26;i++) {
        t*=cnt[i]+1;
        t%=1000000007;
    }
    printf("%lld\n",(t+1000000006)%1000000007);

    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (long long  i=a;i<n;i++)
#define sz(A) (int)(A.size())
#define all(x) (x).begin(),(x).end()
#define get(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
typedef long long ll;
typedef pair<int, int> PII;
typedef vector<int> VI;

void solve() {
	ll n;
	cin >> n;
	vector<ll> a(n);
	rep(i, 0, n)cin >> a[i];
	ll sum = 0;
	ll pre = a[0];
	rep(i, 1, n) {
		sum += max(pre - a[i], 0LL);
		pre = max(pre, a[i]);
	}
	cout << sum << endl;
}
int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int T_ = 1;
	//cin >> T_;
	for (int i = 0; i < T_; i++)solve();
	return 0;
}



Measured memory_bytes: 4760
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <cmath>
#include <iomanip>
#include <bitset>
#include <string>
#include <stdlib.h>
using namespace std;
//cout <<  << endl;
typedef long long int ll;
typedef long double ld;

int main(){
    string x;
    cin >> x;
    for (int i=0;i<x.size()-8;++i){
        cout << x[i];
    }
    cout << endl;
    return 0;
}


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();
        List<Long> aList = new ArrayList<>();
        long ans = 0;
        for (int i=1;i<=n;i++) {
            aList.add(sc.nextLong());
        }
        Collections.sort(aList);

        ans += aList.get(n-1);
        for (int i=(n-2);i>=((n+1)/2);i--) {
            long aa = aList.get(i) * 2;
            ans += aa;
        }
        if (n%2 == 1) {
            ans += aList.get((n+1)/2 - 1);

        }
        System.out.println(ans);
    }
}


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

int main()
{
    int N, T; cin>>N>>T;
    vector<int> t(N); for(auto& e: t) cin>>e;

    long res=T;
    for(int i=1; i<N; ++i) res+=t[i]-t[i-1]<T ? T-(T+t[i-1]-t[i]) : T;
    cout<<res<<endl;
}

Measured memory_bytes: 1024
#include <stdio.h>
#include <stdlib.h>
using namespace std;

int n,i,j,k,l,r;
int a[1000005];

int main()
{
	scanf("%d",&n);
	l=r=n;
	scanf("%d",&a[l]);
	for(i=2;i<=n;++i)
	{
		scanf("%d",&k);
		if(i&1)a[++r]=k;else a[--l]=k;
	}
	if((n&1)==0)for(i=l;i<=r;++i)printf("%d ",a[i]);
	else for(i=r;i>=l;--i)printf("%d ",a[i]);
}

Measured memory_bytes: 2816
#include <bits/stdc++.h>
#define ll long long
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define rep(i, a, n) for ( i = a; i < (n); i++)
#define fill(a,v)                    memset(a, v, sizeof(a))
#define sz(a)                       ((int)(a.size()))
#define x first
#define y second
#define mp make_pair
#define pb push_back
using namespace std;
#define MOD 1e9+7
double dp[3000][3000];
int main(){
	fast;
	ll i,j,W,k,tc,q,m,n,flag;	
	cin>>n;
	double p[n];
	rep(i,0,n+1)
		rep(j,0,n+1)
			dp[i][j]=0;

	rep(i,0,n){
		cin>>p[i];
	}
	rep(i,0,1){
		dp[0][i]=1.0;
	}
	rep(k,1,n+1){
		rep(j,0,k+1){
			if(j==0)
				dp[k][j] = dp[k-1][j]*(1-p[k-1]);
			else{
			dp[k][j]= dp[k-1][j]*(1-p[k-1]) + dp[k-1][j-1]*p[k-1];
		}
		}
	}
	// rep(i,0,n+1){
	// 	rep(j,0,n+1){
	// 		cout<<dp[i][j]<<" ";
	// 	}
	// 	cout<<endl;
	// }
	double ans=0;
	rep(j,0,n+1){
		ll tails = n-j;
			if(j>tails){
				ans += dp[n][j];
			}
	}
	cout<<setprecision(10)<<ans<<endl;
	return 0;
}


Measured memory_bytes: 70656
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define REP(i, a, b) for(ll i = ll(a); i <= ll(b); i++)
bool checkPalindrome(string n)
{
    string r=n;
    reverse(r.begin(),r.end());
    if(n==r)
        return true;
    else
        return false;
}
int main()
{
	string n1,n2,s; 
    ll num1,num2,cnt=0;
    cin>>n1>>n2;
    num1=stoll(n1);
    num2=stoll(n2);
    REP(i,num1,num2)
    {   
        s=to_string(i);
        if(checkPalindrome(s))
            cnt++;
    }
    cout<<cnt;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
using namespace std;
inline ll read(){
	ll k=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){k=k*10+ch-'0';ch=getchar();}
	return k*f;
}
ll n,m;
int main()
{
	n=read();m=read();
	ll ans=min(n,m/2);
	n-=ans;m-=ans*2;
	ans+=m/4;
	cout<<ans<<endl;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-

import sys
from itertools import accumulate

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

N, M, Q = MAP()

# 2次元累積和
# acc[i][j] := 都市iで区間開始前で都市jで区間終了後である列車の数
acc = list2d(N, N, 0)
for i in range(M):
    l, r = MAP()
    l -= 1; r -= 1
    acc[l][r] += 1
# 区間開始前かどうかを持つ1次元目は後ろから累積和する
for j in range(N):
    for i in range(N-2, -1, -1):
        acc[i][j] += acc[i+1][j]
for i in range(N):
    acc[i] = list(accumulate(acc[i]))

ans = [''] * Q
for i in range(Q):
    p, q = MAP()
    p -= 1; q -= 1
    ans[i] = str(acc[p][q])
print('\n'.join(ans))


Measured memory_bytes: 17428
import java.util.*;
import java.lang.Math;

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();
    int m = sc.nextInt();
    double rot;
    double hrot;
    double mrot;
    double ans;
    
   	hrot = h*30 + 30*m/60.0;
    
    mrot = 360*m/60.0;
    
    rot = Math.abs(hrot - mrot);
    if(rot > 180) rot = 360 - rot;
    
    ans = (double)a*a + (double)b*b - 2*a*b*Math.cos(Math.toRadians(rot));
    ans = Math.sqrt(ans);
    
    System.out.println(ans);
  }
}


Measured memory_bytes: 35936
// #include <stack>
#include <queue>
#include <map>
#include <set>
#include <vector>
#include <random>
#include <cmath>
#include <chrono>
#include <cstring>
#include <algorithm>
#include <string>
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cassert>
using namespace std;
using LL = long long;
#define eps 1e-8
#define fi first
#define se second
#define eb emplace_back
#define close std::ios::sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr)
#define FOR(i, x, y) for (LL i = (x), _##i = (y); i < _##i; ++i)
#define FORD(i, x, y) for (LL i = (x), _##i = (y); i > _##i; --i)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define CASET int ___T; cin>>___T; for(int __CS=1;__CS<=___T;__CS++)
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
mt19937 dlsrand(random_device{}());
mt19937 mrand(std::chrono::system_clock::now().time_since_epoch().count()); 
int rnd(int x) { return mrand() % x;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
LL bin(LL x, LL n, LL MOD) {LL ret = MOD != 1;for (x %= MOD; n; n >>= 1, x = x * x % MOD)if (n & 1) ret = ret * x % MOD;return ret;}
inline LL get_inv(LL x, LL p) { return bin(x, p - 2, p); }
const double PI = acos(-1.0);
constexpr int maxn = 1e6+10;
constexpr int INF = 0x3f3f3f3f;
constexpr ll linf = 0x3f3f3f3f3f3f3f3f;
constexpr int mod = 1e9+7;
void add(int &a,int b) {a+=b; if(a>=mod) a-=mod;}
void dec(int &a,int b) {a-=b; if(a<0) a+=mod;}
int main()
{
    string s;
    cin >> s;
    if(s.find('7')!=s.npos)puts("Yes");else puts("No");
    
}

Measured memory_bytes: 3644