akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <regex>
#include <numeric>
using namespace std;

/*--- Macro ---*/
#define rep(i, n) for(int i=0; i<(int)n; i++)
#define rep1(i, n) for(int i=1; i<(int)n; i++)
#define mp make_pair
#define pb push_back
#define all(a) a.begin(), a.end()

/*---  Type ---*/
typedef long long ll;

/*--- Constants ---*/
template <typename T> const T INF = numeric_limits<T>::max() / 10;
const int MOD = (int)1e9 + 7;

// Floating
const double EPS = 1e-11;
#define EQ0(x) (abs(x) < EPS)
#define EQ(x, y) (abs(a-b) < EPS)

// Util
int max(int a, int b, int c) {return max(a, max(b, c));}
int min(int a, int b, int c) {return min(a, min(b, c));}
ll max(ll x, ll y) {return x > y ? x : y;}
ll min(ll x, ll y) {return x < y ? x : y;}
ll max(ll a, ll b, ll c) {return max(a, max(b, c));}
ll min(ll a, ll b, ll c) {return min(a, min(b, c));}

// -------------------------------------------------------------------------------------



int main() {
  int n;
  cin >> n;
  vector<int> d(100);
  fill(all(d), 0);

  rep(i, n) {
    int di;
    cin >> di;
    d[di-1]++;
  }

  int ans = 0;
  rep(i, 100) {
    if(d[i] != 0) ans++;
  }
  cout << ans << endl;
  return 0;
}

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;
typedef pair<int,int> P;
const int MAX_N = 200005;
ll A[MAX_N],B[MAX_N];

int main()
{
	int N;
	cin >> N;
	rep(i,N)
	{
		cin >> A[i];
		A[i]--;
		B[A[i]]++;
	}
	ll ans = 0;
	rep(i,N)
	{
		ans += B[i]*(B[i]-1)/2;
	}
	rep(i,N)
	{
		cout << ans - (B[A[i]]-1) << endl;
	}
	return 0;
}

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

int main()
{
	int n, m, arr[1001], sum[1000001];
	while (cin >> n >> m){
		if (!n && !m)return 0;
		int cnt = 0, res = 0;
		for (int i = 1; i <= n; ++i)scanf("%d", &arr[i]);
		for (int i = 0; i <= n; ++i){
			for (int j = n; j > i; --j){
				if (arr[i] + arr[j] <= m)sum[cnt++] = arr[i] + arr[j];
			}
		}
		sort(sum, sum + cnt);
		for (int i = 0; i < cnt; ++i){
			res = max(res, sum[i] + *(upper_bound(sum, sum + cnt, m - sum[i]) - 1));
		}
		printf("%d\n", res);
	}
}


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

int main() {
  long n;
  cin >> n;
  vector<long> ans(n);
  for(long x=1;x*x+1+1+x+1+x<=n;x++) {
    for(long y=1;x*x+y*y+1+x*y+y+x<=n;y++) {
      for(long z=1;x*x+y*y+z*z+x*y+y*z+z*x<=n;z++) {
        ans[x*x+y*y+z*z+x*y+y*z+z*x-1]++;
      }
    }
  }
  for(long i=0;i<n;i++) cout << ans[i] << endl;
}

Measured memory_bytes: 3672
#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long int n,i,j,k;
	cin>>n>>k;
	long long int ans[n+10];
		long long int a[n+10];
	long long int p=1000000000;
	for(i=1;i<=n;i++)
	cin>>a[i];
	fill(ans,ans+n+10,p);
	ans[1]=0;
	
	for(i=1;i<=n;i++)
	{
		for(j=1;j<=k&&i+j<=n;j++)
		{
			
			ans[i+j]=min(ans[i+j],ans[i]+abs(a[i+j]-a[i]));
		}
	}
	cout<<ans[n]<<endl;
	
	
	
}

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

using namespace std;

int main()
{
    int h, w, a[505][505];
    cin >> h >> w;

    for (int i = 0; i < h; i++)
    {
        for (int j = 0; j < w; j++)
        {
            cin >> a[i][j];
        }
    }
    vector<pair<pair<int,int>, pair<int,int> > > vii;
    for (int i = 0; i < h; i++)
    {
        for (int j = 0; j < w; j++)
        {
            if (a[i][j] % 2 != 0)
            {
                if (j + 1 < w)
                {
                    vii.push_back(make_pair(make_pair(i, j), make_pair(i, j + 1)));
                    a[i][j]--;
                    a[i][j + 1]++;
                }
                else if (i + 1 < h)
                {
                    vii.push_back(make_pair(make_pair(i, j), make_pair(i + 1, j)));
                    a[i][j]--;
                    a[i + 1][j]++;
                }
            }
        }
    }
    cout << vii.size() << endl;
    for (auto i : vii)
    {
        cout << i.first.first + 1 <<" " << i.first.second + 1 << " " << i.second.first + 1 << " " << i.second.second + 1 << endl;
    }

    return 0;
}


Measured memory_bytes: 5232
//----------BHAVIK DIWANI(PICT_COMP)---------------
#include<bits/stdc++.h>
#include<stdlib.h>
#include<stdio.h>
#define test ll t; cin>>t; while(t--)
#define FOR(p,n) for(ll i=p;i<(ll)n;i++)
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define mod 1000000007
#define ll long long
#define int long long
#define ull unsigned long long
#define MAX 1000005
#define pb push_back
#define mkp make_pair
#define vi vector<int>
#define pii pair<int,int>
#define endl '\n'
#define vs vector<string>
#define mii map<int,int>
#define msi map<string,int>
#define vpii vector< pair<int, int > >
#define vpsi vector< pair< string ,int > >
#define forci(p,q) for(int i=p;i<q;i++)
ll gcd(ll a,ll b){ if(b==0) return a;    return gcd(b,a%b);}
ll lcm(ll a,ll b) { return (a/gcd(a,b)*b);}
ull power(ull a, ull b) {a %= mod;  ull res = 1;  while (b > 0) { if (b & 1) res = res * a % mod;  a = a * a % mod;  b >>= 1; }  return res%mod; }
ll modmul(ll x, ll y){return (x*y)%mod;}
ll modadd(ll x, ll y){return (x+y)%mod;}
ll modsub(ll x, ll y){return (x-y+mod)%mod;}
ll fact[1000007]={0};
void facto() {fact[0]=1;fact[1]=1;for(int i=2;i<100007;i++)fact[i]=(fact[i-1]*i)%mod;}
ll ncr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(power(fact[r],mod-2)))%mod; res=(res*(power(fact[n-r],mod-2)))%mod; return res;}
ll npr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(power(fact[n-r],mod-2)))%mod; return res;}
inline long long toint(const std::string &s) {std::stringstream ss; ss << s; long long x; ss >> x; return x;}
inline std::string tostring(long long number) {std::stringstream ss; ss << number; return ss.str();}
inline std::string tobin(long long x) {return std::bitset<63>(x).to_string();}
/*bool prime[MAX];
ull sieve(){memset(prime,true,sizeof(prime));for(ull p=2;p*p<MAX;p++){if(prime[p]==true){for(ull i=2*p;i<MAX;i+=p){prime[i]=false;}}}prime[0]=0;prime[1]=0;
}*/
/*int inv[1000001]={0};
void findinverse(){inv[1] = 1;for(int i = 2; i <=1e6 ; ++i)	inv[i] = (mod - (mod/i) * inv[mod%i] % mod) % mod;}
*/
using namespace std;
int solve()
{
	string s;
	cin>>s;
	int i=0,j=s.length()-1;
	int cnt=0;
	while(i<j){
		if(s[i]!=s[j])
			cnt++;
		i++;
		j--;
	}
	cout<<cnt<<endl;
	return 0;
}
signed main()
{
	fastio;
//	test
		solve();
}






Measured memory_bytes: 3616
#include <iostream>
#include <vector>
#include <algorithm>
 
#define ascent(i, a, b) for(int (i) = (a); (i) < (b); (i) ++)

using namespace std;

int main() {
  int n, tmp;
  vector<int> p;
  while(true) {
    cin >> n;
    if(n == 0) break;

    p.clear();
    while(n --) {
      cin >> tmp;
      p.push_back(tmp);
    }

    sort(p.begin(), p.end());

    int sum = 0;
    ascent(i, 1, p.size()-1) {
      sum += p[i];
    }

    cout << sum/(p.size()-2) << endl;
  }
      
  return 0;
}

Measured memory_bytes: 1216
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <cmath>
#include <iomanip>
#include <algorithm>
using namespace std;

int str_to_number(string str){
    int ans = 0;
    for(int i = 0; i < str.size(); i++){
        ans += str[i] - '0';
    }
    return ans;
}

int main(){
    int n, a, b;
    cin >> n >> a >> b;
    int ans = 0;
    for(int i = 1; i <= n; i++){
        int sum = str_to_number(to_string(i));
        if(sum >= a && sum <= b){
            ans += i;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))

memo = {1:0,2:0,3:0,4:0,5:0,6:0,7:0,8:0}
over = 0

for a in A:
    if a < 400:
        memo[1] = 1
    elif a < 800:
        memo[2] = 1
    elif a < 1200:
        memo[3] = 1
    elif a < 1600:
        memo[4] = 1
    elif a < 2000:
        memo[5] = 1
    elif a < 2400:
        memo[6] = 1
    elif a < 2800:
        memo[7] = 1
    elif a < 3200:
        memo[8] = 1
    else:
        over += 1

default_color = 0
for key in memo:
    default_color += memo[key]

if default_color > 0:
    print(default_color, default_color+over)
else:
    print(1, over)


Measured memory_bytes: 3064
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val s = readLine()!!.toString()
    val k = readLine()!!.toInt()
    val correct = s[k - 1]
    val ans = CharArray(n)
    for (i in 0 until n) {
        if (s[i] != correct) ans[i] = '*'
        else ans[i] = s[i]
    }
    println(ans)
}


Measured memory_bytes: 31796
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <iomanip>


using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;

#define rep(i, a, b) for (int i=a; i<(b); i++)
#define rp(i, a) for (int i=0; i<(a); i++)
#define repd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define rpd(i,a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define shandom_ruffle random_shuffle

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy


int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cout << std::setprecision(9);
    cout << std::fixed;

    string s1,s2,s3;
    cin >> s1 >> s2 >> s3;
    cout << "A"<<s2[0]<<"C"<<endl;

    return 0;
}

// read the question correctly (ll vs int)
// template by super1 derived from bqi343


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

using namespace std;
typedef long long ll;

int main () {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    ll a, b, c, d; cin >> a >> b >> c >> d;
    cout << max(max(a * c, a * d), max(b * c, b * d)) << endl;
    return 0;
}


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

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

    int n = s.size();

    for(int i = 0; i < n; i++){
        if(s.at(i) == ','){
            cout << " ";
            continue;
        }
        cout << s.at(i);
    }
    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 REP1(i,n) for(int i=1;i<=(int)(n);i++)
#define RREP(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(int i=a;i<b;i++)


int main(){
	int d;
	int temp=0;
	int temp1=0;
	int dcrall=0;

	vector<int> c(26);
	vector<int> ci(26);
	vector<int> rec(26,0);
	vector<int>late(26,0);
	vector<long>dcr(26,0);
	cin >> d ;
	REP(i,26)cin >> c.at(i);

	REP1(days,d){
		REP(i,26){
			dcr.at(i)+=c.at(i);
			dcrall+=c.at(i);
		}
		REP(i,26)cin >> ci.at(i);
		REP1(i,25)if(ci.at(temp)<ci.at(i))temp=i;
		if(dcrall<ci.at(temp)){
			cout << temp+1 << endl;
			dcrall-=dcr.at(temp);
			dcr.at(temp)=0;
		}
		else{
			REP(i,26)if(dcr.at(temp1)<dcr.at(i))temp1=i;
			cout << temp1+1 << endl;
			dcrall-=dcr.at(temp1);
			dcr.at(temp1)=0;
		}			
		temp=0;
		temp1=0;
	}
}


Measured memory_bytes: 3588
#include <stdio.h>
#include <limits.h>
int max(int x,int y){
	int N=sizeof(x)*CHAR_BIT;
	return y ^ ( (x ^ y) & ( (y - x) >> (N - 1) ) );
}
int min(int x,int y){
	int N=sizeof(x)*CHAR_BIT;
	return y ^ ( (x ^ y) & ( (x - y) >> (N - 1) ) );
}
int main(){
	int x,y;
	for(;scanf("%d%d",&x,&y),x|y;)printf("%d %d\n",min(x,y),max(x,y));
	return 0;
}

Measured memory_bytes: 1012
import java.io.File;
import java.io.FileInputStream;
import java.util.Scanner;
import java.util.Map.Entry;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.Deque;
import java.util.HashMap;
import java.util.List;
import java.util.NoSuchElementException;

public class Main {
	
	public static void main(String[] args) throws IOException {
		FastScanner sc = new FastScanner(System.in);
		
		long N = sc.nextLong();
		long A = sc.nextLong();
		long B = sc.nextLong();
		if(B < A) System.out.println(0);
		else if(N == 1 && A != B) System.out.println(0);
		else{
			System.out.println((A + B * (N - 1)) - (B + A * (N - 1)) + 1);
		}
		
	}
}

class FastScanner {
    private InputStream in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    public FastScanner(InputStream in) {
		this.in = in;
	}
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() {
    	if (hasNextByte()) return buffer[ptr++];
    	else return -1;
    }
    private static boolean isPrintableChar(int c){
    	return 33 <= c && c <= 126;
    }
    public boolean hasNext() {
    	while(hasNextByte() && !isPrintableChar(buffer[ptr]))
    		ptr++; return hasNextByte();
    }
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble() {
    	return Double.parseDouble(next());
    }
}

Measured memory_bytes: 22484
H,W=map(int,input().split())

grid=[]

m=10**9+7

for i in range(H):
    a= list(input())
    grid.append(a)

dp=[ [0]*(W+3) for _ in range(H+3)]

for i in reversed(range(H)):
    for j in reversed(range(W)):
        dp[i][j] = dp[i+1][j] + dp[i][j+1]
        dp[H-1][W-1]=1
        if grid[i][j]=="#":
            dp[i][j]=0
print(dp[0][0]%m)

Measured memory_bytes: 165276
N = int(input())
S = [sorted(list(input())) for _ in range(N)]
s = sorted(S)
s.append(["X"])
sum = 0
num = 1
for i in range(N):
  if s[i] == s[i+1]:
    num += 1
  else:
    sum += num*(num-1)//2
    num = 1
print(sum)

Measured memory_bytes: 99288
// inputに入力データ全体が入る
function Main(input) {
    // 1行目がinput[0], 2行目がinput[1], …に入る
    input = input.split("\n");
    tmp0 = input[0].split(" ");
    A = tmp0[0]
    B = tmp0[1]
    C = tmp0[2]

    var ans = C-(A-B)

    if(ans >= 0){
      console.log(ans)
    }else{
      console.log(0)
    }    
}
  //*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
// Main("12 3 7\n");

Measured memory_bytes: 21064
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <utility>
#include <cmath>
#include <tuple>
#include <queue>
#include <bitset>
#include <set>
#include <map>
#include <list>

using namespace std;


void solve(long long N, long long K, std::vector<long long> H){
  H.push_back(0LL);
  vector<vector<vector<long long>>> dp(N+1, vector<vector<long long>>(N+1, vector<long long>(K+1, 0)));
  long long t;
  const long long MAX = N * 1000000000;
  dp[N][N][0] = H[N];
  for (int i = N-1; i >= 0; --i) {
    for (int j = N; j > i; --j) {
      for (int k = 1; k <= K; ++k) {
        dp[i][j][k] = dp[i+1][j][k-1];
      }
      dp[i][j][0] = MAX;
    }
    for (int k = 0; k <= K; ++k) {
      t = MAX;
      for (int j = N; j > i; --j) {
        t = min(dp[i+1][j][k] + max(H[i] - H[j], 0LL), t);
      }
      dp[i][i][k] = t;
    }
  }
  long long ret = MAX;
  for (int j = 0; j < N+1; ++j) {
    for (int k = 0; k <= K; ++k) {
      ret = min(dp[0][j][k], ret);
    }
  }
  std::cout << ret << std::endl;
}

int main(){
  long long N;
  scanf("%lld",&N);
  long long K;
  scanf("%lld",&K);
  std::vector<long long> H(N);
  for(int i = 0 ; i < N ; i++){
    scanf("%lld",&H[i]);
  }
  solve(N, K, std::move(H));
  return 0;
}


Measured memory_bytes: 216832
import std.stdio;
import std.conv;
import std.string;
import core.bitop;

void main()
{
    auto N = readln.chomp.to!long;
    immutable march = "MARCH";
    long[march.length] list;

    foreach (_; 0 .. N)
    {
        auto name = readln();
        foreach (i, c; march)
        {
            if (name[0] == c)
            {
                list[i]++;
            }
        }
    }
    long nonzero;
    byte mask;
    foreach (i, n; list)
    {
        if (n != 0)
        {
            mask |= 1 << i;
            nonzero++;
        }
    }

    long result;

    foreach (comb; 0b0 .. 0b111111)
        if ((comb & mask) == comb && popcnt(comb) == 3)
        {
            long tmp = 1;
            foreach (i, n; list)
                if ((comb & (1 << i)) != 0)
                {
                    tmp *= n;
                }
            result += tmp;
        }
    writeln(result);
}


Measured memory_bytes: 1276
#include<iostream>
// cout endl cin //
#include<cstdio>
// printf scanf //
#include<cctype>
// 文字の判別や変換 //
using namespace std;

int main(){
    char ch;
    int cnt[26]={};
    
    while(cin >> ch){
        ch = tolower(ch);
        //chの小文字を返す//(ch = this is a pen)
        if (isalpha(ch)){
            cnt[ch-'a'] = cnt[ch - 'a'] + 1;
        }
    }
    
    for ( int i=0; i<26; i++){
        printf ("%c : %d\n", i+'a',cnt[i]);
    }
    return 0;
}


Measured memory_bytes: 3196
n = gets.to_i
as = gets.split(' ').map(&:to_i)
bs = gets.split(' ').map(&:to_i)
cs = gets.split(' ').map(&:to_i)

s = 0
prev_a = nil

as.each do |a|
  s += bs[a - 1]

  if prev_a && a == prev_a + 1
    s += cs[prev_a - 1]
  end

  prev_a = a
end

puts s

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

#define PI 3.14159265358979323846264338327950L

int main(void) {
    int A, B, H, M;
    cin >> A >> B >> H >> M;

    long double hr_ang = 360.0/12.0 * H;
    long double mn_ang = 360.0/60.0 * M;

    if (mn_ang == 0) mn_ang = 360;
    if (hr_ang == 0) hr_ang = 360;

    long double ang = abs((hr_ang + 30.0*(M/60.0)) - mn_ang);

    long double ans = A*A + B*B - (2 * A * B * cos(ang * PI / 180));
    
    printf("%.18Lf\n", sqrt(ans));

    return 0;
}

Measured memory_bytes: 4120
MOD=998244353
N,S=map(int,input().split())
alist=list(map(int,input().split()))

dp=[[0]*(S+1) for _ in range(N+1)]
dp[0][0]=1

for i in range(1,N+1):
  for k in range(S+1):
    dp[i][k]=2*dp[i-1][k]
    if k-alist[i-1]>=0:
      dp[i][k]+=dp[i-1][k-alist[i-1]]
    dp[i][k]%=MOD
#print(dp[-1])

print(dp[N][S])

Measured memory_bytes: 132624
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n,m,x,fr,ba;
	cin>>n>>m>>x;
	fr=0;
	ba=0;
	int a[m];
	for(int i=0;i<m;i++){
		cin>>a[i];
		if(a[i]<x){
			fr++;
		}
		else{
			ba++;
		}
	}
	int mi=min(fr,ba);
	cout<<mi<<endl;
}

Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var s string
	var ans []string
	for {
		fmt.Scan(&s)
		if s == "-" {
			break
		}
		var m int
		fmt.Scan(&m)
		for i := 0; i < m; i++ {
			var h int
			fmt.Scan(&h)
			// 文字列の前からh文字(インデックスは0~h-1とh~len(s)-1で前後に分離し、前後を入れ替える
			s = s[h:] + s[:h]
		}
		ans = append(ans, s)
	}
	// fmt.Println(ans) - debug
	for i := 0; i < len(ans); i++ {
		fmt.Println(ans[i])
	}
}



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

int main(){
    int n;
    cin >> n;
    vector<int> d(n);

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

    long long ans = 0;
    for (auto i = 0; i < n; i++)
    {
        for (auto j = i+1; j < n; j++)
        {
            ans += d[i] * d[j];
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
const int INF = 2000000000;
using namespace std;

const int gmax_n = 200005;

int par[gmax_n * 2]; //親
int depth[gmax_n * 2];//木の深さ

void init(int n){
    rep(i,n){
        par[i] = i;
        depth[i] = 0;
    }
}

int find(int x){
    if(par[x] == x){
        return x;
    }else {
        return par[x] = find(par[x]);
    }
}

void unite(int x, int y){
    x = find(x);
    y = find(y);
    if(x == y) return;

    if(depth[x] < depth[y]){
        par[x] = y;
    }else{
        par[y] = x;
        if(depth[x] == depth[y]) depth[x]++;
    }
}

bool same(int x, int y){
    return find(x) == find(y);
}

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

    init(n * 2);
    rep(i,k){
        int a, b;
        cin >> a >> b;
        a--; b--;
        unite(a,b);
    }

    rep(i,l){
        int a, b;
        cin >> a >> b;
        a--; b--;
        unite(a + n, b + n);
    }

    pair<int, int> p[gmax_n];
    map<pair<int, int>, int> m;
    rep(i,n) p[i] = make_pair(find(i), find(i + n));
    rep(i,n) m[p[i]]++;
    rep(i,n){
        if(i) cout << ' ';
        cout << m[p[i]];
    }
    cout << endl;
}


Measured memory_bytes: 16640
// クラス
import java.util.*;
public class Main{
    static Scanner kbd = new Scanner(System.in);
    public static void main(String[] args){
	double[] clz = {48.00, 51.00, 54.00, 57.00, 60.00, 
			64.00, 69.00, 75.00, 81.00, 91.00};
	String[] name = {"light fly", "fly", "bantam", "feather", "light",
			 "light welter", "welter", "light middle", "middle",
			 "light heavy"};
	while(kbd.hasNext()){
	    double w = kbd.nextDouble();
	    int i=0;
	    while(i<clz.length && w>clz[i]) i++;
	    if(i < clz.length){
		System.out.println(name[i]);
	    }
	    else{
		System.out.println("heavy");
	    }
	}
    }
}

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

// #include "debug.h"
#define debug(...) 42


using ll = long long;

ll f(ll n, ll x) {
   return n / x;
}

void solve() {
   int n, m, x, y;
   cin >> n >> m;
   vector <int> v(n);
   for(int i = 0; i < n; i++) {
      cin >> v[i];
   }
   sort(v.begin(), v.end());

   vector <pair <int, int> > cb(m);
   for(int i = 0; i < m; i++) {
      cin >> x >> y;
      cb[i] = {y, x};
   }
   sort(cb.rbegin(), cb.rend());

   debug(cb);
   int ptr = 0;
   for(int i = 0; i < m; i++) {
      int c = cb[i].first;
      int b = cb[i].second;
      debug(c, b, ptr);
      int ptr1 = ptr;
      for(int j = ptr; j < min(ptr + b, n); j++) {
         if(v[j] < c) {
            v[j] = c;
            ptr1 = j + 1;
         }
         else break;
      }
      ptr = ptr1;
   }
   debug(v);
   ll ans = accumulate(v.begin(), v.end(), 0LL);
   cout << ans << endl;

}

int main() {
   cin.tie(0);
   cin.sync_with_stdio(0);
   int testcase = 1;
   // cin >> testcase;

   for(int i = 0; i < testcase; i++) {
      solve();
   } 
   return 0;
}


Measured memory_bytes: 4428
import java.util.*

fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val ln = readLine()!!.split(" ").map(String::toInt).sorted()

    var sum = 0
    for (ai in 0 until ln.size - 2) {
        val a = ln[ai]
        for (bi in ai + 1 until ln.size - 1) {
            val b = ln[bi]
            for (ci in bi + 1 until ln.size) {
                if (ln[ci] < a + b) {
                    sum++
                } else {
                    break
                }
            }
        }
    }
    println(sum)
}



Measured memory_bytes: 46356
//>> OI Solution Info <<//
// Version: 2
// State: Progress
// Problem: ---
// ID: ---
// Timeline:
//   --- ~ --- Initialize
// Review:
//   ---
//>> End <<//
#include <iostream>
#include <stdio.h>
using namespace std;
const int mod=1000000007;

int n,m;
long long fact[100005];

int main(){
	scanf("%d %d",&n,&m);
	if(n>m+1||m>n+1){
	    printf("0\n");
	    return 0;
    }
    fact[0]=1;
    for(int i=1;i<=100000;i++)fact[i]=i*fact[i-1]%mod;
    int res=int(fact[n]*fact[m]%mod);
    if(n==m)res=(res*2)%mod;
    printf("%d\n",res);
	return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define stoi stoll
using ll=long long;
using vi=vector<int>;
using pii=pair<int,int>;
#define ALL(c) begin(c),end(c)
#define RALL(c) rbegin(c),rend(c)
#define ITR(i,b,e) for(auto i=(b);i!=(e);++i)
#define FORE(x,c) for(auto &x:c)
#define REPF(i,a,n) for(int i=a,i##len=(int)(n);i<i##len;++i)
#define REP(i,n) REPF(i,0,n)
#define REPR(i,n) for(int i=(int)(n);i>=0;--i)
#define SZ(c) ((int)c.size())
#define CONTAIN(c,x) (c.find(x)!=end(c))
#define OUTOFRANGE(y,x,h,w) ((y)<0||(x)<0||(y)>=(h)||(x)>=(w))
#define dump(...)
const signed INF_=1001001001; const long long INF=1001001001001001001LL;
const int DX[9]={0,1,0,-1,1,1,-1,-1,0},DY[9]={-1,0,1,0,-1,1,1,-1,0};
template<class T> ostream& operator<<(ostream &os,const vector<T> &v) {
    ITR(i,begin(v),end(v))os<<*i<<(i==end(v)-1?"":" ");return os;}
template<class T> istream& operator>>(istream &is,vector<T> &v) {
    ITR(i,begin(v),end(v)) is>>*i;return is;}
template<class T,class U> istream& operator>>(istream &is, pair<T,U> &p) {
    is>>p.first>>p.second;return is;}
template<class T, class U> bool chmax(T &a,const U &b){return a<b?a=b,1:0;}
template<class T, class U> bool chmin(T &a,const U &b){return a>b?a=b,1:0;}
template<class T> using heap=priority_queue<T,vector<T>,greater<T>>;
struct{template<class T> operator T(){T x;cin>>x;return x;}} IN;
struct before_main_function {
    before_main_function() {
        cin.tie(0);ios::sync_with_stdio(false);
        cout<<setprecision(15)<<fixed;
        #define endl "\n"
    }
} before_main_function;
//------------------8<------------------------------------8<--------------------

signed main() {
    string S, T;
    cin >> S >> T;
    vector<int> s(SZ(S) + 1, 0);
    vector<int> t(SZ(T) + 1, 0);
    REPF(i, 1, SZ(S) + 1) s[i] = s[i-1] + (S[i-1] == 'A' ? 1 : 2);
    REPF(i, 1, SZ(T) + 1) t[i] = t[i-1] + (T[i-1] == 'A' ? 1 : 2);
    int q;
    cin >> q;
    while (q--) {
        int a, b, c, d;
        cin >> a >> b >> c >> d;
        if ((s[b] - s[a-1]) % 3 == (t[d] - t[c-1]) % 3) {
            cout << "YES" << endl;
        } else {
            cout << "NO" << endl;
        }
    }
    return 0;
}



Measured memory_bytes: 2512
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
      	int n = sc.nextInt();
        String line = sc.nextLine();
      
      	int ac = 0;
        int wa = 0;
        int tle = 0;
        int re = 0;
      
      	for(int i = 0; i < n; i++) {
          String str = sc.nextLine();
          if(str.equals("AC")){
            ac++; 
          }else if(str.equals("WA")){
            wa++;
          }else if(str.equals("TLE")){
            tle++; 
          }else if(str.equals("RE")){
            re++; 
          }
        }
        
        // 最終出力
        System.out.println("AC x " + ac);
        System.out.println("WA x " + wa);
     	System.out.println("TLE x " + tle);
      	System.out.println("RE x " + re);
	}
}

Measured memory_bytes: 60124
#include "bits/stdc++.h"
typedef long long ll;
using namespace std;

int main() {
    int n, m, x;
    cin >> n >> m >> x;
    vector<int> cost(n + 1, 0);
    for (int i = 0; i < m; ++i) {
        int a; cin >> a;
        cost[a] = 1;
    }
    int cost1 = 0;
    int cost2 = 0;
    for (int i = x; i <= n ; ++i) cost1 += cost[i];
    for (int i = x; 0 <= i ; --i) cost2 += cost[i];

    int ans = min(cost1, cost2);
    cout << ans;

    return 0;
}


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

int main()
{
	int N;
	cin >> N;
	int a[110];
	for (int i = 0; i < N; i++) {
		cin >> a[i];
	}
	sort(a, a + N, greater<int>());
	int A = 0, B = 0;

	for (int i = 0; i < N; i++) {
		if (i % 2 == 0) {
			A += a[i];
		} else {
			B += a[i];
		}
	}
	cout << A - B << endl;
    return 0;
}

Measured memory_bytes: 256
N = int(input())
ac = 0
wa = 0
tle = 0
re = 0
for n in range(0,N):
  S = input()
  if S == 'AC':
    ac = ac + 1
  elif S == 'WA':
    wa = wa + 1
  elif S == 'TLE':
    tle = tle + 1
  elif S == 'RE':
    re = re + 1
print('AC x '+str(ac))
print('WA x '+str(wa))
print('TLE x '+str(tle))
print('RE x '+str(re))

Measured memory_bytes: 9124
import java.util.Arrays;
import java.util.Scanner;

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

        int n = sc.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }

        Arrays.sort(a);
        
        int alice = 0;
        int bob = 0;
        int cnt = n-1;
        while (cnt >= 0) {
            alice += a[cnt--];
            if (cnt >= 0)
                bob += a[cnt--];
        }
        
        System.out.println(alice - bob);
    }
}


Measured memory_bytes: 23124
#include <bits/stdc++.h>
using namespace std ;
#define An setprecision(16) 
int main(){
    int List[50][50];
    int N;
    cin >> N;
    int v[N];
    for(int i=0;i<N;i++)cin >> v[i];
    sort(v,v+N);
    double ans=v[0];
    for(int i=1;i<N;i++){
        ans =(ans+v[i])/2;
    }
    cout << An << ans << endl;
}

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

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

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

    vector<int> v(n);
    vector<int> wei(n);
    vector<vector<int>> dp(102, vector<int> (10002));

    REP(i, n) {
        cin >> v[i] >> wei[i];
    }

    REP(i, n) {
        REP(j, w+1) {

            if (wei[i] <= j) {
                dp[i+1][j] = max(dp[i][j], dp[i+1][j-wei[i]]+v[i]);
            } 

            else {
                dp[i+1][j] = dp[i][j]; 
            }
        }
    }

    cout << dp[n][w] << endl;
}


Measured memory_bytes: 6864
#include <bits/stdc++.h>
#include <stdlib.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
const ll mod=1000000007;
const ll INF=1e15;
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
#define pb push_back
#define mp make_pair
typedef pair<ll,ll> P;
vec dx={1,0,-1,0};
vec dy={0,1,0,-1};

ll V,E;
const ll MaxV=10001;
vec G[MaxV],rG[MaxV];
vec vs;
bool used[MaxV], rused[MaxV];
ll cmp[MaxV];

void dfs(ll v){
    used[v]=true;
    rep(i,G[v].size()){
        ll a=G[v].at(i);
        if(!used[a]) dfs(a);
    }
    vs.pb(v);
    return;
}

void rdfs(ll v, ll k){
    used[v]=true;
    cmp[v]=k;
    rep(i,rG[v].size()){
        ll a=rG[v].at(i);
        if(!used[a]) rdfs(a,k);
    }
    return;
}

void scc(){
    rep(i,MaxV) used[i]=false;
    rep(i,V) if(!used[i]) dfs(i);
    ll k=1;
    rep(i,MaxV) used[i]=false;
    for(ll i=vs.size()-1;i>=0;i--){
        if(!used[vs.at(i)]) {
            rdfs(vs.at(i),k);
            k++;
        }
    }
    return;
}

int main(){
    cin>>V>>E;
    rep(i,E){
        ll s,t; cin>>s>>t;
        G[s].pb(t); 
        rG[t].pb(s);
    }
    scc();
    
    ll Q; cin>>Q;
    vec ans;
    rep(i,Q){
        ll s,t; cin>>s>>t;
        if(cmp[s]==cmp[t]) ans.pb(1);
        else ans.pb(0);
    }
    
    //for(ll i=vs.size()-1;i>=0;i--) cout<<vs.at(i)<<' ';
    //cout<<endl;
    //rep(i,V) cout<<i<<'*'<<cmp[i]<<endl;
    rep(i,Q) cout<<ans.at(i)<<endl;



}


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

int main() {
	int l, n; cin >> l >> n;
	int s = 0;
	rep(i, n) {
		int x, w; cin >> x >> w;
		s += x*w;
	}
	if (!s)puts("0");
	else printf("1\n%d %d\n", -s / abs(s), abs(s));
}

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

using namespace std;
 
int cmp(int a, int b) { return b < a;}
int no_unneccessary(int n, int k, vector<int> nums);

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

	vector<int> nums;
	int tmp;
	for(int i=0; i<n; i++) {
		cin >> tmp;
		nums.push_back(tmp);
	}
	cout << no_unneccessary(n, k, nums) << endl;
	return 0;
}

int no_unneccessary(int n, int k, vector<int> nums)
{
	int idx = 0;
	sort(nums.begin(), nums.end(), cmp);

	for(int i=0; i<n; i++) {
		int sum = 0;
		for(int j=i; j<n; j++) {
			sum += nums[j];
			if(sum >= k) {
				idx = max(idx, j+1);
				sum -= nums[j];
			}
		}
	}
	return n-idx;
}

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

using namespace std;

void hoge(int n, int &k,int d){
    for (int i = 3; i <= n-d; ++i) {
        if(k==0)break;
        --k;
        cout<<i<<" "<<i+d<<endl;
    }
}

int main(){
    int n,k;
    cin>>n>>k;
    if(n==2){
        if(k==0){
            cout<<1<<endl;
            cout<<1<<" "<<2<<endl;
        }
        else {
            cout<<-1<<endl;
        }
        return 0;
    }
    if(k>((n-2)*(n-1)/2)){
        cout<<-1<<endl;
        return 0;
    }
    k=((n-2)*(n-1)/2)-k;
    cout<<n-1+k<<endl;
    cout<<1<<" "<<2<<endl;
    for (int i = 3; i <= n; ++i) {
        cout<<2<<" "<<i<<endl;
    }
    for (int i = 3; i <= n; ++i) {
        if(k==0)break;
        --k;
        cout<<1<<" "<<i<<endl;
    }
    int d=1;
    while(k>0){
        hoge(n,k,d);
        ++d;
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
namespace io{
    const int l=1<<20;
    char buf[l],*s,*t,c;
    inline void gc(){
        if(s==t){
            t=(s=buf)+fread(buf,1,l,stdin);
            c=s==t?EOF:*s++;
        }else c=*s++;
    }
    template<class IT>inline void gi(IT &x){
        x=0;gc();while(c<'0'||c>'9')gc();
        while('0'<=c&&c<='9'){x=(x<<1)+(x<<3)+(c^48);gc();}
    }
    char buf0[20];int a;
    template<class IT>inline void pi(IT x){
        if(x<0){putchar('-');x=-x;}
        do buf0[++a]=x%10+48;while(x/=10);
        while(a)putchar(buf0[a--]);
        putchar('\n');
    }
};
using io::gi;
using io::pi;
typedef unsigned int ui;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<int,ll > pil;
typedef pair<ll ,int> pli;
typedef pair<ll ,ll > pll;
typedef vector<int> vi;
typedef vector<ll > vl;
#define pque priority_queue
#define rep(i,l,r) for(i=(l);i<=(r);++i)
#define per(i,l,r) for(i=(l);i>=(r);--i)
#define REP(i,l,r) for(i=(l);i< (r);++i)
#define PER(i,l,r) for(i=(l);i> (r);--i)
#define mp make_pair
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define fi first
#define se second
template<class IT>inline void cmax(IT &a,IT b){if(a<b)a=b;}
template<class IT>inline void cmin(IT &a,IT b){if(b<a)a=b;}
const int N=505;
int a[N][N],f[N][N];
short l[N][N],r[N][N];
char c[N];
int main(){
    //freopen("a.in","r",stdin);
    //freopen("a.out","w",stdout);
    int n,i,j,k,t;short m;ll ans=0ll;
    scanf("%d",&n);
    rep(i,1,n){
		scanf("%s",c+1);
		rep(j,1,n)a[i][j]=((c[j]=='#')?0:(c[j]^48));
	}
	per(i,n,1)per(j,n,1){
		if(a[i][j]){
			if(a[i+1][j]){
				if(a[i][j+1]){
					l[j][i]=j;r[j][i]=r[j+1][i];
					t=f[i][j+1]+f[i+1][j];m=0;
					rep(k,i+1,n){
						if(r[j][k]>=l[j+1][k]&&l[j+1][k]>m)t-=f[k][l[j+1][k]];
						cmax(m,r[j][k]);
						cmin(l[j][k],l[j+1][k]);
						cmax(r[j][k],r[j+1][k]);
					}
					f[i][j]=t;
				}else{
					l[j][i]=r[j][i]=j;
					f[i][j]=f[i+1][j];
				}
			}else{
				if(a[i][j+1]){
					memcpy(l[j]+i,l[j+1]+i,(n-i+1)<<1);
					memcpy(r[j]+i,r[j+1]+i,(n-i+1)<<1);
					l[j][i]=j;
					f[i][j]=f[i][j+1];
				}else l[j][i]=r[j][i]=j;
			}
			ans+=a[i][j]*f[i][j];
			f[i][j]+=a[i][j];
		}else{
			memset(l[j]+i,0x3f,(n-i+1)<<1);
			memset(r[j]+i,0   ,(n-i+1)<<1);
		}
		//printf("(%d,%d) f=%d\n",i,j,f[i][j]);
		//rep(k,i,n)printf("(%d,[%d,%d])\n",k,l[j][k],r[j][k]);
	}
	printf("%lld",ans);
    return 0;
}

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

using namespace std;

#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define REV(i,n) for(ll (i) = (n) - 1;(i) >= 0;--i)
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {REP(WW,n)cerr << v[WW] << ' ';cerr << endl << endl;}
#define SHOW2d(v,WW,HH) {REP(W_,WW){REP(H_,HH)cerr << v[W_][H_] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 998244353

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

int mp[11][11];

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

	ll n;cin >> n;
	for(int i = 1;i <= n;i++){
		int a = i % 10, b = i;
		while(b >= 10)b /= 10;
		mp[a][b]++;
	}

	ll ans = 0;
	REP(i, 11){
		REP(j, 11){
			ans += mp[i][j] * mp[j][i];
		}
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int read(){
	int x = 0,f = 0;char ch = getchar();
	while(!isdigit(ch)) {if(ch=='-')f=1;ch=getchar();}
	while(isdigit(ch)) {x=x*10+ch-'0';ch=getchar();}
	return f?-x:x;
}
const int N = 2e5+100;
vector<int> G[N]; 
int n,m,ans=1,fa[N],si[N];
int find(int x) 
{
	return fa[x] == x?x:fa[x] = find(fa[x]);
}
int main()
{
	n = read();m = read();
	for(int i = 1;i <= n;i++) fa[i] = i,si[i] = 1;
	for(int i = 1;i <= m;i++) {
		int a = read(),b = read();
		a=find(a);b=find(b);
		if(a==b) continue;
		fa[a] = b;si[b]+=si[a];
		ans=max(si[b],ans);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 9884
//By Bibi
///                 .-~~~~~~~~~-._       _.-~~~~~~~~~-.
///             __.'              ~.   .~              `.__
///           .'//                  \./                  \`.
///        .'//                     |                     \`.
///       .'// .-~"""""""~~~~-._     |     _,-~~~~"""""""~-. \`.
///     .'//.-"                 `-.  |  .-'                 "-.\`.
///   .'//______.============-..   \ | /   ..-============.______\`.
/// .'______________________________\|/______________________________`.
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<=b;++i)
#define dep(i,a,b) for(int i=a;i>=b;--i)
using namespace std;
const int MAXN=1010;
typedef long long ll;
int read(){
	int sum=0,flag=1;
	char c;
	for(;c<'0'||c>'9';c=getchar())if(c=='-') flag=-1;
	for(;c>='0'&&c<='9';c=getchar())sum=(sum<<1)+(sum<<3)+c-'0';
	return sum*flag;
}
int n;
struct point{
	int x,y,h;
}a[MAXN];
int X,Y,H;
int id;
bool mmp(point a,point b){
	if(a.h==b.h) return a.x<=b.x;
	return a.h<b.h;
}
int main(){
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	n=read();
	bool flag=0;
	rep(i,1,n) a[i].x=read(),a[i].y=read(),a[i].h=read();
	rep(i,1,n) if(a[i].h) id=i;
	rep(i,0,200){
		rep(j,0,200){
			X=i;Y=j;
			H=a[id].h+abs(a[id].x-i)+abs(a[id].y-j);
			int sum=0;
			rep(k,1,n) if(max(H-abs(a[k].x-i)-abs(a[k].y-j),0)==a[k].h) ++sum;
			if(sum==n){
				printf("%d %d %d\n",X,Y,H );
				return 0;
			}
 		}
	}
	return 0;
}

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

using std::cin;
using std::cout;
using std::cerr;
using std::endl;

namespace chrono = std::chrono;
using namespace std::literals;

[[gnu::constructor]]
void fast_iostream() {
    std::ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    cerr.tie(nullptr);
}

struct rec {
    int s, t, c;
};

std::istream& operator>>(std::istream& is, rec& r) {
    return is >> r.s >> r.t >> r.c;
}

int main() {
    int n, m;
    cin >> n >> m;
    std::vector<std::pair<int, int>> ev;
    for (int i = 0; i < n; ++i) {
        int s, t, c;
        cin >> s >> t >> c;
        ev.emplace_back(s, c);
        ev.emplace_back(t, -c);
    }
    std::sort(ev.begin(), ev.end(), [](std::pair<int, int> u, std::pair<int, int> v) {
        if (u.first == v.first) {
            return u.second > v.second;
        }
        return u.first < v.first;
    });
    std::vector<int> cs(m, 0);
    auto e = ev.begin();

    int ans = 0;

    for (int i = 1; i <= 100000; ++i) {
        std::set<int> cc;
        for (; e < ev.end() && e->first == i && e->second > 0; ++e) {
            int c = std::abs(e->second) - 1;
            cs[c] = 1;
            cc.insert(c);
        }
        ans = std::max(ans, std::accumulate(cs.begin(), cs.end(), 0));
        for (; e < ev.end() && e->first == i && e->second < 0; ++e) {
            int c = std::abs(e->second) - 1;
            cs[c] = 0;
        }
        for (int c: cc) {
            cs[c] = 1;
        }
    }

    cout << ans << endl;
}


Measured memory_bytes: 2420
#include <iostream>
using namespace std;
int p[9];
int q[9];
int l[9];
int main(){
    int n, a = 0, b = 0, m;
    cin >> n;
    for (int i = 1; i <= n; i++) l[i] = 0;
    for (int i = 1; i <= n; i++){
        cin >> m;
        for (int j = m + 1; j <= n; j++) l[j]++;
        p[i] = m - l[m] - 1;
    }
    for (int i = 1; i < n; i++){
        a += p[i];
        a *= (n-i);
    }
    for (int i = 1; i <= n; i++) l[i] = 0;
    for (int i = 1; i <= n; i++){
        cin >> m;
        for (int j = m + 1; j <= n; j++) l[j]++;
        q[i] = m - l[m] - 1;
    }
    for (int i = 1; i < n; i++){
        b += q[i];
        b *= (n-i);
    }
    cout << abs(a-b) << '\n';





}


Measured memory_bytes: 256
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("O3")
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define EPS (1e-9)
#define INF (1e17)
#define PI (acos(-1))
//const double PI = acos(-1);
//const double EPS = 1e-15;
//long long INF=(long long)1E17;
#define i_7 (long long)(1e9+7)
//#define i_7 998'244'353
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
long long po(long a, long b){
    if(b==0){
        return 1;
    }
    
    long long z = po(a,b/2);
    z = mod(z*z);
    if(b%2!=0){
        z = mod(a*z);
    }
    return z;
}

bool prime_(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=std::sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}

long long gcd_(long long a, long long b){
  if(a<b){
    std::swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd_(b,a%b);
  }
}
 
long long lcm_(long long x, long long y){
  return (x/gcd_(x,y))*y;
}

//using namespace std;
//using namespace boost::multiprecision;
//using namespace __gnu_pbds;

int main(){
  using namespace std;
  string s;
  cin>>s;
  int k;
  cin>>k;
  int t = s[0] - '0';
  int n = s.size();
  int ans = 0;
  if(k == 1){
    ans = 9 * (n - 1) + t;
    cout<<ans<<endl;
    return 0;
  }
  if(k == 2){
    int index = -1;
    int t2;
    REP(i, n){
      if(i == 0)continue;
      if(s[i] == '0')continue;
      index = i;
      t2 = s[i] - '0';
      break;
    }
    ans = ((n - 1) * (n - 2) / 2) * 9 * 9 + (t - 1) * (n - 1) * 9;
    if(index == -1){
      cout<<ans<<endl;
      return 0;
    }
    ans += t2 + 9 * (n - (index + 1));
    cout<<ans<<endl;
    return 0;
  }
  if(k == 3){
    ans = (((n - 1) * (n - 2) * (n - 3)) / 6) * 9 * 9 * 9 + (t - 1) * ((n - 1) * (n - 2) / 2) * 9 * 9;
    int index = -1;
    int t2;
    REP(i, n){
      if(i == 0)continue;
      if(s[i] == '0')continue;
      index = i;
      t2 = s[i] - '0';
      break;
    }
    if(index == -1){
      cout<<ans<<endl;
      return 0;
    }
    int cnt = n - (index + 1);
    ans += (t2 - 1) * (n - (index + 1)) * 9 + (cnt * (cnt - 1) / 2) * 9 * 9;
    int index2 = -1;
    int t3;
    for(int i = index + 1; i < n; i++){
      if(s[i] == '0')continue;
      index2 = i;
      t3 = s[i] - '0';
      break;
    }
    if(index2 == -1){
      cout<<ans<<endl;
      return 0;
    }
    ans += t3 + 9 * (n - (index2 + 1));
    cout<<ans<<endl;
  } 
  return 0;
}

Measured memory_bytes: 256
/*
 * a.cpp
 *
 *  Created on: 2017/08/22
 *      Author: pinebooks
 */

#include <iostream>
#include <cmath>

using namespace std;

int main(void) {
  int x, a, b;
  cin >> x >> a >> b;
  if (abs(x - a) < abs(x - b))
    cout << "A" << endl;
  else
    cout << "B" << endl;
  return 0;
}



Measured memory_bytes: 256
require 'pp'

n = gets.chomp!.to_i

l_2 = 2
l_1 = 1
if n == 0
    puts l_2
elsif n == 1
    puts l_1
else
    2.upto(n) do |i|
        l = l_1 + l_2
        l_2 = l_1
        l_1 = l
    end

    puts l_1
end


Measured memory_bytes: 2300
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T> V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> > Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T> mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }

/*
 <url:http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=2756>
 問題文============================================================
 =================================================================
 解説=============================================================
 
 ================================================================
 */

vector<int> solve(){
    vector<int> res;
    int H,W; cin >> H >> W;
    vector<vector<int>> D(H,vector<int>(W));
    for(auto& vec:D) for(auto& in:vec) cin >> in;
    vector<vector<int>> couho(H,vector<int>(W,0));
    for(int i = 0; i < H; i++){
        for(int j = 0; j < W;j++){
            if(D[i][j] == 0) continue;
            if(D[i][j] != 0){
                int cost = D[i][j];
                for(int k = 0; k < 3;k++){
                    for(int l = 0; l < 3;l++){
                        D[i+k][j+l] -= cost;
                    }
                }
                couho[i+1][j+1]++;
            }
        }
    }
    vector<pii> loc;
    for(int i = 0; i < H;i++){
        for(int j = 0; j < W;j++){
            if(couho[i][j]){
                int cnt = 0;
                for(int k = -1; k <= 1; k++){
                    for(int l = -1; l <= 1; l++){
                        if(couho[i+k][j+l]) cnt++;
                    }
                }
                if(cnt <= 2){
                    loc.push_back({i,j});
                }
            }
        }
    }
    sort(loc.rbegin(),loc.rend());
    res = vector<int>{loc.begin()->first,loc.begin()->second,loc.rbegin()->first,loc.rbegin()->second};
    return res;
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    cout << solve() << endl;
    return 0;
}



Measured memory_bytes: 4984