akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>

using namespace std;
#define int long long int
const int INF = 1001001001001001LL;
const int MOD = 1000000007;

int di[] = {-1, 0, 1, 0, -1, 1, 1, -1};
int dj[] = {0, 1, 0, -1, 1, 1, -1, -1};

signed main(){
    
    int n; cin >> n;
    vector<int> a(n);
    vector<int> b(n);
    for(int i = 0; i < n; i++) cin >> a[i] >> b[i];
    vector<pair<int, int>> v(n);
    for(int i = 0; i < n; i++){
        v[i].first = b[i];
        v[i].second = a[i];
    }

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

    int cur = 0;
    for(int i = 0; i < n; i++){
        cur += v[i].second;
        if(cur > v[i].first){
            cout << "No" << endl;
            return 0;
        }
    }

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


Measured memory_bytes: 6528
#include <iostream>
using namespace std;
int main(){
    int N;
    int A;
    int B;
    cin >> N;
    if(N == 1){
        printf("Hello World\n");
    }else if(N == 2){
        cin  >> A;
        cin  >> B;
        cout << A + B <<endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define ll long long
using ull = unsigned long long;
using namespace std;
#define dump(x)                             \
    if (dbg) {                              \
        cerr << #x << " = " << (x) << endl; \
    }
#define overload4(_1, _2, _3, _4, name, ...) name
#define FOR1(n) for (ll i = 0; i < (n); ++i)
#define FOR2(i, n) for (ll i = 0; i < (n); ++i)
#define FOR3(i, a, b) for (ll i = (a); i < (b); ++i)
#define FOR4(i, a, b, c) for (ll i = (a); i < (b); i += (c))
#define FOR(...) overload4(__VA_ARGS__, FOR4, FOR3, FOR2, FOR1)(__VA_ARGS__)
#define FORR(i, a, b) for (int i = (a); i <= (b); ++i)
#define bit(n, k) ((n >> k) & 1) /*nのk bit目*/
namespace mydef {
const int INF = 1ll << 60;
const int MOD = 1e9 + 7;
template <class T>
bool chmin(T& a, const T& b) {
    if (a > b) {
        a = b;
        return 1;
    } else
        return 0;
}
template <class T>
bool chmax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return 1;
    } else
        return 0;
}
void Yes(bool flag = true) {
    if (flag)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}
void No(bool flag = true) {
    Yes(!flag);
}
void YES(bool flag = true) {
    if (flag)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
}
void NO(bool flag = true) {
    YES(!flag);
}
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T& val) {
    std::fill((T*)array, (T*)(array + N), val);
}
bool dbg = false;
}  // namespace mydef
using namespace mydef;
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(), (v).end()
#define SZ(x) ((int)(x).size())
#define vi vector<int>
#define vvi vector<vector<int>>
#define vp vector<pair<int, int>>
#define vvp vector<vector<pair<int, int>>>
#define pi pair<int, int>
//#define P pair<int, int>
//#define V vector<int>
//#define S set<int>
#define asn ans

string S;

void solve() {
}

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

    cin >> S;
    int ans = 0;
    int cnt = 0;
    int N = S.size();
    for (auto& c : S) {
        if (c == 'S')
            cnt++;
        else {
            if (cnt)
                ans++, cnt--;
        }
    }
    cout << N - ans * 2 << endl;

    solve();
    return 0;
}


Measured memory_bytes: 3752
def main():
  N = int(input())
  A = []
  B = []
  for i in range(N):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)
  A = sorted(A)
  B = sorted(B)
  if N % 2 == 1:
    print(B[(N-1)//2]-A[(N-1)//2]+1)
  else:
    med_A = (A[N//2-1] + A[N//2])/2
    med_B = (B[N//2-1] + B[N//2])/2
    print(int((med_B-med_A)*2 + 1))
if __name__ == "__main__":
  main()

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

bool isprime(int n){
    double rootn = sqrt(n);
    if (n < 2){
        return false;
    }
    else if (n == 2){
        return true;
    }
    else if (n % 2 == 0){
        return false;
    }
    else{
        for(int i = 3; i <= rootn; i += 2){
            if(n % i == 0){
                return false;
            }
        }
        return true;
    }
}

// 空のベクトルを二つ渡す。N (>=2) 以下の素数を primes に順番に入れる。
void prime_vectors(int N, vector<int>& primes, vector<bool>& is_prime){
    primes = {};
    is_prime = {};
    for(int i=0; i<=N; i++){
        is_prime.push_back(true);
    }

    primes.push_back(2);
    for(int j=4; j<=N; j+=2){
        is_prime[j] = false;
    }

    int i;
    for(i=3; i*i<=N; i+=2){
        if(!is_prime[i]) continue;
        primes.push_back(i);
        for(int j=2*i; j<=N; j+=i){
            is_prime[j] = false;
        }
    }

    for(; i<=N; i+=2){
        if(is_prime[i]){
            primes.push_back(i);
        }
    }
}

signed main(){
    // cout << fixed << setprecision(10) << flush;

    int n, m;
    cin >> n >> m;
    vector<int> x(n);
    vector<int> y(n);
    vector<int> z(n);

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

    int max_sum = 0;
    for(int i=0; i<(1<<3); i++){
        int x_sign = ((i & (1<<0)) == 1<<0) * 2 - 1;
        int y_sign = ((i & (1<<1)) == 1<<1) * 2 - 1;
        int z_sign = ((i & (1<<2)) == 1<<2) * 2 - 1;
        vector<int> sum(n);
        for(int j=0; j<n; j++){
            sum[j] = x_sign * x[j] + y_sign * y[j] + z_sign * z[j];
        }

        sort(sum.begin(), sum.end(), greater<int>());

        int sum_i = 0;
        for(int j=0; j<m; j++){
            sum_i += sum[j];
        }

        if(max_sum < sum_i){
            max_sum = sum_i;
        }
    }

    cout << max_sum << endl;
    return 0;
}

Measured memory_bytes: 3636
object Main extends App {
  val sc = new java.util.Scanner(System.in)
//  val l = List.fill(3)(sc.nextInt)
  val r = sc.nextInt

  val ans =
    if (r < 1200) "ABC"
    else if(r < 2800) "ARC"
    else "AGC"

  println(ans)
}

Measured memory_bytes: 25408
//import java.io.*;
import java.util.*;
//import java.math.*;
public class Main {
 
    public static void main(String[] args) throws java.io.IOException{
        Scanner scan = new Scanner(System.in);
      //  ArrayList <Double> student= new ArrayList <Double>(); 
//      double [] student =new double [(int)Math.pow(2, 16)-1];
        int sum =0;
     while(scan.hasNext()){
    	 String line = scan.nextLine();
    	 Scanner code = new Scanner(line.replaceAll("\\D"," "));
    	 while(code.hasNextInt())
    	 sum += code.nextInt();
   
     }
     System.out.println(sum);
     }

    }

Measured memory_bytes: 12000
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
const ll MOD = 1e9+7;
/*int dfs(vector<int> &T, vector<int> &C, int i, int sum, int g, int count){
   
}*/

int main(){
  int n, m;
  cin >> n >> m;
  int a, b;
  vector<int> A(n);
  //vector<int> B(m);
  int i, j;
  int ch = 0;
  rep(i, m){
    cin >> a >> b;
    if(a==1){
      if(A[b]!=0){
        ch = 1;
        cout << "POSSIBLE" << endl;
        break;
      }
      else A[b] = 1;
    }
    else if(b==n)
    if(A[a]!=0){
        ch = 1;
        cout << "POSSIBLE" << endl;
        break;
      }
      else A[a] = 1;
  }
  //int ch = 0;
  /*sort(A.begin(), A.end());
  reverse(A.begin(), A.)
  sort(B.begin(), B.end());*/
  /*for(i=0; i<m; i++){
    for(j=0; j<m; j++){
      if(A[i]==0) break;
      else if(A[i]==B[j]){
        ch = 1;
        cout << "POSSIBLE" << endl;
        break;
      }
    }
    if(ch==1) break;
  }*/
  if(ch==0) cout << "IMPOSSIBLE" << endl;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int a, b, v, w, t;
    scanf("%lld %lld %lld %lld %lld", &a, &v, &b, &w, &t);
    long long int res1, res2;
    if (a > b) swap(a, b);

    res1 = a + (v * t);

    res2 = b + (w * t);

    if(res1 >= res2) printf("YES\n");
    else printf("NO\n");
    return 0;
}


Measured memory_bytes: 3712
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<cstdlib>
#include<iterator>
#include<set>
#include<sstream>
#define rep(i,n) for(int(i)=0;(i)<(n);(i)++)
#define endl "\n"
#define ll long long
#define N 200050
using namespace std;


int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
   long long int d,m,p=0,q=0,r=0,l;
    long long int n,x,b,c,y,z,a;
long long int k,t;
int i;

cin>>a;
  if(a>=30)cout<<"Yes";
  else cout<<"No";





}




















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

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

using ll = long long;
using lb = long double;
using P = pair<ll,ll>;
using graph = vector<vector<ll>>;

const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const ll INF = 1LL<<60;
const ll mod = 1000000007LL;

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

int main() {
  int A,B,C;
  cin>>A>>B>>C;
  cout<<(C/A)*B<<endl;
}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using PII = pair<ll, ll>;
#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
template<typename T> void chmin(T &a, const T &b) { a = min(a, b); }
template<typename T> void chmax(T &a, const T &b) { a = max(a, b); }
struct FastIO {FastIO() { cin.tie(0); ios::sync_with_stdio(0); }}fastiofastio;
#ifdef DEBUG
#include "../program_contest_library/memo/dump.hpp"
#else
#define dump(...)
#endif
const ll INF = 1LL<<60;

int main(void) {
    ll n, x;
    cin >> n >> x;

    // map<ll,vector<ll>> mp;
    // vector<ll> ord(2*n-1);
    // iota(ALL(ord), 1);
    // do {
    //     vector<ll> a(ord);
    //     for(ll len=2*n-3; len>=1; len-=2) {
    //         vector<ll> na(len);
    //         auto get = [](ll p, ll q, ll r) { 
    //             ll mi = min({p, q, r}), ma = max({p, q, r});
    //             if(p != mi && p != ma) return p;
    //             if(q != mi && q != ma) return q;
    //             return r;
    //         };
    //         REP(i, len) na[i] = get(a[i], a[i+1], a[i+2]);
    //         a = move(na);
    //     }
    //     mp[a[0]] = ord;
    // } while(next_permutation(ALL(ord)));

    // dump(mp);

    if(x == 1 || x == 2*n-1) {
        cout << "No\n";
        return 0;
    }

    if(n == 2) {
        cout << "Yes\n";
        cout << "1\n2\n3\n";
        return 0;
    }

    vector<ll> ans(2*n-1);
    vector<bool> used(2*n-1);
    if(x+2 <= 2*n-1) {
        ans[n-2] = x+2;
        ans[n-1] = x;
        ans[n]   = 1;
        ans[n+1] = x+1;
        used[0] = used[x-1] = used[x] = used[x+1] = true;
    } else {
        ans[n-2] = x-2;
        ans[n-1] = x;
        ans[n]   = 2*n-1;
        ans[n+1] = x-1;
        used[x-3] = used[x-2] = used[x-1] = used[2*n-2] = true;
    }

    ll idx = 0;
    REP(i, n-2) {
        while(idx<2*n-1 && used[idx]) idx++;
        ans[i] = idx+1;
        used[idx] = true;
    }
    FOR(i, n+2, 2*n-1) {
        while(idx<2*n-1 && used[idx]) idx++;
        ans[i] = idx+1;
        used[idx] = true;
    }

    cout << "Yes\n";
    REP(i, 2*n-1) cout << ans[i] << "\n";

    return 0;
}

Measured memory_bytes: 3072
#include <algorithm>
#include <bitset>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <vector>

using namespace std;

#define rep(i, n) for (int64_t i = 0; i < (int64_t)(n); i++)
#define irep(i, n) for (int64_t i = 0; i <= (int64_t)(n); i++)
#define rrep(i, n) for (int64_t i = (n)-1; i >= 0; i--)
#define rirep(i, n) for (int64_t i = n; i >= 0; i--)

int main() {
  int N, A, B;
  cin >> N >> A >> B;

  if (A > B) {
    cout << 0 << endl;
  } else if (N == 1) {
    cout << (A == B ? 1 : 0) << endl;
  } else {
    int64_t L = (int64_t)A * (N - 1) + B;
    int64_t R = (int64_t)B * (N - 1) + A;

    cout << R - L + 1 << endl;
  }

  return 0;
}

Measured memory_bytes: 3608
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------

string S, T;

void _main() {
	cin >> S >> T;

	int count = 0;
	rep(i, 0, 3) {
		if (S[i] == T[i]) count++;
	}

	cout << count << endl;
	
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS

#include<fstream>
#include<iostream>
#include<string>
#include<iomanip>
#include<list>
#include<math.h>
#include<stack>
#include<queue>
#include<vector>
#include<algorithm>
#include<utility>

using namespace std;

int main(int argc, char **argv){
	int n;
	while (cin >> n && n != 0){
		vector<int> v;
		for (int i = 0; i < n; i++) {
			int tmp;
			cin >> tmp;
			v.push_back(tmp);
		}
		int cnt = 0;
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < n - i - 1; j++) {
				if (v[j] > v[j + 1]) {
					swap(v[j], v[j + 1]);
					cnt++;
				}
			}
		}
		cout << cnt << endl;
	}
	return 0;
}

Measured memory_bytes: 1212
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

const int Up = 0;
const int South = 1;
const int East = 2;
const int West = 3;
const int North = 4;
const int Down = 5;

void rotate(int& a, int& b, int& c, int& d){
    swap(c, d);
    swap(b, c);
    swap(a, b);
}


int main(){
    int i, n, sum, dice[6];
    string op;
    while(cin >> n){
        if(n == 0){
            break;
        }
        for(i = 0; i < 6; ++i){
            dice[i] = i + 1;
        }
        sum = 1;
        for(i = 0; i < n; ++i){
            cin >> op;
            if(op == "North"){
                rotate(dice[Up], dice[North], dice[Down], dice[South]);
            }else if(op == "East"){
                rotate(dice[Up], dice[East], dice[Down], dice[West]);
            }else if(op == "West"){
                rotate(dice[Up], dice[West], dice[Down], dice[East]);
            }else if(op == "South"){
                rotate(dice[Up], dice[South], dice[Down], dice[North]);
            }else if(op == "Right"){
                rotate(dice[North], dice[East], dice[South], dice[West]);
            }else if(op == "Left"){
                rotate(dice[North], dice[West], dice[South], dice[East]);
            }
            sum += dice[Up];
        }
        cout << sum << endl;
    }
}

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


const int MAX_V = 210;
const int INF = 1e9;

struct edge {
    int to, cap, rev;
};

vector<edge> G[MAX_V];
bool used[MAX_V];

void add_edge(int from, int to, int cap) {
    G[from].push_back((edge){to, cap, G[to].size()});
    G[to].push_back((edge){from, 0, G[from].size() - 1});
}

int dfs(int v, int t, int f) {
    if (v == t) return f;
    used[v] = true;
    for (int i = 0; i < G[v].size(); i++) {
        edge &e = G[v][i];
        if (!used[e.to] && e.cap > 0) {
            int d = dfs(e.to, t, min(f, e.cap));
            if (d > 0) {
                e.cap -= d;
                G[e.to][e.rev].cap += d;
                return d;
            }
        }
    }
    return 0;
}

int max_flow(int s, int t) {
    int flow = 0;
    for (;;) {
        memset(used, 0, sizeof(used));
        int f = dfs(s, t, INF);
        if (f == 0) return flow;
        flow += f;
    }
}

int main() {
    int n;
    cin >> n;
    vector<int> a(n), b(n), c(n), d(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i] >> b[i];
    }
    for (int i = 0; i < n; i++) {
        cin >> c[i] >> d[i];
    }

    int start = 0;
    int goal = 2*n+1;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            if (a[i] < c[j] and b[i] < d[j]) {
                add_edge(i+1, n+j+1, 1);
            }
        }
    }

    for (int i = 0; i < n; i++) {
        add_edge(0, i+1, 1);
        add_edge(n+i+1, 2*n+1, 1);
    }

    cout << max_flow(start, goal) << endl;

    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 1e5+100;
char s[N]; int n,m;
bool check(int l,int r){
    while(l<r){
        if(s[l]!=s[r]) return false;
        l++; r--;
    }
    return true;
}
int main(){
    scanf("%s",s+1); n=strlen(s+1);
    if(check(1,(n-1)/2)&&check((n+3)/2,n)&&check(1,n)) printf("Yes\n");
    else printf("No\n");
}

Measured memory_bytes: 256
import java.util.*;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int K = sc.nextInt();
        String S = sc.next();

        for(int i=0;i<N;i++){
            String s = S.substring(i,i+1);
            if(i == K-1){
                System.out.print(s.toLowerCase());
            } else {
                System.out.print(s);
            }
        }




    }
}


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

#define REP(i, x, n) for (int i = x; i < (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x.size())
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define uniq(x) x.erase(unique(x.begin(), x.end()), x.end())
#define F first
#define S second
#define mp make_pair
#define eb emplace_back
#define pii pair<int, int>
#define pll pair<ll, ll>

using namespace std;

typedef long long ll;

/* --- INFやMODの値が適切か確認する --- */
// const int INF = 1 << 30;
// const ll INF = 1LL << 60;
// const ll MOD = 1000000007;

int main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  rep(i, s.size()) s[i] = char('A' + (s[i] - 'A' + n) % 26);
  cout << s << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
    int n;
    cin>>n;
    int num[n];
    for(int i=0;i<n;i++) cin>>num[i];
    
    int han=0,ct=0;
    
    while(han<1){
        int ctn=0;
        for(int i=0;i<n;i++){
            if(num[i]%2 == 0){
                ctn++;
                num[i]=num[i]/2;
            }else{
                break;
            }
        }
        
        if(ctn==n) ct++;
        else han++;
    }
    
    cout<<ct<<endl;
}


Measured memory_bytes: 256
/*
		@Author :- Gaurav Bharti
		National Institute of Technology, Jamshedpur.
*/
 
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define empb emplace_back
#define mp make_pair
#define F first
#define S second
#define endl "\n"
#define vii vector<int>
#define vll vector<ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vpll vector<pll>
#define vpii vector<pii>
#define mapii map<int,int> 
#define mapll map<ll,ll>
#define all(a) a.begin(),a.end()
#define test ll t; cin>>t; while(t--)
#define prec(n) fixed<<setprecision(n)
#define jaldibazi ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define mod 1000000007
 
void solve(){
	int n; cin >> n;
	int rem = n%1000;
	if( rem == 0){
		cout << 0 << endl;
		return ;
	}
	if(n <= 1000){
		 cout << 1000-n << endl;
		 return ;
	}

	cout << 1000-rem << endl;
} 
 
int main(){
	jaldibazi;
 
	solve();
}

Measured memory_bytes: 3624
import sys
from pprint import pprint
from fractions import gcd

mod = 10**9+7

n = int(input())
a = list(map(int,input().split()))

def modinv(x,mod):
    return pow(x, mod-2, mod)

b = []
for a_i in a:
    b_i = modinv(a_i, mod)
    b.append(b_i)

def lcm(a,b):
    return a//gcd(a,b)*b

# calc lcm for a
cur = 1
for a_i in a:
    cur =  lcm(cur, a_i)

# sum lcm / a_i for a using mod inverse a (= b)
ans = 0
for b_i in b:
    ans += cur * b_i
ans %= mod
print(ans)

Measured memory_bytes: 68504
#include <iostream>
#include <cstdio>
#include <cmath>
#include <string>
#include <algorithm>
#include <cstring>
using namespace std;
int t[200005];
int main()
{
    int n;
    scanf("%d",&n);
    for(int i=0;i<n;i++)
        scanf("%d",&t[i]);
    sort(t,t+n);
    int i;
    for(i=0;i<n-1;i++)
        if(t[i]==t[i+1])
        break;
    if(i==n-1)
        printf("YES\n");
    else
        printf("NO\n");
    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <cstdio>
#include <map>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <set>
#include <queue>
#include <unordered_set>
#include <complex>
#include <unordered_map>
#include <bitset>
#include <ctime>
#include <cassert>

#define sz(a) (int)((a).size())

using namespace std;

typedef long long ll;
typedef long double ld;

int f(ll n)
{
    int ans = 0;
    while (n)
    {
        ans += n % 10;
        n /= 10;
    }
    return ans;
}

int solve()
{
    ios::sync_with_stdio(0);
    ll n;
    if (!(cin >> n))
    {
        return 1;
    }
    int ans = f(n);
    ll k = 1;
    while (k < n)
    {
        ll a = n;
        n /= k;
        n *= k;
        n--;
        ans = max(ans, f(n));
        n = a;
        k *= 10LL;
    }
    cout << max(ans, f(n)) << endl;
    return 0;
}

int32_t main()
{
    #ifdef ONPC
        freopen("in.txt", "r", stdin);
    #endif
    int T = 100;
    //cin >> T;
    for (int i = 1; i <= T; i++)
    {
        #ifdef ONPC
            cout << "Test #" << i << ":\n";
        #endif
        if (solve())
            break;
        #ifdef ONPC
            cerr << "_______________________________________________" << endl;
        #endif
    }
    #ifdef ONPC
        cerr << endl << "finished in " << clock() * 1000LL / CLOCKS_PER_SEC << " ms" << endl;
    #endif
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
#define fi first
#define se second
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define siz(v) (ll)(v).size()
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repi(i, x, n) for (ll i = x; i < (ll)(n); i++)
typedef pair<ll, ll> P;
typedef pair<ll, ll> PL;
const ll mod = 1000000007;
const ll INF = 1000000099;
vector<ll> dx = {-1, 1, 0, 0}, dy = {0, 0, -1, 1};
//cin.tie(0);
//ios::sync_with_stdio(false);

signed main()
{
    string s;
    cin >> s;
    ll k = 1;
    int mae=1;

    for (ll i = 1; i < siz(s); i++)
    {
        //cout<<i<<endl;
        if(s[i]==s[i-1] && mae==1){
            i++;
            mae=2;
            if(i==siz(s)){
                k--;
                //cout<<"D"<<endl;
            }
        }else{
            mae=1;
        }
        k++;
        //cout<<i<<":"<<k<<endl;
    }

    cout << k << endl;
}

Measured memory_bytes: 640
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"
#define EPS 1e-10
using namespace std;
typedef long long llong;
int city(char a) {
	switch (a) {
	case 'A':return 0;
	case 'B':return 1;
	case 'W':return 2;
	case 'X':return 3;
	case 'Y':return 4;
	case 'Z':return 5;
	default:return -1;
	}
}
vector<vector<int> >v(6, vector<int>(6, -1));
string s;
bool connect(int x=0,int y=0) {
	//cout << x << " " << y << endl;
	if (x == s.length() ) {
		if (y == city('B'))return true;
		else return false;
	}

	for (int j = 0; j < v[y].size(); j++) {
		if (v[y][j] == s[x] - '0') {
			return connect(x + 1, j);
		}
	}

	return false;
}



int main() {


	v[city('A')][city('X')] = 0;
	v[city('A')][city('Y')] = 1;
	v[city('B')][city('X')] = 1;
	v[city('B')][city('Y')] = 0;
	v[city('X')][city('Z')] = 1;
	v[city('Y')][city('X')] = 0;
	v[city('Z')][city('W')] = 0;
	v[city('Z')][city('B')] = 1;
	v[city('W')][city('B')] = 0;
	v[city('W')][city('Y')] = 1;

	while (cin >> s, s != "#") {
		if (connect())cout << "Yes" << endl;
		else cout << "No" << endl;
	}

	return 0;
}

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

int main(void) {
  int a, b;
  cin >> a >> b;
  if (a % 3 == 0 || b % 3 == 0 || (a+b) % 3 == 0) {
    cout << "Possible" << endl;
  }
  else {
    cout << "Impossible" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  	int i,j,k,m,n,x,u,v,z;
  	cin>>x>>n;
 	map<int,int> mp;
  	for(i=0;i<n;i++)
    {
      cin>>v;
      mp[v]++;
    }
  	j=0;
  	while(1)
    {
      v=x+j;
      u=x-j;
      if(mp.find(u)==mp.end())
      {
        cout<<u<<"\n";
        break;
      }
      if(mp.find(v)==mp.end())
      {
        cout<<v<<"\n";
        break;
      }
      j++;
    }
}

Measured memory_bytes: 3640
#三井住友信託銀行プログラミングコンテスト2019 -E Colorful Hats 2
"""
適当に色を割り振って良い。
[0,0,0]の状態から、その数字がいくつあるかを掛けていく
"""
import sys
readline = sys.stdin.buffer.readline
def even(n): return 1 if n%2==0 else 0
n = int(readline())
lst1 = list(map(int,readline().split()))
mod = 10**9+7

RGB = [0,0,0]
ans = 1
for i in lst1:
    ans*= RGB.count(i)
    ans %= mod
    if not ans:
        print(ans)
        exit()
    for j in range(3):
        if RGB[j] == i:
            RGB[j] += 1
            break
print(ans)

Measured memory_bytes: 52464
#include<iostream>
#include<cmath>
#include<string>
#include<utility>
#include<vector>
#include<array>

using namespace std;
const long long  mod=1000000007;

int main(){
    int n;
    long long ans=0;
    cin >> n;
    vector<long long> a(n);
    for(int i=0;i<n;i++){
        cin >>a[i];
    }
    for(int i=0;i<60;i++){
        long long x=0;
        for(int j=0;j<n;j++){
            if(a[j]>>i & 1) x++;
        }
        long long now = x*(n-x)%mod;
        for(int j=0;j<i;j++){
            now = now*2%mod;
        }
        ans += now;
        ans %= mod;
    }
    cout <<ans<< endl;
    return 0;
}


Measured memory_bytes: 2560
#include<iostream>
#include<stdio.h>
using namespace std;
int main(){
  int num;
  double tai,sint;
  char d;
  while(scanf("%d,%lf,%lf",&num,&tai,&sint)!=EOF){
  //cout<<tai/sint*sint<<endl;
    if(tai/(sint*sint)>=25)cout<<num<<endl;
  }
}

Measured memory_bytes: 1232
#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <map>
#include <queue>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using namespace std;

template<class T>
constexpr T INF = ::numeric_limits<T>::max() / 32 * 15 + 208;

int main() {
    int a = 0, b = 0;
    for (int i = 0; i < 4; ++i) {
        int k;
        cin >> k;
        a += k;
    }
    for (int j = 0; j < 4; ++j) {
        int k;
        cin >> k;
        b += k;
    }
    cout << max(a, b) << "\n";
    return 0;
}



Measured memory_bytes: 3112
#include <iostream>
#include <string>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <list>
#include <iomanip>
#include <vector>
#include <functional>
#include <algorithm>
#include <cstdio>
#include <random>
#include <ctime>
#include <cstdlib>
#include <unordered_map>
#include <string.h>
#include <iostream>

using namespace std;
typedef long long ll;
typedef pair<int, int> Pint;
typedef pair<ll, ll> Pll;
#define rep(begin, i, end) for (ll i = begin; i < (ll)(end); i++)
#define all(v) v.begin(), v.end()
const int MOD = 1000000007;

int main()
{
    int A, B, C;
    cin >> A >> B >> C;
    int count = A % 2 + B % 2 + C % 2;
    if (count == 0 || count == 3)
    {
        int m = max(max(A, B), C);
        cout << (m - A) / 2 + (m - B) / 2 + (m - C) / 2 << endl;
    }
    else if (count == 1)
    {
        A = A + 1 - A % 2;
        B = B + 1 - B % 2;
        C = C + 1 - C % 2;
        int m = max(max(A, B), C);
        cout << (m - A) / 2 + (m - B) / 2 + (m - C) / 2 + 1 << endl;
    }
    else
    {
        A += A % 2;
        B += B % 2;
        C += C % 2;
        int m = max(max(A, B), C);
        cout << (m - A) / 2 + (m - B) / 2 + (m - C) / 2 + 1 << endl;
    }
}

Measured memory_bytes: 3556
#include <bits/stdc++.h>
#include <boost/math/constants/constants.hpp>

template<class RandomAccessIterator, class Field>
RandomAccessIterator fast_fourier_transform(RandomAccessIterator first, RandomAccessIterator last, RandomAccessIterator result, Field hint){
    ::std::vector<Field> res(first, last);
    ::std::size_t N = res.size();

    // bit reverse
    for(::std::size_t i = 0, j = 0; i < N; ++i){
        if(i < j)::std::swap(res[i], res[j]);
        j ^= N / (1 + (i ^ (i + 1))) * (i ^ (i + 1));
    }

    ::std::stack<Field> root;
    root.push(hint);
    for(::std::size_t i = 2; i < N; i <<= 1){
        root.push(hint *= hint);
    }

    // fft
    for(::std::size_t i = 1; i < N; i <<= 1){
        auto t = root.top();
        root.pop();
        for(::std::size_t j = 0; j < N; j += 2 * i){
            Field coef = 1;
            for(::std::size_t k = 0; k < i; ++k){
                auto tmp = res[j + k];
                res[j + k] += coef * res[j + k + i];
                res[j + k + i] = tmp - coef * res[j + k + i];
                coef *= t;
            }
        }
    }

    return ::std::copy(res.begin(), res.end(), result);

}

constexpr double pi = boost::math::constants::pi<double>();
::std::size_t t = 1;

template<class RandomAccessIterator1, class RandomAccessIterator2, class RandomAccessIterator3>
RandomAccessIterator1 convolution(RandomAccessIterator1 first1, RandomAccessIterator1 last1, RandomAccessIterator2 first2, RandomAccessIterator2 last2, RandomAccessIterator3 result){
    using value_type = typename ::std::iterator_traits<RandomAccessIterator1>::value_type;
    using size_type = ::std::size_t;
    size_type N = last1 - first1, M = last2 - first2;
    while(t < N + M)t <<= 1;

    ::std::vector<value_type> input1(first1, last1), input2(first2, last2), chukan1(t), chukan2(t), res(t);
    input1.resize(t);
    input2.resize(t);
    value_type hint = value_type(::std::cos(pi / (t / 2)), ::std::sin(pi / (t / 2))), ihint = value_type(::std::cos(pi / (t / 2)), -::std::sin(pi / (t / 2)));
    fast_fourier_transform(input1.begin(), input1.end(), chukan1.begin(), hint);
    fast_fourier_transform(input2.begin(), input2.end(), chukan2.begin(), hint);
    ::std::transform(chukan1.begin(), chukan1.end(), chukan2.begin(), res.begin(), ::std::multiplies<value_type>());

    return fast_fourier_transform(res.begin(), res.end(), result, ihint);
}

int main(){
    using namespace std;
    unsigned long N, L;
    cin >> N >> L;
    vector<unsigned long> T(N);
    copy_n(istream_iterator<unsigned long>(cin), N, T.begin());
    vector<complex<long double>> ps(N), res(4 * N);
    transform(T.begin(), T.end(), ps.begin(), [&L](auto t){return complex<long double>(cos(pi * t / L), sin(pi * t / L));});
    convolution(ps.begin(), ps.end(), ps.rbegin(), ps.rend(), res.begin());
    complex<long double> x{0};
    for(long i = 0, c = -N; i + 1 < N; ++i){
        x += res[i] * static_cast<long double>(c += 2);
    }
    t *= N * (N - 1) * (N - 2) / 6;
    x /= t;
    cout << setprecision(15) << fixed;
    cout << x.real() << " " << x.imag() << endl;
    return 0;
}

Measured memory_bytes: 2504
#include<bits/stdc++.h>
using namespace std;
int main()
{

    int t;
    cin>>t;
    int ac=0,wa=0,tle=0,re=0;
    while(t--)
    {
        string s;
        cin>>s;
        if(s=="AC"){ac++;}
        else if(s=="TLE"){tle++;}
        else if(s=="WA"){wa++;}
        else{re++;}
    }

    cout<<"AC x "<<ac<<endl;
    cout<<"WA x "<<wa<<endl;
    cout<<"TLE x "<<tle<<endl;
    cout<<"RE x "<<re<<endl;
    return 0;
}


Measured memory_bytes: 3604
import java.util.*;

public class Main {

  static Scanner scan = new Scanner(System.in);

  public static void main(String[] args) {
    int n = scan.nextInt();

    n = n % 10;
    if (n == 2 || n == 4 || n == 5 || n == 7 || n == 9) {
      System.out.println("hon");
    }
    if (n == 0 || n == 1 || n == 6 || n == 8) {
      System.out.println("pon");
    }
    if (n == 3) {
      System.out.println("bon");
    }
  }
}

Measured memory_bytes: 27080
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define rep(i,N) for(int i=0;i<(int)N;i++)
#pragma GCC optimize("O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
static inline char GET(void)
{
  static char buf[1<<15],*s1=buf,*s2=buf;
  return s1==s2&&(s2=(s1=buf)+fread(buf,1,1<<15,stdin),s1==s2)?EOF:*s1++;
}
static inline void PUT(char c)
{
  static char buf[1<<15],*ptr=buf;
  if(ptr==buf+strlen(buf)||c==0){fwrite(buf,1,ptr-buf,stdout),ptr=buf;}*ptr++=c;
}
static inline int IN(void)
{
  int x=0,f=0,c=GET();while(c<48||c>57){f^=c==45,c=GET();}
  while(c>47&&c<58){x=x*10+c-48,c=GET();}return f?-x:x;
}
static inline void OUT(int a)
{
  if(a<0)PUT('-'),a=-a;
  int d[40],i=0;do{d[i++]=a%10;}while(a/=10);
  while(i--){PUT(d[i]+48);}PUT('\n');
}
static inline int Max(int x,int y){return x>y?x:y;}
int main(void)
{
  int H=IN(),W=IN(),M=IN(),row[H],col[W],bombY[M],bombX[M],
      idh=0,idw=0,hmax=0,wmax=0,obj=0;
  memset(row,0,sizeof(row));memset(col,0,sizeof(col));
  rep(i,M)
  {
    bombY[i]=IN()-1,bombX[i]=IN()-1;
    row[bombY[i]]++;col[bombX[i]]++;
    hmax=Max(hmax,row[bombY[i]]);wmax=Max(wmax,col[bombX[i]]);
  }
  rep(i,H){if(hmax==row[i]){idh++;}}rep(j,W){if(wmax==col[j]){idw++;}}
  rep(i,M){obj+=(row[bombY[i]]==hmax&&col[bombX[i]]==wmax);}
  return OUT(hmax+wmax-(1l*obj==1l*idh*idw)),0;
}

Measured memory_bytes: 6240
#include <iostream>
#include <string>
#include <map>
#include <math.h>
using namespace std;

#define ll long long

int main(){
    int A,B,C;
    cin >> A >> B >> C;
    if((A < C && C < B) || (A > C && C > B))cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

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


Measured memory_bytes: 384
#include<iostream>
#include<cstdio>
#include<vector>
#include<map>
#include<unordered_map>
#include<set>
#include<string>
#include<algorithm>
#include<math.h>
#include<numeric>
#include<iomanip>
#include<queue>
#include<functional>
#include<iso646.h>
#include<bitset>

using namespace std;

typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long long ll;
typedef vector<long long> vll;
typedef pair<long long, long long> pll;

const ll INF = 1e16;
const ll MOD = 1e9 + 7;
//const ll MOD = 998244353;

int main() {
	ll i, j;
	ll H, W;
	cin >> H >> W;
	vector<string> S(H);
	for (auto& e : S)cin >> e;

	vector<vll> HO;
	for (i = 0; i < H; i++) {
		vll ho;
		for (j = 0; j < W; j++) {
			if (S[i][j] == '#') {
				ho.push_back(j);
			}
		}
		HO.push_back(ho);
	}
	vector<vll> WO;
	for (j = 0; j < W; j++) {
		vll wo;
		for (i = 0; i < H; i++) {
			if (S[i][j] == '#') {
				wo.push_back(i);
			}
		}
		WO.push_back(wo);
	}

	vector<vll> AF;
	for (i = 0; i < H; i++) {
		vll taf(W, 0);
		AF.push_back(taf);
	}
	for (i = 0; i < H;i++) {
		vll ho = HO[i];
		ho.push_back(W);
		ll p = 0;
		for (auto op : ho) {
			for (ll pp = p; pp < op; pp++) {
				AF[i][pp] += op - p;
			}
			p = op + 1;
		}
	}
	for (j = 0; j < W; j++) {
		vll wo = WO[j];
		wo.push_back(H);
		ll p = 0;
		for (auto op : wo) {
			for (ll pp = p; pp < op; pp++) {
				AF[pp][j] += op - p;
			}
			p = op + 1;
		}
	}

	ll ans = 0;
	for (i = 0; i < H; i++) {
		for (j = 0; j < W; j++) {
			ans = max(ans, AF[i][j]);
		}
	}
	cout << ans - 1 << endl;

	return 0;
}


Measured memory_bytes: 98432
def dontbelate(D,T,S):
    if T <  D//S:
        return 'No'
    elif T > D//S:
        return 'Yes'
    else:
        if D%S == 0:
            return 'Yes'
        else:
            return 'No'


if __name__ == "__main__":
    D,T,S = map(int, input().split())
    print(dontbelate(D,T,S))

Measured memory_bytes: 9020
import java.io.*;
import java.util.*;
import static java.lang.System.in;

public class Main {
    long mod = 1000000000+7;
    public static void main(String[] args) throws Exception {
        Main main = new Main();
        main.solve();
//        System.out.println(main.solve());
    }
    long solve(){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt(), K = sc.nextInt(), q = sc.nextInt();
        int[] rec = new int[n];
        for(int i=0;i<q;i++){
            int a = sc.nextInt()-1;
            rec[a] += 1;
        }
        int ref = q-K;
        PrintWriter out = new PrintWriter(System.out);
        for(int i=0;i<n;i++){
            if(rec[i]>ref) out.println("Yes");
            else out.println("No");
        }
        out.flush();
        long ans = 1;
        return ans;
    }
}



Measured memory_bytes: 50840
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using static System.Console;
using static System.Math;
using static MyIO;
using static MyUtil;

public class B
{
	public static void Main() => (new Solver()).Solve();
}

public class Solver
{
	public void Solve()
	{
		int A = GetInt();
		int B = GetInt();
		int C = GetInt();
		int D = GetInt();

		while(true)
		{
			C -= B;
			if(C <= 0)
			{
				WriteLine("Yes");
				return;
			}

			A -= D;
			if(A <= 0)
			{
				WriteLine("No");
				return;
			}
		}
	}
}

public static class MyIO
{
	private static string[] args = null;
	private static int num = -1;
	private static int used = -1;

	private static string getArg()
	{
		if(used == num)
		{
			args = Console.ReadLine().Split(' ');
			num = args.Length;
			used = 0;
		}
		return args[used++];
	}

	public static int GetInt() => int.Parse(getArg());
	public static long GetLong() => long.Parse(getArg());
	public static double GetDouble() => double.Parse(getArg());
	public static decimal GetDecimal() => decimal.Parse(getArg());
	public static string GetString() => getArg();
	public static char GetChar() => getArg()[0];
	public static int[] GetInts(long N) => Enumerable.Range(0, (int)N).Select(_ => GetInt()).ToArray();
	public static long[] GetLongs(long N) => Enumerable.Range(0, (int)N).Select(_ => GetLong()).ToArray();
	public static double[] GetDoubles(long N) => Enumerable.Range(0, (int)N).Select(_ => GetDouble()).ToArray();
	public static decimal[] GetDecimals(long N) => Enumerable.Range(0, (int)N).Select(_ => GetDecimal()).ToArray();
	public static string[] GetStrings(long N) => Enumerable.Range(0, (int)N).Select(_ => GetString()).ToArray();
}

public static class MyUtil
{
	public static void chmax<T>(ref T x, T y) where T : IComparable<T>
	{
		if(x.CompareTo(y) < 0)
			x = y;
	}

	public static void chmin<T>(ref T x, T y) where T : IComparable<T>
	{
		if(x.CompareTo(y) > 0)
			x = y;
	}

	public static void swap<T>(ref T x, ref T y)
	{
		T tmp = x;
		x = y;
		y = tmp;
	}
}

Measured memory_bytes: 27400
x, y = map(int, input().split())
ans = 0
if (x == 0):
    print(y) if (y >= 0) else print(-y + 1)
elif (y == 0):
    print(x + 1) if(x > 0) else print(-x)
elif (x > 0 and y > 0):
    if (y >= x): print(abs(y - x))
    elif (x > y): print(abs(y - x) + 2)
elif (x < 0 and y < 0):
    if (y <= x): print(abs(y - x) + 2)
    elif (x < y): print(abs(y - x))
elif (x > 0 and y < 0):
    print(abs(-y - x) + 1)
elif (x < 0 and y > 0):
    print(1 + abs(y + x))


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

int main() {
  int N,T,A;
  cin>>N>>T>>A;
  
  vector<double>h(N);
  vector<double>t(N);
  
  for(int i=0;i<N;i++){
    cin>>h.at(i);
    t.at(i)=T-h.at(i)*0.006;
  }
   double minT=10000000;
  for(int i=0;i<N;i++){
    minT=min(minT,(A-t.at(i))*(A-t.at(i)));
    }
             
  for(int i=0;i<N;i++){
    if(minT==(A-t.at(i))*(A-t.at(i)))
      cout<<i+1;
  }
             }
          

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <cassert>
#include <algorithm>
int MOD = 1000000007 ;
using namespace std;
vector<vector<int>> grid;
vector<vector<int>> memory;
int h, w;
int f(int y, int x) {
	if (memory[y][x] != -1) return memory[y][x];
	int sum = 0;
	if (grid[y + 1][x] == 0) sum += f(y + 1, x);
	if (sum > MOD) sum -= MOD;
	if (grid[y][x+1] == 0) sum += f(y, x+1);
	if (sum > MOD) sum -= MOD;
	memory[y][x] = sum;
	return sum;
}

int main(){
	
	cin >> h >> w;
	grid.assign(h + 1, vector<int>(w + 1,1));
	memory.assign(h + 1, vector<int>(w + 1, -1));
	memory[h - 1][w - 1] = 1;
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			char a;
			cin >> a;
			if (a == '.') grid[i][j] = 0;
		}
	}
	
	cout << f(0, 0);
}


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

int main()
{
    string x;
    while (true) {
        cin >> x;
        if (x == "0") break;
        
        int sum = 0;
        for (int i = 0; i < x.size(); i++) {
            sum += x[i] - '0';
        }
        cout << sum << endl;
    }
}



Measured memory_bytes: 3180
import java.util.*;

class Main {
	
	static long gh = 100000000000l, gp = 100000, gq = 1;
	
	public static void main(String args[]){
		Scanner in = new Scanner(System.in);
		while(true){
			int n = in.nextInt(), m = in.nextInt(), a = in.nextInt();
			if(n==0 && m==0 && a==0) return ;
			long amida[] = new long[m];
			for(int i=0; i<m; i++){
				int h = in.nextInt(), p = in.nextInt(), q = in.nextInt();
				amida[i] = toLong(h, p, q);
			}
			Arrays.sort(amida);
			
			int cur = a, height = 10000;
			for(int i=m-1; i>=0; i--)if(height>getH(amida[i])){
				if(getP(amida[i])==cur){
					cur = getQ(amida[i]);
					height = getH(amida[i]);
				}
				else if(getQ(amida[i])==cur){
					cur = getP(amida[i]);
					height = getH(amida[i]);
				}
			}
			System.out.println(cur);
		}
	}
	
	private static long toLong(int h, int p, int q){
		return gh*h + gp*p + gq*q;
	}
	
	private static int getH(long x){
		return (int)(x/gh);
	}
	
	private static int getP(long x){
		return (int)((x/gp)%gp);
	}
	
	private static int getQ(long x){
		return (int)(x%gp);
	}
}

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

def f(N, K):
    m = (N-1)*(N-2)//2
    if K > m:
        print(-1)
        return

    print(N-1+m-K)

    for i in range(2, N+1):
        print(1, i)

    k2 = m - K
    for i in range(2, N+1):
        for j in range(i+1, N+1):
            if k2 <= 0:
                return

            print(i, j)
            k2 -= 1

def main():
    N, K = map(int, input().split())
    f(N, K)
    



if __name__ == '__main__':
    main()


Measured memory_bytes: 3608
#include<stdio.h>
int main()
{
	int a,b,i,j;
	while(1)
	{
		scanf("%d %d",&a,&b);
		if(a==0&&b==0)
{
		break;
}
		for(i=0;i<a;i++)
		{
			for(j=0;j<b;j++)
			{
			printf("#");
			}
printf("\n");
		}
			printf("\n");
		}
return 0;
}

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

int main() {
    int N, K;
    cin >> N >> K;
    vector<long long> S(N+1, 0);
    vector<long long> PS(N+1, 0);
    for(int i=1; i<=N; ++i) {
        long long a;
        cin >> a;
        S[i] = S[i - 1] + a;
        PS[i] = PS[i - 1];
        if(a > 0) PS[i] += a;
    }

    long long res = -1001001001001001001;
    for(int i=1; i+K-1<=N; ++i) {
        long long tmp = PS[i - 1] + (PS[N] - PS[i + K - 1]);
        if(S[i + K - 1] - S[i - 1] > 0) tmp += S[i + K - 1] - S[i - 1];
        res = max(res, tmp);
    }

    cout << res << endl;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
#include<string>
using namespace std;
 
int main()
{
  string s;
  int c=0;
  cin >> s;
  for(int i=0; i<3; i++)
  {
    if(s[i]=='1') c++;
  }
  cout << c <<endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <utility>
#include <cstdlib>
#include <cmath>
#include <functional>

#define INF 1000000000000000000
using namespace std;
typedef long long ll;
#define sheep true
#define wolf false

int main(){
	bool park[100010];
	bool inf[100010];
	string str;
	int n;
	cin >> n;
	cin >> str;
	bool exist = false;
	for (int j = 0; j < 4; j++) {
		park[0] = (j/2==0);
		park[1] = (j%2==0);
		for (int i = 2; i < n; i++) {
			bool temp;
			temp = (str[i - 1] == 'o' ? !(true xor park[i - 1]) : !(false xor park[i - 1]));
			park[i] = (temp ? park[i - 2] : !park[i - 2]);
		}
		bool temp1,tempn;
		temp1 = (str[n - 1] == 'o' ? !(true xor park[n - 1]) : !(false xor park[n - 1]));
		temp1 = (temp1 ? park[n-2] : !park[n - 2]);
		tempn = (str[0] == 'o' ? !(true xor park[0]) : !(false xor park[0]));
		tempn = (tempn ? park[1] : !park[1]);
		if (temp1 == park[0] && tempn == park[n - 1]) {
			exist = true;
			break;
		}
	}
	if (exist) {
		for (int i = 0; i < n; i++) {
			cout << (park[i] ? 'S' : 'W');
		}
		cout << endl;
	}
	else {
		cout << "-1" << endl;
	}

	return 0;
}


Measured memory_bytes: 768
fn read_ls<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().split_whitespace().map(|e| e.parse().ok().unwrap()).collect()
}

fn main(){
    let l : Vec<i32> = read_ls();
    let (w,h,x,y,r) = (l[0], l[1], l[2], l[3], l[4]);
    if 0 <= x - r && x + r <= w && 0 <= y - r && y + r <= h {  
        println!("Yes");
    }else{
        println!("No");
    }
}




Measured memory_bytes: 5028
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main() {
	int n;
	cin>>n;
	int W;
	cin>>W;
	int w[n];
	int v[n];
	for(int i=0;i<n;i++) {
		cin>>w[i]>>v[i];
	}
	ll dp[n+1][W+1];
	for(int i=0;i<=n;i++) {
		for(int j=0;j<=W;j++) {
			if(i == 0 || j == 0) {
				dp[i][j] = 0;
			}
			else if(w[i-1] <= j) {
				dp[i][j] = max(v[i-1] + dp[i-1][j-w[i-1]],dp[i-1][j]);
			}
			else {
				dp[i][j] = dp[i-1][j];
			}
		}
	}
	cout<<dp[n][W];
}

Measured memory_bytes: 82416
def main():
    N = int(input())
    done = [False for i in range(N + 1)]
    memo = [0 for i in range(N + 1)]

    def do_dp(n):
        if done[n]:
            return memo[n]
        if n == 0:
            return 1
        elif n == 1:
            return 1
        else:
            memo[n] = do_dp(n - 1) + do_dp(n - 2)
            done[n] = True
            return memo[n]
    
    print(do_dp(N))

if __name__ == '__main__':
    main()


Measured memory_bytes: 5612
#include<iostream>
#include<vector>
#include<map>
using namespace std;
int main(){
    int n ;
    cin >> n;
    
    map < string  , int > mp;
    for(int i = 1 ; i<=n ; i++){
        string s;
        cin >> s;
        mp[ s ] ++;
    }

    vector<string > ord = { "AC", "WA", "TLE","RE" };
    for(auto &s: ord){
        cout<< s <<" x " << mp[s] <<"\n";
    }
}

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

class Program
{
    static void Main(string[] args) {
        int n = int.Parse(Console.ReadLine());
        Console.WriteLine(n % digitSum(n) == 0 ? "Yes" : "No");
    }
    static int digitSum(int n) {
        Stack<int> digit = new Stack<int>();
        while(n > 0) {
            digit.Push(n%10);
            n /= 10;
        }
        return digit.ToArray().Sum();
    }
}

Measured memory_bytes: 13396