akhauriyash/Code-Regression huggingface dataset:
S = input()
N = len(S)
ans = N * (N - 1) // 2 + 1
a = []
cnt = 0
for c in [chr(i) for i in range(97, 97+26)]:
    cnt = S.count(c)
    a.append(cnt * (cnt - 1) // 2)
ans -= sum(a)
print(ans)

Measured memory_bytes: 3500
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int a = scanner.nextInt();
        String s = scanner.next();

        if(a >= 3200) {
            System.out.println(s);
        } else {
            System.out.println("red");
        }
    }
}



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

typedef struct tm_{
	char name[32];
	int s;
	bool operator<(const struct tm_ &r) {
		return s > r.s;
	}
}TM;
TM t[11];

int main(){
	bool st = true;
	int w,l,d;
	int n;
	while(scanf("%d",&n),n != 0){
		if(!st){
			printf("\n");
		}
		st = false;

		for(int i = 0; i < n; i++){
			scanf("%s%d%d%d",t[i].name,&w,&l,&d);
			t[i].s = w*3+d*1;
		}
		sort(t,t+n);
		for(int i = 0; i < n; i++){
			printf("%s,%d\n",t[i].name,t[i].s);
		}
	}
	return 0;
}



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

int main() {
  int n;
  cin >> n;
  vector<int> b(n);
  rep(i, n) cin >> b[i];

  vector<int> order(n, -1);
  set<int> st;
  rep(i, n) {
    for (int j = n-1; j >= 0; --j) {
      if (st.find(j) != st.end()) continue;
      int cl = 0;
      for (auto itr = st.begin(); itr != st.end(); ++itr) {
        if (*itr < j) ++cl;
      }
      if (cl == b[j] - 1) {
        order[i] = b[j];
        st.insert(j);
      }
      if (order[i] != -1) break;
    }
    if (order[i] == -1) {
      cout << -1 << endl;
      return 0;
    }
  }
  rep(i, n) cout << order[i] << endl;
  return 0;
}

Measured memory_bytes: 3612
x1, y1, x2, y2 = map(int, input().split())
a, b = x1 - x2, y1 - y2
x3, y3 = x2 + b, y2 - a
x4, y4 = x1 + b, y1 - a
print(x3, y3, x4, y4, sep=' ')

Measured memory_bytes: 9104
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops") 
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
#define int long long
#define fr(i,a,b) for(int i = a ; i <= b ; ++i)
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) begin(x), end(x)
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()
#define pb push_back
#define fst first
#define snd second
using namespace __gnu_pbds;
using ordered_set =
 tree<int, null_type,less<int>,
 rb_tree_tag,tree_order_statistics_node_update>;
//find_by_order(k):returns iterator to kth element starting from 0
//order_of_key(k):returns count of elements strictly smaller than k
typedef long long ll;typedef pair<int, int> pii;
typedef vector<int> vi;typedef long double ld;
template<class T>
using min_heap = priority_queue<T,vector<T>,greater<T>>; 
template<typename T> T gcd(T a, T b){return(b?__gcd(a,b):a);}
template<typename T> T lcm(T a, T b){return(a*(b/gcd(a,b)));}
template<typename T> 
void remdup(vector<T>& v) {
	sort(all(v)); v.erase(unique(all(v)), v.end());
}
template<typename T> void re(vector<T> &v) {trav(i,v) cin >> i;}
void unsyncIO() { ios_base::sync_with_stdio(0); cin.tie(0); }
#ifdef np
#include "C:\Users\navodit\Desktop\mycodes\pr.h"
#else
#define trace(...)
#endif

#define MOD 1000000007  





void solve(){
int n; 
string s ;
cin >> n >> s; 
for (auto&& e : s) {
    int i = e - 'A';
    i += n;
    i %= 26;
    e = 'A' + i;
  }
cout << s << endl;
}
signed main() {
	unsyncIO();
	int tt =1 ;
	// cin >> tt;
	rep(i,0,tt) solve();













#ifdef np
	cout <<endl<<endl<< "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}


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


void solve(long long a, long long b, long long c){
	int num=0;
	if(a==b){
		num++;
	}
	if(b==c){
		num++;
	}
	if(c==a){
		num++;
	}
	if((a==b)&&(b==c)){
		num--;
	}
	cout << 3-num << endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long a;
    scanf("%lld",&a);
    long long b;
    scanf("%lld",&b);
    long long c;
    scanf("%lld",&c);
    solve(a, b, c);
    return 0;
}


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

using namespace std;

int N,M;
vector<long long> w;
vector<pair<long long,long long>> v;

int main(){
    int b,c;
    cin >> N >> M;
    for(int i=0;i<N;i++){
        cin >> b;
        w.push_back(b);
    }
    for(int i=0;i<M;i++){
        cin >> b >> c;
        v.push_back(make_pair(c,b));
    }
    sort(w.begin(),w.end(),greater<long long>());
    sort(v.begin(),v.end(),greater<pair<long long,long long>>());
    int wp=0,vp=0,count=0;
    long long sum = 0;
    while(count < N){
        if(w[vp] > v[wp].first){
            sum += w[vp++];
            count++;
            continue;
        }
        if(v[wp].second + count >= N){
            sum += v[wp].first * (N-count);
            break;
        }
        sum += v[wp].first * v[wp].second;
        count += v[wp++].second;
    }
    cout << sum << endl;
    return 0;
}

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

const int MAX_V = 1e5+1;
const ll INF = 1e18;

struct Edge {
    int to;
    ll cost;
    Edge(int to, ll cost):to(to), cost(cost) {}
};

struct Data {
    int v;
    ll x;
    Data(int v, ll x):v(v), x(x){}
    bool operator<(const Data& a) const {
        return x > a.x;
    }
};

vector<Edge> G[MAX_V];
ll dist[MAX_V];

int main() {
    int n,m,r;
    cin >> n >> m >> r;
    rep(i,m) {
        int s,t;
        ll d;
        cin >> s >> t >> d;
        G[s].emplace_back(t,d);
    }
    rep(i,n) dist[i] = INF;
    priority_queue<Data> que;
    auto push = [&] (int v, ll x) {
        if(dist[v] <= x) return;
        dist[v] = x;
        que.emplace(v,x);
    };
    push(r,0);

    while(que.size()) {
        Data hoge = que.top(); que.pop();
        int v = hoge.v;
        ll x = hoge.x;
        if(dist[v] < x) continue;
        for(auto e : G[v]) push(e.to, x + e.cost);
    }

    rep(i,n) {
        if(dist[i] != INF) cout << dist[i] << endl;
        else cout << "INF" << endl;
    }
}


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

#define debug(x) cout <<"DEBUG"<<" "<< #x << ":" << x << '\n'
#define rep(i,n) for(int_fast32_t i = 0; i < ((int_fast32_t)(n)); i++)   // 0-indexed up
#define rep1(i,n) for(int_fast32_t i = 1; i <= ((int_fast32_t)(n)); i++) // 1-indexed up
#define rrep(i,n) for(int_fast32_t i = ((int_fast32_t)(n)-1); i >= 0; i--)  // 0-indexed down
#define rrep1(i,n) for(int_fast32_t i = ((int_fast32_t)(n)); i >= 1; i--)   // 1-indexed down
#define all(x) (x).begin(),(x).end()

using namespace std;

template<typename T>
using vec = vector<T>;
using i32 = int_fast32_t;
using i64 = int_fast64_t;
using u32 = uint_fast32_t;
using u64 = uint_fast64_t;
using ll = long long;
using ld = long double;
using vi = vec<int_fast32_t>;
using vl = vec<int_fast64_t>;
using vld = vec<ld>;
using vii = vec<vi>;
using PII = pair<int_fast32_t, int_fast32_t>;

template<class T>
using maxheap = std::priority_queue<T>;
template<class T>
using minheap = std::priority_queue<T, std::vector<T>, std::greater<T>>;

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

const ld Pi = std::acos(-1.0L);
constexpr ll infll = (1LL<<62)-1;
constexpr int inf = (1<<30)-1;
const int mod = 1000000007;
// const int mod = 998244353;


/*FUNCs=================================================*/
i32 a[100100];

/*MAIN==================================================*/
signed main(){
    double START_TIME = clock();
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
//    cout << fixed << setprecision(15);

    i32 n, tmp; cin >> n;
    i64 sum = 0;
    rep(i,n) {
        cin >> tmp;
        sum += tmp;
        ++a[tmp];
    }
    i32 q, b,c; cin >> q;
    rep(i, q) {
        cin >> b >> c;
        a[c] += a[b];
        sum += (c-b) * a[b];
        a[b] = 0;
        cout << sum << '\n';
    }



//     printf("ElapsedTime: %5.3f ms\n",1000*((clock()-START_TIME)/CLOCKS_PER_SEC));
}


Measured memory_bytes: 4284
#include <iostream>
#include <string>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
using namespace std;
typedef long long  ll;
#define rep(i,s,n)for(ll i=s;i<n;i++)
#define repe(i,s,n)for(ll i=s;i<=n;i++)

static const double PI = 3.14159265358979;
static const ll MOD = 1e9 + 7;
static const ll INF = (ll)1 << 62;

int main() {
	ll a[4] = {};
	cin >> a[0] >> a[1] >> a[2] >> a[3];
	sort(a, a + 4);
	if (a[0] == 1 && a[1] == 4 && a[2] == 7 && a[3] == 9) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
    char a[4];
    scanf("%s",a);

    int count = 0;
    int n = 0;
    while(a[count]!='\0')
    {
        if(a[count]=='2')
        {
            n++;
        }
        count++;
    }
    printf("%d\n",n);
    return 0;
}

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

using ll = long long;
using ull = unsigned long long;
using ld = long double;
#define REP(NAME, NUM) for (int NAME = 0; NAME < (NUM); ++NAME)
#define BREP(NAME, NUM) for (int NAME = (NUM)-1; NAME >= 0; --NAME)
#define ALL(NAME) (NAME).begin(), (NAME).end()

#define cMOD 1000000007ULL
#define cINF ((1ll<<62)-1)
#define cINFINT ((1<<30)-1)


int main()
{
	ll n;cin>>n;
	vector<ll> a( n, 0 );
	vector<ll> b( n, 0 );
	vector<pair<ll,ll>> ab( n, {0,0} );
	REP(i,n)
	{
		cin>>a[i]>>b[i];
		ab[i].first = b[i];
		ab[i].second =i;
	}
	sort(ALL(ab));

	ll t = 0;
	bool isOK = true;
	REP(i,n)
	{
		ll idx = ab[i].second;
		if( t + a[idx] <= b[idx] )
		{
			t += a[idx];
		}
		else 
		{
			isOK = false;
			break;
		}
	}

	cout << (isOK ? "Yes" : "No")<<endl;

	return 0;
}

Measured memory_bytes: 6528
use std::io::*;
use std::str::FromStr;

fn main() {
    let l: i64 = read::<i64>();
    let mut po = 1;
    let mut n = 1;
    while po * 2 <= l {
        po *= 2;
        n += 1;
    }
    let mut ans: Vec<(i64, i64, i64)> = Vec::new();
    let mut now = 1;
    for i in 1..n {
        ans.push((i, i + 1, 0));
        ans.push((i, i + 1, now));
        now *= 2;
    }
    for i in 1..n {
        now /= 2;
        let j = n - i;
        if l > po + now - 1 && po > now {
            ans.push((j, n, po));
            po += now;
        }
    }
    println!("{} {}", n, ans.len());
    for i in &ans {
        println!("{} {} {}", i.0, i.1, i.2);
    }
}

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}


Measured memory_bytes: 4352
#include<stdio.h>
int main(void){
    int a,b,c;
    scanf("%d",&a);
    scanf("%d",&b);
    c = a+b;
    c %= 2;
    if(c == 0){
        c = (a+b)/2;
        printf("%d",c);
    }else{
        printf("IMPOSSIBLE");
    }
    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
typedef  long long ll;
ll gcd(ll x,ll y){
   if(y==0) return x;
   else return gcd(y,x%y);
}
ll lcm(ll x,ll y){
   return x/gcd(x,y)*y;
}
using namespace std;
int main(){ 
   int n,m;
   cin>>n>>m;
   vector<int> a(n);
   rep(i,n){
      a[i]=0;
   }
   rep(i,m){
      int b,c;
      cin>>b>>c;
      a[b-1]++;
      a[c-1]++;
   }
   rep(i,n){
      cout<<a[i]<<endl;

   }

return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(){
  long int a,b,c,num;
  scanf("%ld %ld %ld",&a, &b, &c);
  if(a+b>c){
    printf("No");
    return 0;
  }
  num=a*a+b*b+c*c-2*(a*b+b*c+c*a);
  if(num>0){
    printf("Yes");
    return 0;
  }
  else{
    printf("No");
    return 0;
  }
  return 0;
}

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

int main() {
  int l,r,d,x = 0;
  cin >> l >> r >> d;
  for(int i = l; i <= r; i++){
    if(i %d == 0) x += 1;
  }
  cout << x << endl;
  return 0;
}

Measured memory_bytes: 3628
#include<iostream>
#include<map>
#include<string>
#include<vector>
#include<algorithm>
#include<numeric>
#include<cmath>
#include<queue>
using namespace std;
long long int inf = 10000000000;

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

int main(){
  long long int n, m;
  cin >> n >> m;

  vector< vector<long long int> > dist(n, vector<long long int>(n, inf));

  for(int i=0; i<m; i++){
    int s, t, d;
    cin >> s >> t >> d;
    dist[s][t] = d;
  }
  for(int i=0; i<n; i++) dist[i][i] = 0;

  for(int i=0; i<n; i++){
    for(int j=0; j<n; j++){
      if( dist[j][i] == inf ) continue;
      for(int k=0; k<n; k++){
        if( dist[i][k] == inf ) continue;
        if( dist[j][k] > dist[j][i] + dist[i][k] ) dist[j][k] = dist[j][i] + dist[i][k];
      }
    }
  }

  for(int i=0; i<n; i++){
    if( dist[i][i] < 0 ){
      cout << "NEGATIVE CYCLE" << endl;
      return 0;
    }
  }

  for(int i=0; i<n; i++){
    for(int j=0; j<n; j++){
      if( dist[i][j] == inf ) cout << "INF";
      else cout << dist[i][j];
      if( j == n-1 ) cout << endl;
      else cout << " ";
    }
  }

  return 0;
}





// EOF

Measured memory_bytes: 3224
N = int(input())
c0 = 0
c1 = 0
c2 = 0
c3 = 0

for i in range(N):
    s = input()
    if s == "AC":
        c0 += 1
    elif s == "WA":
        c1 += 1
    elif s == "TLE":
        c2 += 1
    elif s == "RE":
        c3 += 1

print("AC x "+str(c0))
print("WA x "+str(c1))
print("TLE x "+str(c2))
print("RE x "+str(c3))

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

int main() {
    int n;
    cin >> n;
    P p[n];
    rep(i, n) cin >> p[i].second >> p[i].first;
    sort(p, p + n);

    int t = 0;
    rep(i, n) {
        t += p[i].second;
        if (t > p[i].first) {
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 5188
#include <bits/stdc++.h>
using namespace std;
 
int main() {
	int N;
    cin >> N;
    if (N%10 == 3){
    	cout << "bon" << endl;
    }else if (N%10 == 0){ 
    	cout << "pon" << endl;
    }else if (N%10 == 1){ 
    	cout << "pon" << endl;
    }else if (N%10 == 6){ 
    	cout << "pon" << endl;
    }else if (N%10 == 8){ 
    	cout << "pon" << endl;
    }else{
    	cout << "hon" << endl;
    }
}

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

using namespace std;

int main(void) {
	int n;
	cin >> n;
	string taro,hana;
	int sot = 0;
	int soh = 0;
	for (int i = 0; i < n; ++i) {
		cin >> taro >> hana;
		if (taro > hana) {
			sot += 3;
		}
		else if (taro < hana) {
			soh += 3;
		}
		else {
			sot += 1;
			soh += 1;
		}
	}
	cout << sot << " ";
	cout << soh << endl;
	return 0;
}



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

int main(){
  int n, v[100], c[100], ans=0;
  cin >> n;
  for(int i=0;i<n;i++)cin >> v[i];
  for(int i=0;i<n;i++)cin >> c[i];
  for(int i=0;i<n;i++)if(v[i]>c[i])ans+=v[i]-c[i];
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
n, m = map(int, input().split())
_1, _n = set(), set()
for _ in range(m):
    a, b = map(int, input().split())
    if a == 1:
        _1.add(b)
    elif b == n:
        _n.add(a)
print('POSSIBLE' if _1 & _n else 'IMPOSSIBLE')


Measured memory_bytes: 18936
#include <stdio.h>
int main(void){
	int seisu1,seisu2;//??\???????????????
	scanf("%d%d",&seisu1,&seisu2);//??\?????????
	if(seisu1<seisu2){
		printf("a < b\n");
	}else if(seisu1>seisu2){
		printf("a > b\n");
	}else{
		printf("a == b\n");
	}
	return 0;
}

Measured memory_bytes: 580
#include <stdio.h>

 int main(void){
     int a,b,x;
     char op;
     
     while(scanf("%d %c %d ",&a,&op,&b) !=EOF){
         if(op =='+'){
         x =a+b;
         
         printf("%d\n",x);}
         
         else if(op == '-'){
         x =a-b;
         
         printf("%d\n",x);}
         
         else if(op == '*'){
         x =a*b;
         
         printf("%d\n",x);}
         
          else if(op == '/'){
         x=a/b;
         
         printf("%d\n",x);}
         
         else if(op == '?'){
         
         break;}
     }// Your code here!
     return(0);
 }


Measured memory_bytes: 2100
#include<iostream>
#include<cstring>
using namespace std;
int main(){
	int n;
	string s;
	cin>>n>>s;
	for(int i=0;i<s.length();i++){
		int h=(int)(s[i]-'A');
		h+=n;
		h%=26;
		cout<<(char)(h+(int)'A');
	} 
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  long long N,H;
  cin>>N>>H;
  long long a,b;
  vector<long long> va,vb;
  for (long long i=0;i<N;i++){
    cin>>a>>b;
    va.push_back(a);
    vb.push_back(b);
  }
  sort(va.begin(),va.end());
  sort(vb.begin(),vb.end());
  long long ans=0;
  for (long long i=0;i<N+1;i++){
    //b=vb.pop_back();
    if (vb.size()!=0){
      b=vb.back();
      vb.pop_back();
    }
    else{
      b=0;
    }
    //if (vb.size()!=0 && (b=vb.pop_back())>=va.back()){
    if (b>=va.back()){
      H-=b;
      ans++;
      if (H<=0){
        cout<<ans<<endl;
        break;
      }
    }
    else{
      ans+=(H+va.back()-1)/va.back();
      cout<<ans<<endl;
      break;
    }
  }


}


Measured memory_bytes: 2036
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func readInt() int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return i
}

func readString() string {
	sc.Scan()
	return sc.Text()
}

func readInt64() int64 {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return int64(i)
}

func readfloat64() float64 {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return float64(i)
}

func abs(a int) int {
	if a < 0 {
		return a * -1
	}
	return a
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func gcd(x, y int) int {
	if y == 0 {
		return x
	}
	return gcd(y, x%y)
}

const Mod = 1000000007

func ModComb(n, k int) int {
	if k == 0 {
		return 1
	}
	x, y := n, k
	for i := 1; i < k; i++ {
		x = x * (n - i) % Mod
		y = y * (k - i) % Mod
	}
	inv := ModInv(y)
	return x * inv % Mod
}

func ModFact(x int) int {
	fact := 1
	for i := 1; i <= x; i++ {
		fact = fact * i % Mod
	}
	return fact
}

func ModInv(x int) int {
	return ModPow(x, Mod-2)
}

func ModPow(a, n int) int {
	res := 1
	for n > 0 {
		if n%2 != 0 {
			res = res * a % Mod
		}
		a = a * a % Mod
		n /= 2
	}
	return res
}

func pow(a, n int) int {
	if n == 0 {
		return 1
	}

	ans := 0
	if n%2 == 0 {
		ans = pow(a*a, n/2)
	} else {
		ans = a * pow(a*a, (n-1)/2)
	}
	return ans
}

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), 1e6)

	s := readString()
	n := len(s)
	ans := make([]int, n)

	count := 0
	for i := 0; i < n; i++ {
		if s[i] == 'R' {
			count++
		} else {
			ans[i] += count / 2
			ans[i-1] += (count + 1) / 2
			count = 0
		}
	}
	count = 0
	for i := n - 1; i >= 0; i-- {
		if s[i] == 'L' {
			count++
		} else {
			ans[i] += count / 2
			ans[i+1] += (count + 1) / 2
			count = 0
		}
	}

	for _, v := range ans {
		fmt.Printf("%d ", v)
	}
	fmt.Println("")
}

func intSliceReverse(slice []int) []int {
	for i, j := 0, len(slice)-1; i < j; i, j = i+1, j-1 {
		slice[i], slice[j] = slice[j], slice[i]
	}
	return slice
}

func stringReverse(str string) string {
	runes := []rune(str)
	for i, j := 0, len(runes)-1; i < j; i, j = i+1, j-1 {
		runes[i], runes[j] = runes[j], runes[i]
	}
	return string(runes)
}


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

#define vi vector<int>
#define vl vector<long>
#define vvi vector<vector<int>>
#define vvl vector<vector<long>>
#define pint pair<int, int>
#define plong pair<long, long>

int main() {
    int S, W;
    cin>>S>>W;

    cout << ((S>W? "safe" : "unsafe")) << endl;
}

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

int main() {
    int n;
    cin >> n;
    vector<vector<int>> a(26, vector<int>(n, 0));

    for(int i = 0; i < n; i++) {
        string s;
        cin >> s;
        for(int j = 0; j < s.size(); j++) {
            a.at((int)s[j]-97).at(i)++;
        }
    }
    
    for(int i = 0; i < 26; i++) {
        sort(a[i].begin(),a[i].end());
        for(int j = 0; j < a.at(i).at(0); j++) {
            cout << (char)(97+i);
        }
    }
    cout << endl;
    return 0;
}

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

const int mod=1e9+7;
const int maxn=2e5+100;

int a[maxn];

int main()
{
    int n,k;
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%d",&a[i]);
    }
    sort(a,a+n);
    int tot=unique(a,a+n)-a;
    if(tot==n)
        printf("YES\n");
    else
        printf("NO\n");
    return 0;
}
/*

*/


Measured memory_bytes: 1024
import fractions
T = int(input())
for i in range(T):
  A, B, C, D = map(int, input().split())
  if (A < B):
    print('No')
  elif (B > D):
    print('No')
  elif (C >= B):
    print('Yes')
  elif (A % B > C):
    print('No')
  elif (D % B == 0):
    print('Yes')
  else:
    gcdBD = fractions.gcd(B, D)
    if (C + gcdBD >= B):
      print('Yes')
    else:
      print('No')


Measured memory_bytes: 5588
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <map>
#include <set>
#include <string>
#include <cstring>
#include <sstream>
#include <cmath>
#include <functional>
#include <fstream>
#include <cstdlib>
typedef long long ll;
const ll MOD = 1e9+7;


#define REP(i, N) for (ll i = 0; i < (N); i++)
#define REPP(i, a, b) for (ll i = (a); i < (b); i++)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define VSORT(c) sort((c).begin(),(c).end())
#define SZ(x) ((ll)(x).size())
//vvintを作る　マクロで　 #define vvint(N,M) vector<vector<ll>>

using namespace std;


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

    int n,m;
    cin >> n >> m;
    vector<pair<int,char> > sc;
    for(ll i = 0; i < m;i++){
        int ts;
        char tc;
        cin >> ts >> tc;
        sc.push_back(make_pair(ts,tc));
    }
    int start;
    if(n == 1) start = 0;
    else start = pow(10,n-1);
    int ans = -1;

    for(ll i = start; i < pow(10,n);i++){
        string tmp = std::to_string(i);
        bool fl = true;
        for(ll l = 0; l < m;l++){
            if(tmp[sc[l].first-1] != sc[l].second){
                fl = false;
                break;
            }
        }
        if(fl){
            ans = i;
            break;
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 512
n, m = map(int, input().split())
 
a_set=set()
 
for index in range(m):
    a_set.add(int(input()))
 
ans_list=[]
 
for index in range(n + 1):
    ans_list.append(0)
 
for index in range(n + 1):
    if index == 0:
        ans_list[index] += 1
        continue
    if index == 1 and (index not in a_set):
        ans_list[index] += ans_list[index - 1]
        continue
    
    if index not in a_set:
        if (index - 1) not in a_set:
            ans_list[index] += ans_list[index - 1]
            ans_list[index] %= 1000000007
        if (index - 2) not in a_set:
            ans_list[index] += ans_list[index - 2]
            ans_list[index] %= 1000000007
 
print(ans_list[n])

Measured memory_bytes: 11884
import sys
sys.setrecursionlimit(1000000)
from collections import deque

H, W = map(int, input().split())
#配列の入力
data = [list(input()) for _ in range(H)]

memo = [[-1 for _ in range(W)]for _ in range(H)]
que = deque()

for h in range(H):
    for w in range(W):
        if data[h][w] == '#':
            memo[h][w] = 0
            que.append((h, w))

offset = ((-1, 0), (1, 0), (0, -1), (0, 1))
while que:
    now_h, now_w = que.popleft()
    for nh, nw in offset:
        if now_h+nh < 0 or H-1 < now_h+nh or now_w+nw < 0 or W-1 < now_w+nw:
            continue

        if memo[now_h+nh][now_w+nw] >= 0:
            continue

        memo[now_h+nh][now_w+nw] = memo[now_h][now_w]+1
        que.append((now_h+nh,now_w+nw))


ans = -1
for h in range(H):
    ans = max(ans, max(memo[h]))
print(ans)


Measured memory_bytes: 150100
def solve():
  k, x = map(int, input().split())
  if x-k+1 < -1000000:
    ans = list(range(-1000000,x))+list(range(x,x+k))
  elif x+k-1 > 1000000:
    ans = list(range(x-k+1,x))+list(range(x,1000000))
  else:
    ans = list(range(x-k+1,x))+list(range(x,x+k))
  ans = map(str, ans)
  print(" ".join(ans))
  return 0
 
if __name__ == "__main__":
  solve()


Measured memory_bytes: 3064
N,W = [int(_n) for _n in input().split()]
A = []
for i in range(N):
    w,v = [int(_n) for _n in input().split()]
    A.append((w,v))
dp = [[0]*(W+1) for _ in range(N)]

for w in range(W+1):
    dp[0][w] = 0 if w < A[0][0] else A[0][1]

for i in range(N):
    for w in range(W+1):
        dp[i][w] = dp[i-1][w]
        if w >= A[i][0]:
            dp[i][w] = max(dp[i-1][w], dp[i-1][w-A[i][0]] + A[i][1])
print(dp[N-1][W])

Measured memory_bytes: 120684
#include <cmath>
#include <iostream>
#include <vector>

#include <stdio.h>

using namespace std;

typedef long long ll;

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

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

#define MAX_N 8

class Point {
    public:
        double x;
        double y;
};

int fact(int n) {
    if (n > 1) {
        return n * fact(n - 1);
    } else {
        return 1;
    }
}

double calc(const vector<Point> &visited) {
    double acc = 0;
    for (int i = 0; i < (int) visited.size() - 1; i++) {
        acc += sqrt(pow(visited[i].x - visited[i + 1].x, 2) + pow(visited[i].y - visited[i + 1].y, 2));
    }
    return acc;
}

void solve(vector<bool> &memo, const vector<Point> &points, vector<Point> visited, const int n, double *acc) {
    if ((int) visited.size() == n) {
        *acc = *acc + calc(visited);
    }
    for (int i = 0; i < n; i++) {
        if (!memo[i]) {
            memo[i] = true;
            visited.push_back(points[i]);
            solve(memo, points, visited, n, acc);
            visited.pop_back();
            memo[i] = false;
        }
    }
}

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

    vector<Point> points(n);
    vector<bool> memo(n, false);

    for (int i = 0; i < n; i++) {
        double x, y;
        cin >> x >> y;
        points[i] = {x, y};
    }

    double acc = 0;
    solve(memo, points, vector<Point>(), n, &acc);

    printf("%10.7f\n", acc / fact(n));

    return 0;
}



Measured memory_bytes: 384
#include<stdio.h>
#define N 50
int Euclid(int a,int b){

if (a%b==0) return b;

return Euclid(b,a%b);
}


int main() {

    int a[N],b[N],temp,i,j;
    double x,y;
    i=0;
    while (scanf("%d",&a[i])!=EOF) {
    scanf("%d",&b[i]);
    i++;
    }
    for (j = 0; j < i; j++) {
        if (b[j]>a[j]) {
            temp=a[j];
            a[j]=b[j];
            b[j]=temp;
        }
    }
    for (j = 0; j < i; j++) {
    y=(double)Euclid(a[j],b[j]);
    x=(double)a[j]*((double)b[j]/y);
    printf("%d %d\n",(int)y,(int)x);
    }


    return 0;
}

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

int main() {
    string s;
    cin >> s;
    
    if (s == "SUN") {
        cout << 7 << endl;
    } else if (s == "MON") {
        cout << 6 << endl;
    } else if (s == "TUE") {
        cout << 5 << endl;
    } else if (s == "WED") {
        cout << 4 << endl;
    } else if (s == "THU") {
        cout << 3 << endl;
    } else if (s == "FRI") {
        cout << 2 << endl;
    } else if (s == "SAT") {
        cout << 1 << endl;
    }
}


Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Scanner;

//Water Clock
public class Main{

	class Tank{
		List<int[]> pos;
		double height;
		int id, edge;
		public Tank(int id) {
			this.id = id;
			height = 0;
			pos = new ArrayList<int[]>();
		}
		void add(int pi, int pj){
			pos.add(new int[]{pi, pj});
			edge = 0;
			for(int[] a:pos){
				for(int k=0;k<4;k++){
					int ni = a[0]+move[k][0];
					int nj = a[1]+move[k][1];
					if(0<=ni&&ni<h&&0<=nj&&nj<w){
						if(map[ni][nj]<map[a[0]][a[1]])edge++;
					}
					else edge++;
				}
			}
		}
		void f(double V){
			double vh = V/30/30/pos.size();
			double dh = 30-height;
			double mh = Math.min(vh, dh);
			height+=mh;
			vh-=mh;
			if(vh<EPS)return;
			double giveV = vh*30*30*pos.size()/edge;
			if(giveV<EPS)return;
			for(int[]a:pos)for(int k=0;k<4;k++){
				int ni = a[0]+move[k][0];
				int nj = a[1]+move[k][1];
				if(0<=ni&&ni<h&&0<=nj&&nj<w&&map[ni][nj]<map[a[0]][a[1]]&&tanks[ni][nj]!=0){
					ref.get(tanks[ni][nj]).f(giveV);
				}
			}
		}
	}
	
	int[][] move = {{-1,0},{0,1},{1,0},{0,-1}};
	int w, h, fi, fj, q;
	int[][] map, tanks;
	Map<Integer, Tank> ref;
	boolean[][] u;
	double EPS = 1e-8;
	
	void union(int i, int j, int id, int H){
		for(int k=0;k<4;k++){
			int ni = i+move[k][0];
			int nj = j+move[k][1];
			if(0<=ni&&ni<h&&0<=nj&&nj<w&&!u[ni][nj]&&map[ni][nj]==H){
				Tank t = ref.get(id);
				t.add(ni, nj);
				ref.put(id, t);
				u[ni][nj] = true;
				tanks[ni][nj] = id;
				union(ni, nj, id, H);
			}
		}
	}
	
	void flow(int t){
		double fq = t*q;
		ref.get(tanks[fi][fj]).f(fq);
	}
	
	void run(){
		Scanner sc = new Scanner(System.in);
		for(;;){
			w = sc.nextInt(); h = sc.nextInt();
			if((w|h)==0)break;
			fj = sc.nextInt(); fi = sc.nextInt(); q = sc.nextInt();
			map = new int[h][w];
			for(int i=0;i<h;i++)for(int j=0;j<w;j++)map[i][j] = sc.nextInt();
			ref = new HashMap<Integer, Tank>();
			tanks = new int[h][w];
			u = new boolean[h][w];
			int id = 1;
			for(int i=0;i<h;i++)for(int j=0;j<w;j++){
				if(map[i][j]==0||u[i][j])continue;
				Tank t = new Tank(id);
				t.add(i, j);
				tanks[i][j] = id;
				ref.put(id, t);
				u[i][j] = true;
				union(i, j, id, map[i][j]);
				id++;
			}
			int L = sc.nextInt();
			while(L--!=0){
				int time = sc.nextInt();
				int pj = sc.nextInt(), pi = sc.nextInt();
				for(int i:ref.keySet())ref.get(i).height = 0;
				flow(time);
				System.out.println((int)ref.get(tanks[pi][pj]).height);
			}
		}
	}
	
	public static void main(String[] args) {
		new Main().run();
	}
}

Measured memory_bytes: 12000
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <map>
#include <set>
#include <list>
#include <unordered_set>
#include <unordered_map>
#include <stdlib.h>

using namespace std;
 
typedef long long i64;
typedef pair<i64, i64> P;
static const i64 INF = 1000010000;
static const i64 MOD = 1000000007;
 
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define REP(i, n) for(int i = 0; i < (n); ++i)
#define SORT(v) sort(v.begin(), v.end());

//int dx[4] = {0,1,0,-1}, dy[4] = {-1,0,1,0};
//int dx[5] = {-1,0,0,0,1}, dy[5] = {0,-1,0,1,0};
//int dx[8] = {-1,0,1,1,1,0,-1,-1}, dy[8] = {1,1,1,0,-1,-1,-1,0};
//int dx[9] = {-1,0,1,1,1,0,-1,-1,0}, dy[9] = {1,1,1,0,-1,-1,-1,0,0};

//-----end of template-----//

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    
    int n;
    cin >> n;
    if(n == 3 || n == 5 || n == 7) cout << "YES" << endl;
    else cout << "NO" << endl;
}

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

using namespace std;

int main(){
  int n, max = -INT_MAX, min = INT_MAX, in;
  long long sum = 0;

  cin >> n;
  for(int i = 0 ; i < n ; i++){
    cin >> in;
    max = std::max(max, in);
    min = std::min(min, in);
    sum += in;
  }
  cout << min << " " << max << " " << sum << endl;

  return 0;
}

Measured memory_bytes: 1164
#define _USE_MATH_DEFINES // for C++  
#include "bits/stdc++.h"
using ULL = unsigned long long;
#define NUM 1000000007

inline int ctoi(char c) {
    if (c >= '0' && c <= '9') {
        return c - '0';
    }
    std::cout << "例外：数字ではない文字をintに変換しようとしました";
    throw;
}

using namespace std;

int main()
{
    ios::sync_with_stdio(false);

    string s;
    cin >> s;
    int a, b, c, d;
    a = ctoi(s[0]);
    b = ctoi(s[1]);
    c = ctoi(s[2]);
    d = ctoi(s[3]);
    if (a + b + c + d == 7)
    {
        cout << a << '+' << b << '+' << c << '+' << d << '=' << 7 << endl;
        return 0;
    }
    if (a + b + c - d == 7)
    {
        cout << a << '+' << b << '+' << c << '-' << d << '=' << 7 << endl;
        return 0;
    }

    if (a + b - c + d == 7)
    {
        cout << a << '+' << b << '-' << c << '+' << d << '=' << 7 << endl;
        return 0;
    }
    if (a + b - c - d == 7)
    {
        cout << a << '+' << b << '-' << c << '-' << d << '=' << 7 << endl;
        return 0;
    }

    if (a - b + c + d == 7)
    {
        cout << a << '-' << b << '+' << c << '+' << d << '=' << 7 << endl;
        return 0;
    }
    if (a - b + c - d == 7)
    {
        cout << a << '-' << b << '+' << c << '-' << d << '=' << 7 << endl;
        return 0;
    }
    if (a - b - c + d == 7)
    {
        cout << a << '-' << b << '-' << c << '+' << d << '=' << 7 << endl;
        return 0;
    }
    if (a - b - c - d == 7)
    {
        cout << a << '-' << b << '-' << c << '-' << d << '=' << 7 << endl;
        return 0;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define owo(i,a, b) for(int i=(a); i<(b); ++i)
#define uwu(i,a, b) for(int i=(a)-1; i>=(b); --i)
#define senpai push_back
#define ttgl pair<int, int>
#define ayaya cout<<"ayaya~"<<endl
 
using namespace std;
using ll = long long;
using ld = long double;
const ll MOD = 1000000007;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
ll binpow(ll a,ll b){ll res=1;while(b){if(b&1)res=(res*a)%MOD;a=(a*a)%MOD;b>>=1;}return res;}
ll modInv(ll a){return binpow(a, MOD-2);}
const double PI = acos(-1);
const int INF = 0x3f3f3f3f;
const int NINF = 0xc0c0c0c0;
const ll INFLL = 0x3f3f3f3f3f3f3f3f;
const ll NINFLL = 0xc0c0c0c0c0c0c0c0;
string T;
int zz;
int oo;
vector<ttgl> parts;
int main()
{   
    //freopen("exercise.in", "r", stdin);
    //freopen("exercise.out", "w", stdout);
    mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
    cin.tie(0)->sync_with_stdio(0);
    cin>>T;
    int n = T.size();
    owo(i, 0, n) {
        if(T[i]=='0') {
            if(!parts.empty()&&parts.back().first==0) {
                parts.back().second++;
            }else {
                parts.senpai({0, 1});  
            }
            zz++;
        }else {
            if(!parts.empty()&&parts.back().first==1) {
                parts.back().second++;
            }else {
                parts.senpai({1, 1});
            }
            oo++;
        }
    }
    ll ans = 0;
    uwu(i, oo+1, 1) {
        ans+=(i+1)/2;
    }
    int currz = 0;
    int pos = 1;
    for(auto it = parts.begin(); it!=parts.end(); ++it) {
        auto p = *it;
        if(p.first==0) {
            currz+=p.second;
            pos+=p.second;
        }else {
            ans+=(p.second/2)*zz;
            if(p.second&1) {
                ans+=(zz-currz) + (currz+(pos&1))/2;
                pos++;
            }
        }
    }
    cout<<ans<<"\n";
    return 0;
}


Measured memory_bytes: 5452
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;


int main()
{
	int n,a[105],sum,ans=1000000000;
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
	}
	for(int i=-100;i<=100;i++)
	{
		sum=0;
		for(int j=0;j<n;j++)
		{
			sum+=(i-a[j])*(i-a[j]);
		}
		ans=min(ans,sum);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
/*input
4
75 26 45 72 81 47 97 97 2 2 25 82 84 17 56 32
*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define REP(i,j,k)     for(int i = j ; i < k ; ++i)
#define RREP(i,j,k)    for(int i = j ; i >=k ; --i)
#define A    first
#define B    second
#define mp   make_pair
#define pb   emplace_back
#define PII pair<int , int>
#define MEM(i,j)   memset(i , j , sizeof i)
#define ALL(i)     i.begin() , i.end()
#define DBGG(i,j)     cout << i << " " << j << endl
#define DB4(i,j,k,l)  cout << i << " " << j << " " << k << " " << l << endl
#define IOS cin.tie(0) , cout.sync_with_stdio(0)
#define endl "\n"
///------------------------------------------------------------
#define MAX (1 << 18) + 10
#define INF 0x3f3f3f3f

int n , x[MAX] , u[MAX] , ans[MAX];
PII v[MAX];
int cmp(int a , int b){ return x[a] > x[b]; }
inline PII solve(int a , int b , int c , int d){
	int sol[] = {a , b , c , d};
	sort(sol , sol + 4 , cmp);
	REP(i , 1 , 4) if(sol[i] != sol[0]) return mp(sol[0] , sol[i]);
}
PII DFS(int now){
	if(u[now] == 1) return v[now];
	else u[now] = 1 , v[now] = mp(now , 1 << n);
	REP(i , 0 , n) if(now & (1 << i)){
		PII tmp = DFS(now ^ (1 << i));
		v[now] = solve(v[now].A , v[now].B , tmp.A , tmp.B);
	}
	return v[now];
}
int32_t main(){
	IOS;
	cin >> n;
	REP(i , 0 , (1 << n)) cin >> x[i];
	REP(i , 0 , (1 << n)) DFS(i);
	// REP(i , 0 , (1 << n)) DBGG(v[i].A , v[i].B);
	int preans = 0;
	REP(i , 1 , (1 << n)){
		preans = max(preans , x[v[i].A] + x[v[i].B]);
		cout << preans << endl;
	}
    return 0;
}

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

int main() {
  int n, m;
  cin >> n >> m;
  vector<int> a(n);
  double sum = 0;
  for(int i = 0; i < n; i++) {
    cin >> a.at(i);
    sum += a.at(i);
  }
  sort(a.begin(), a.end());
  reverse(a.begin(), a.end());
  sum /= (4 * m);
  if(a.at(m - 1) < sum) cout << "No" << endl;
  else cout << "Yes" << endl;
}

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

using namespace std;

template<class T>
void copy(vector<T> from, vector<T> to) {
  copy(from.begin(), from.end(), back_inserter(to));
}

template<class T>
void sort(vector<T> a) {
  sort(a.begin(), a.end());
}

template<class T>
void input_to(vector<T> a) {
  T a_i;
  cin >> a_i;
  a.push_back(a_i);
}

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

  cout << (char) toupper(a[0]);
  cout << (char) toupper(b[0]);
  cout << (char) toupper(c[0]);
  cout << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define all(c) begin(c),end(c)

template<typename T1, typename T2>
inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }

template<typename T1, typename T2>
inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

//改造
typedef long long int ll;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0 //デバッグする時1にしてね
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007


//ここから編集する
class Solve {
public:
    void input() {

    }

    void solve() {
        input();
        int N, W, H;
        cin >> N >> W >> H;

        vector<int> him(H + 2), wim(W + 2);

        rep(i, 0, N) {
            int x, y, w;
            cin >> x >> y >> w;

            int sw = max(x - w, 0);
            int tw = min(x + w, W + 1);

            int sh = max(y - w, 0);
            int th = min(y + w, H + 1);

            wim[sw]++;
            wim[tw]--;

            him[sh]++;
            him[th]--;

        }

//        if (him[0] == 0 || wim[0] == 0) {
//            cout << "No" << endl;
//            return;
//        }

        for (int i = 0; i < H; ++i) {
            him[i + 1] += him[i];
        }

        for (int i = 0; i < W; ++i) {
            wim[i + 1] += wim[i];
        }

        //himが全部
        bool flag = true;
        for (int i = 0; i < H; ++i) {
            if (him[i] <= 0) flag = false;
        }
        if (flag) {
            cout << "Yes" << endl;
            return;
        }
        flag = true;


        //wimが全部
        for (int i = 0; i < W; ++i) {
            if (wim[i] <= 0) flag = false;
        }

        if (flag) {
            cout << "Yes" << endl;
            return;
        }

        cout << "No" << endl;
    }
};


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

    Solve().solve();


    return 0;
}



Measured memory_bytes: 3640
#[allow(unused_macros)]
macro_rules! invec {
    ( $t:ty ) => {{
        let mut s = String::new();
        match std::io::stdin().read_line(&mut s) {
            Ok(0) => Vec::<$t>::new(),
            Ok(n) => s.trim().split_whitespace().map(|s| s.parse::<$t>().unwrap()).collect::<Vec<$t>>(),
            Err(_) => Vec::<$t>::new(),
        }
    }}
}

#[allow(unused_macros)]
macro_rules! input {
    ( $($t:ty),* ) => {{
        let mut s = String::new();
        std::io::stdin().read_line(&mut s);
        let mut splits = s.trim().split_whitespace();
        ($(
            {
                 splits.next().unwrap().parse::<$t>().unwrap()
            },
        )*)
    }}
}

#[allow(unused_must_use)]
#[allow(unused_variables)]
fn solve() {
    let (h, w) = input!(usize, usize);
    let mut map: Vec<Vec<char>> = vec![];

    for i in 0..h {
        let (s,) = input!(String);
        map.push(s.chars().collect());
    }

    let mut l = vec![vec![0; w]; h];
    for i in 0..h {
        if map[i][0] == '.' {
            l[i][0] = 1;
        }
        for j in 1..w {
            if map[i][j] == '.' {
                l[i][j] = l[i][j-1] + 1;
            } else {
                l[i][j] = 0;
            }
        }
    }

    let mut r = vec![vec![0; w]; h];
    for i in 0..h {
        if map[i][w-1] == '.' {
            r[i][w-1] = 1;
        }
        for j in (0..(w-1)).rev() {
            if map[i][j] == '.' {
                r[i][j] = r[i][j+1] + 1;
            } else {
                r[i][j] = 0;
            }
        }
    }

    let mut u = vec![vec![0; w]; h];
    for j in 0..w {
        if map[0][j] == '.' {
            u[0][j] = 1;
        }
        for i in 1..h {
            if map[i][j] == '.' {
                u[i][j] = u[i-1][j] + 1;
            } else {
                u[i][j] = 0;
            }
        }
    }

    let mut d = vec![vec![0; w]; h];
    for j in 0..w {
        if map[h-1][j] == '.' {
            d[h-1][j] = 1;
        }
        for i in (0..(h-1)).rev() {
            if map[i][j] == '.' {
                d[i][j] = d[i+1][j] + 1;
            } else {
                d[i][j] = 0;
            }
        }
    }

    let mut max = 0;
    for i in 0..h {
        for j in 0..w {
            max = std::cmp::max(max, l[i][j] + r[i][j] + u[i][j] + d[i][j] - 3);
        }
    }

    println!("{}", max);
}

fn main() {
    solve();
}


Measured memory_bytes: 86268
import java.util.*;
import java.io.*;
import java.util.Arrays; 
import java.util.ArrayList; 
import java.util.Collections; 
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.InputStream;
import java.util.StringTokenizer;
import java.math.BigInteger;

public class Main {
    



    public static void main(String[] args) {
        try (PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out))) {
            FastScanner in = new FastScanner(System.in);
            int n = in.nextInt();
            int x = in.nextInt();
            int t = in.nextInt();

            int countMin = 0;
            int madeSnacks = 0;

            while(true) {
                countMin = countMin + t;
                madeSnacks = madeSnacks + x;
                if(madeSnacks >= n) {
                    out.println(countMin);
                    break;
                }
            }




        } finally {
            //out.close();
        }
        
           
    }
}




class FastScanner {
   private final BufferedReader br;
   private StringTokenizer st;
 
    FastScanner(InputStream InputStream) {
        br = new BufferedReader(new InputStreamReader(InputStream));
    }
    
    String next() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return st.nextToken();
    }
    
    int nextInt() {
        return Integer.parseInt(next());
    }
    
    long nextLong() {
        return Long.parseLong(next());
    }
    
    double nextDouble() {
        return Double.parseDouble(next());
    }


    
    ArrayList<Integer> nextIntList(int count) {
        ArrayList<Integer> array = new ArrayList<>();
        for (int n = 0; n < count; n++) {
            int number = nextInt();
            array.add(number);
        }
        return array;
    }
    
    int[] nextIntArray(int count) {
        int[] array = new int[count];
        for (int n = 0; n < count; n++) {
            array[n] = nextInt();
        }
        return array;
    }
}


Measured memory_bytes: 32880
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _0030
{
    class Program
    {
        static void Main(string[] args)
        {
            string str="";
            while (!((str = Console.ReadLine()) == "0 0"))
            {
                int[] num = str.Split(' ').Select(int.Parse).ToArray();
                Console.WriteLine(calcCombinations(num[1], num[0],0));
            }
        }

        static int calcCombinations(int targetNum, int paramNum,int j)
        {
            if (targetNum == 0 && paramNum == 0)
            {
                return 1;
            }
            int sum = 0;
            for (int i = j; i < 10; i++)
            {
                sum += calcCombinations(targetNum - i, paramNum - 1,i+1);
            }

            return sum;
        }
       
    }
}



Measured memory_bytes: 16320
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0; i<n; i++)
#define eb(t) emplace_back(t)
typedef long long ll;
typedef long long unsigned int llu;
ll MOD = 1000000007;
ll INF = 1000000009;

ll b[65];
void t(ll x){
    ll tmp = x;
    ll count=0;
    while(count<=65){
        
        if(x%2==1) {
            b[count] = true;
        }
        else{
            b[count] = false;
        }
        x /= 2;
        count++;
    }
    
}

ll sum[65];

void solve(){

    rep(i,65){
        sum[i]=0;
    }

    ll n;
    cin >> n;
    rep(i,n){
        ll tmp;
        cin >> tmp;
        t(tmp);
        /*
        rep(i,65){
            cout << b[i];
        }
        cout << endl;
        */
        rep(j,65){
            if(b[j]==1) sum[j]++;
        }
    }
    ll ans = 0;
    ll s = 1;
    rep(i,65){
        
        ans = (ans + ((sum[i]*(n-sum[i]))%MOD*((s)%MOD))%MOD)%MOD;
        s = (s * 2)%MOD;

    }

    cout << ans << endl;

}

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


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

int main(){

	ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    ll n,m;
    cin >> n >> m;

    vector<bool> done(n+1,false);
    vector<int> penv(n+1,0);

    int pen = 0;

    for(ll i=0;i<m;++i){
    	ll a;
    	string b;
    	cin >> a >> b;
    	if(b == "AC"){
    		done[a] = true;
    	}
    	else{
    		if(done[a] == false){
    			penv[a]++;
    		}
    	}
    }

    int ans = 0;
    for(ll i=1;i<=n;++i){
    	if(done[i]){
    		ans++;
    		pen+=penv[i];
    	}
    }

    cout << ans << " " << pen << endl;

    

	return 0;
}

Measured memory_bytes: 640