akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define LL long long 
#define LLU long long unsigned
#define rarr(arr, n) for(int aab = 0; aab < n; aab++){cin >> arr[aab];}
#define parr(arr, n) for(int aab = 0; aab < n; aab++){cout << arr[aab] << " ";}
#define pb push_back
#define f first
#define s second
#define all(x) x.begin(), x.end()
#define debug(x) cout << #x << " = " << x << "\n";

#define freopen freopen("in.txt", "r", stdin);freopen("out.txt", "w", stdout);ios_base::sync_with_stdio(0);cin.tie(0);

int main(){
	long long int n, sum = 0;
	cin >> n;
    long long int arr[n + 1] = {0};
    
    for(int i = 1; i * 2 <= n; i += 1){
    	for(int j = i; j <= n; j += i){
    		arr[j]++;
    	}
    	sum += i * arr[i];
    }

    for(int i = n / 2 + 1; i <= n; i++){
    	sum += i * (arr[i] + 1);
    }

    cout << sum;
}

Measured memory_bytes: 81736
//In the Name of God
//Ya Ali

#include<bits/stdc++.h>

#define int long long

#define pb push_back

#define err(A) cout<<#A<<" = "<<(A)<<endl

using namespace std;

const int MAXN=100100;

vector<pair<int,int>> adj[MAXN] ;

int sz[MAXN] ; 

void gfs(int u , int p)
{
  // cout << u << endl ; 
  sz[u] = 1 ; 
  for(auto v : adj[u])
    {
      if(v.first==p) continue ;
      gfs(v.first,u) ; 
      sz[u] += sz[v.first] ; 
    }
}

int dp[MAXN] ; 

vector<int> v;  

void dfs(int u , int p)
{
  v.pb(dp[u]) ; 
  for(auto v : adj[u])
    {
      if(v.first==p) continue ;
      dp[v.first] = dp[u] + v.second ;
      dfs(v.first,u) ; 
    }
}

int32_t main()
{
  ios::sync_with_stdio(0);cin.tie(0);
  int n ;
  cin >> n ;
  for(int i = 1 ; i < n ; i ++ )
    {
      int x , y , z ;
      cin >> x >> y >> z ;
      adj[x].pb({y,z}) ;
      adj[y].pb({x,z}) ; 
    }
  gfs(1,-1) ;
  
  int r = 1 ;
  while(sz[r]>n/2)
    {
      
      int x = -1 ; 
      for(auto v : adj[r])
	{
	  if(sz[v.first]>n/2&&sz[v.first]<sz[r]) x = v.first ; 
	}
      if(x==-1) break ;
      r = x;  
    }
 
  dfs(r,-1) ;
  sort(v.begin(),v.end()) ;
  int ans = 0 ;
  for(auto u : v) ans += 2 * u ;
  vector<int> v2 ;
  for(auto u : adj[r]) v2.pb(u.second) ; 
  sort(v2.begin(),v2.end()) ; 

  bool f = 0 ;

  for(auto v : adj[r])
    if(sz[v.first]==n/2&&n%2==0)
      f = 1 , ans -= v.second ; 

  if(!f) ans -= v[0] + v[1] ;
  cout << ans << endl ; 
  return 0;
}


Measured memory_bytes: 14584
#include<bits/stdc++.h>
using namespace std;
long long a,b,ans=65,n;
int main()
{
    cin>>a;
    for(int s=0;s<a;s++)
    {
        cin>>b;
        n=0;
        while(b%2==0)
        {
            b=b/2;
            n++;
        }
        ans=min(ans,n);
    }
    cout<<ans<<endl;
    return 0;
}

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

struct node{
	int t,d;
}t;

int f=1,n,m,vis[200001],dis[200001];

vector<node> a[100001];

void dfs(int k){
	if(!f)return;
	for(int i=0;i<a[k].size();i++){
		if(!f)return;
		if(!vis[a[k][i].t]){
			vis[a[k][i].t]=1;
			dis[a[k][i].t]=dis[k]+a[k][i].d;
			dfs(a[k][i].t);
		}
		else if(a[k][i].d!=dis[a[k][i].t]-dis[k]){
			f=0;
			return;
		}
	}
}

int main(){
	int u,v,d,i;
	cin >> n >> m;
	for(i=1;i<=m;i++){
		cin >> u >> v >> d;
		t.t=v;
		t.d=d;
		a[u].push_back(t);
		t.t=u;
		t.d=-d;
		a[v].push_back(t);
	}
	for(i=1;i<=n;i++)
		if(!vis[i]){
			vis[i]=1;
			dfs(i);
		}
	if(f)
		cout << "Yes";
	else
		cout << "No";
	return 0;
}

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

B = [0] * N
ans = []
for i in range(N - 1, -1, -1):
    num = 0
    for j in range(2 * (i + 1), N + 1, i + 1):
        num += B[j - 1]
    if (num & 1) ^ A[i]:
        B[i] = 1
        ans.append(i + 1)

count = len(ans)
print(count)
if count > 0:
    print(' '.join(map(str, ans)))


Measured memory_bytes: 19820
#include <stdio.h>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <string>
#include <iostream>
#include <stdio.h>
#include <queue>
#include <cmath>
#include <utility>
#include <map>
#include <functional>

using namespace std;
typedef long long ll;
typedef vector<int> vecint;
#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define MAX(a,b) (a>b?a:b)
#define MIN(a,b) (a<b?a:b)




int main() {
	int i,N;
	vecint A;
	cin >> N;
	int ma = 0;
	rep(i, 0, N) {
		int t;
		cin >> t;
		A.push_back(t);
		ma = (ma > t ? ma : t);
	}
	double ma2 = ma / 2.0;
	pair<int,int>  anko = make_pair(ma,ma);
	rep(i, 0, N) {
		pair<int, int> dis;
		dis.second = abs(A[i] - ma2);
		dis.first = A[i];
		anko = (anko.second >= dis.second ? dis : anko);
	}
	cout << ma << " " << anko.first << endl;
	return 0;
}



Measured memory_bytes: 892
#pragma GCC optimize("O3")
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
using ull=unsigned long long int;
using P=pair<ll,ll>;
template<class T> using V=vector<T>; 
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
const ll inf=(1e18);
const ll mod=1000000007;
ll gcd(ll a,ll b) {return b ? gcd(b,a%b):a;}
ll lcm(ll c,ll d){return c/gcd(c,d)*d;}
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
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 (a>b) { a=b; return 1; } return 0; }
int main(){
int t;
cin>>t;
while(t--){
  string q;
  cin>>q;
  string s;
  cin>>s;
  int n=q.size(),m=s.size();
  reverse(all(q));
  for(int i=0;i<n;i++){
    string tmp={};
    if(q[i]=='J'){
      for(int j=0;j<m;j++){
        tmp.push_back(s[(j-1+m)%m]);
      }
      s=tmp;
    }
    if(q[i]=='C'){
      for(int j=0;j<m;j++){
        tmp.push_back(s[(j+1)%m]);
      }
      s=tmp;
    }
    if(q[i]=='E'){
      for(int j=(m+1)/2;j<m;j++){
        tmp.push_back(s[j]);
      }
      if(m%2==1)tmp.push_back(s[m/2]);
      for(int j=0;j<m/2;j++){
        tmp.push_back(s[j]);
      }
      s=tmp;
    }
    if(q[i]=='A'){
      reverse(all(s));
    }
    if(q[i]=='P'){
      for(int j=0;j<m;j++){
        if(int(s[j]-'0')<=10){
          s[j]=char((int(s[j]-'0')+9)%10+'0');
        }
      }
    }
     if(q[i]=='M'){
      for(int j=0;j<m;j++){
        if(int(s[j]-'0')<=10){
          s[j]=char((int(s[j]-'0')+1)%10+'0');
        }
      }
    }
  }
  cout<<s<<"\n";
}
}


Measured memory_bytes: 3224
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
const int INF = 1e9;
const int EPS = 1e-9; 
const int SEARCH_MAX = 6e3;

int main() {
  int K , N;
  cin >> K >> N;
  vector<int> A(N);
  for(int i = 0; i < N; ++i) cin >> A.at(i);
  
  int ans = K - A.at(N-1) + A.at(0);
  for (int i = 0; i < N-1; ++i) {
    ans = max(ans, A.at(i+1)-A.at(i)); 
  }
  cout << K - ans << endl;
}

Measured memory_bytes: 1024
#include <stdio.h>
   
int main(){

  int val[2] = {0};

    scanf("%d %d", &val[0], &val[1]);

    printf("%d %d %f\n", (int)(val[0] / val[1]), (val[0] % val[1]), ((double)val[0] / (double)val[1]));

  return 0;

}

Measured memory_bytes: 1064
#include <iostream>
#include <string>

using namespace std;

int main()
{
    int H,W;
    string instr;
    int cnt[26]={0};

    cin >> H >> W;

    for(int i=0; i<H; ++i) {
        cin >> instr;
        for(int j=0; j<W; ++j) {
            ++cnt[instr[j]-'a'];
        }
    }

    if(H%2==0 && W%2==0) {
        for(int i=0; i<26; ++i) {
            if(cnt[i]%4==0) continue;
            cout << "No" << endl;
            return 0;
        }
    } else if(H%2==1 && W%2==1) {
        int even=0;
        int odd=0;
        for(int i=0; i<26; ++i) {
            if(cnt[i]%4==0) continue;
            if(cnt[i]%2==0) {
                ++even;
                if(even<=(H-1)/2+(W-1)/2) continue;
            }
            ++odd;
            if(odd<=1) continue;
            cout << "No" << endl;
            return 0;
        }
    } else if(H%2==1) {
        int even=0;
        for(int i=0; i<26; ++i) {
            if(cnt[i]%4==0) continue;
            if(cnt[i]%2==0) {
                ++even;
                if(even<=W/2) continue;
            }
            cout << "No" << endl;
            return 0;
        }
    } else {
        int even=0;
        for(int i=0; i<26; ++i) {
            if(cnt[i]%4==0) continue;
            if(cnt[i]%2==0) {
                ++even;
                if(even<=H/2) continue;
            }
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int i, n;
	
	for (i = 1; i <= 9; i++){
		for (n = 1; n <= 9; n++){
			printf("%dx%d=%d\n", i, n, i * n);
		}
	}
	
	return 0;
}

Measured memory_bytes: 524
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cstring>
#include <sstream>
#include <map>
#include <set>
#include <cmath>
#include <queue>
#include <stack>
#include <list>
#include <numeric>
#include <bitset>
#include <ext/algorithm>
#include <ext/numeric>
#define ffor(_a,_f,_t) for(int _a=(_f),__t=(_t);_a<__t;_a++)
#define all(_v) (_v).begin() , (_v).end()
#define sz size()
#define pb push_back
#define SET(__set, val) memset(__set, val, sizeof(__set))
#define FOR(__i, __n) ffor (__i, 0, __n)
typedef long long LL; using namespace std;

const int MAXN = 100000 + 10;

vector<int> g[MAXN];
int n;

int compute(int v, int p) {
	int cnt = 0, w;
	FOR (i, g[v].sz)
		if (g[v][i] != p) {
			cnt++;
			w = g[v][i];
		}
	if (!cnt)
		return 0;
	int ret = 0;
	FOR (i, g[v].sz) {
		w = g[v][i];
		if (w == p)
			continue;
		ret ^= (1 + compute(w, v));
	}
	return ret;
}

int main() {
	FOR (i, MAXN)
		g[i].clear();
		
	scanf("%d", &n);
	int x, y;
	FOR (i, n - 1) {
		scanf("%d %d", &x, &y);
		g[x].pb(y);
		g[y].pb(x);
	}
	int ret = compute(1, -1);
	if (ret)
		cout << "Alice" << endl;
	else
		cout << "Bob" << endl;
	return 0;
}

Measured memory_bytes: 10368
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  
  int A[N];
  for(int i = 0; i < N; i++){
  	cin >> A[i];
  }
  
  int cnt = 0;
  int loop = 0;
  while(1){
    
    if(cnt == N){
      loop++;
      cnt = 0;
    }

	if(A[cnt] % 2 ==0){
       A[cnt] = A[cnt] / 2;
    }else{
      break;
    }
    
    cnt++;
   
  }
  
  cout << loop << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main(){
  int n;
  cin >> n;
  string s;
  cin >> s;
  int ans=0;
  rep(i,n-2){
    if(s[i]=='A'){
      if(s[i+1]=='B'){
        if(s[i+2]=='C'){
          ans++;
        }
      }
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>

using namespace std;

int main(int argc, char const *argv[]) {
  string a, b, c;
  cin >> a >> b >> c;
  if (a[a.size()-1]==b[0] && b[b.size()-1]==c[0]) cout << "YES" << endl;
  else cout << "NO" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n, m) for (int i = (int)(n); i < (int)(m); i++)
#define repr(i, n, m) for (int i = (int)(n) - 1; i >= (int)(m); i--)
using namespace std;
using ll = int64_t;
const int MOD = 1000000007; // 10^9+7

int main() {
    // https://atcoder.jp/contests/panasonic2020/tasks/panasonic2020_c

    ll a, b, c;
    cin >> a >> b >> c;
    ll d = c - a - b;
    if (d > 0L && d * d - 4L * a * b > 0L) cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 256
n = int(input())
a = list(map(int,input().split()))
box = [0]*(n+1)
def c(lst,x):
  ans = 0
  now = x
  while now <= n:
    ans += lst[now]
    now += x
  return ans

for i in range(n,0,-1):
  if c(box,i)%2 != a[i-1]:
    box[i] = 1
print(sum(box))
for i in range(1,n+1):
  if box[i] == 1:
    print(i,end=" ")

Measured memory_bytes: 7148
#pragma region template
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using vld = vector<ld>;
using vvld = vector<vld>;
using vvvld = vector<vvld>;
using vs = vector<string>;
using pll = pair<ll, ll>;
using vp = vector<pll>;
template <typename T>
using pqrev = priority_queue<T, vector<T>, greater<T>>;
#define rep(i, n) for (ll i = 0, i##_end = (n); i < i##_end; i++)
#define repb(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repr(i, a, b) for (ll i = (a), i##_end = (b); i < i##_end; i++)
#define reprb(i, a, b) for (ll i = (b)-1, i##_end = (a); i >= i##_end; i--)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((ll)(x).size())
//*
constexpr ll MOD = 1e9 + 7;
/*/
constexpr ll MOD = 998244353;
//*/
constexpr ll INF = 1e+18;
constexpr ld EPS = 1e-12L;
constexpr ld PI = 3.14159265358979323846L;
constexpr ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
constexpr ll LCM(ll a, ll b) { return a / GCD(a, b) * b; }
template <typename S, typename T>
constexpr bool chmax(S &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename S, typename T>
constexpr bool chmin(S &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
#ifdef OJ_LOCAL
#include "dump.hpp"
#else
#define dump(...) ((void)0)
#endif
template <typename T>
bool print_(const T &a) {
  cout << a;
  return true;
}
template <typename T>
bool print_(const vector<T> &vec) {
  for (auto &a : vec) {
    cout << a;
    if (&a != &vec.back()) {
      cout << " ";
    }
  }
  return false;
}
template <typename T>
bool print_(const vector<vector<T>> &vv) {
  for (auto &v : vv) {
    for (auto &a : v) {
      cout << a;
      if (&a != &v.back()) {
        cout << " ";
      }
    }
    if (&v != &vv.back()) {
      cout << "\n";
    }
  }
  return false;
}
void print() { cout << "\n"; }
template <typename Head, typename... Tail>
void print(Head &&head, Tail &&... tail) {
  bool f = print_(head);
  if (sizeof...(tail) != 0) {
    cout << (f ? " " : "\n");
  }
  print(forward<Tail>(tail)...);
}
#pragma endregion

void Pr(bool f){
  cout << (f ? "Yes" : "No") << "\n";
  exit(0);
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  string s;
  cin >> s;
  s[1] = (s[1] == 'B' ? 'R' : 'B');
  print(s);
}


Measured memory_bytes: 3644
package main

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

func sum(a ...int) int {
	ret := 0
	for _, v := range a {
		ret += v
	}
	return ret
}

func main() {
	sc.Split(bufio.ScanWords)
	a := make([][]int, 3)
	for i := range a {
		a[i] = nextInts(3)
	}
	n := nextInt()

	for i := 0; i < n; i++ {
		b := nextInt()
		for j := 0; j < 9; j++ {
			if b == a[j/3][j%3] {
				a[j/3][j%3] = 0
			}
		}
	}

	bingo := false
	for i := 0; i < 3; i++ {
		if sum(a[i][0], a[i][1], a[i][2]) == 0 {
			bingo = true
		}
	}
	for i := 0; i < 3; i++ {
		if sum(a[0][i], a[1][i], a[2][i]) == 0 {
			bingo = true
		}
	}
	if sum(a[0][0], a[1][1], a[2][2]) == 0 || sum(a[0][2], a[1][1], a[2][0]) == 0 {
		bingo = true
	}

	if bingo {
		puts("Yes")
	} else {
		puts("No")
	}
	wt.Flush()
}

var (
	sc  = bufio.NewScanner(os.Stdin)
	rdr = bufio.NewReaderSize(os.Stdin, 1000000)
	wt  = bufio.NewWriter(os.Stdout)
)

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

func nextInt() int {
	i, _ := strconv.Atoi(next())
	return i
}

func nextFloat64() float64 {
	f, _ := strconv.ParseFloat(next(), 64)
	return f
}

func nextInts(n int) []int {
	slice := make([]int, n)
	for i := 0; i < n; i++ {
		slice[i] = nextInt()
	}
	return slice
}

func nextFloat64s(n int) []float64 {
	slice := make([]float64, n)
	for i := 0; i < n; i++ {
		slice[i] = nextFloat64()
	}
	return slice
}

func nextMega() string {
	buf := make([]byte, 0, 1000000)
	for {
		l, p, _ := rdr.ReadLine()
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return string(buf)
}

func putf(format string, a ...interface{}) {
	fmt.Fprintf(wt, format, a...)
}

func puts(a ...interface{}) {
	fmt.Fprintln(wt, a...)
}


Measured memory_bytes: 640
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cctype>
 
#include <algorithm>
#include <tuple>
#include <random>
#include <bitset>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <vector>
#include <chrono>
#include <iostream>
#include <limits>
#include <numeric>
 
#define LOG(FMT...) fprintf(stderr, FMT)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

// mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
template <class T>
istream& operator>>(istream& is, vector<T>& v) {
  for (T& x : v)
    is >> x;
  return is;
}
 
template <class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
  if (!v.empty()) {
    os << v.front();
    for (int i = 1; i < v.size(); ++i)
      os << ' ' << v[i];
  }
  return os;
}

int n;

int dist(const vector<int>& a, const vector<int>& b) {
  int ret = 0;
  for (int i = 0; i < a.size(); ++i) ret += abs(a[i] - b[i]);
  return ret;
}

int calc(vector<int> a, vector<int> b) {
  if (a.size() < b.size()) swap(a, b);
  int ans = 1 << 30;
  int x = a.size() - b.size();
  vector<int> tmpb = b, tmpa = a;
  for (int rep = 0; rep < x; ++rep) b.push_back(n);
  ans = dist(a, b);
  for (int rep = 2; rep <= x; rep += 2) {
    b.pop_back(); b.pop_back();
    b.insert(b.begin(), 0); b.insert(b.begin(), 0);
    ans = min(ans, dist(a, b));
  }
  b = tmpb; a = tmpa;
  for (int rep = 0; rep < x; ++rep) b.push_back(n);
  ans = min(ans, dist(a, b));
  for (int rep = 2; rep <= n; ++rep) {
    b.push_back(n); b.push_back(n);
    a.insert(a.begin(), 0); a.insert(a.begin(), 0);
    ans = min(ans, dist(a, b));
  }
  b = tmpb; a = tmpa;
  if (x & 1) {
    ++x;
    a.push_back(n);
  }
  for (int rep = 0; rep < x; ++rep) b.insert(b.begin(), 0);
  ans = min(ans, dist(a, b));
  for (int rep = 2; rep <= n; ++rep) {
    b.insert(b.begin(), 0); b.insert(b.begin(), 0);
    a.push_back(n); a.push_back(n);
    ans = min(ans, dist(a, b));
  }
  return ans;
}

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

  string s, t;
  cin >> n >> s >> t;
  vector<int> a, b;
  for (int i = 1; i < n; ++i) if (s[i] != s[i - 1]) a.push_back(i);
  for (int i = 1; i < n; ++i) if (t[i] != t[i - 1]) b.push_back(i);
  int ans = 1 << 30;
  if (s[0] != t[0]) {
    a.insert(a.begin(), 0); ans = min(ans, calc(a, b)); a.erase(a.begin());
    b.insert(b.begin(), 0); ans = min(ans, calc(a, b)); b.erase(b.begin());
  } else ans = calc(a, b);

  cout << ans;

  return 0;
}


Measured memory_bytes: 656
fn main() {
    let s = read::<String>();
    let slen = s.len();
    for _ in 0..slen {
        print!("x");
    }
    println!("");
}

#[allow(dead_code)]
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}
#[allow(dead_code)]
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}
#[allow(dead_code)]
fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}
#[allow(dead_code)]
fn yn(result: bool) {
    if result {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 4352
class BIT():
	def __init__(self, n):
		self.n = n
		self.bit = [0]*(n+1)
	
	def getsum(self, k):
		ret = 0
		while k:
			ret += self.bit[k]
			k -= k&-k
		return ret
		
	def p_sum(self, i, j):
		return self.getsum(j)-self.getsum(i-1)
		
	def add(self, k, x):
		while k <= n:
			self.bit[k] += x
			k += k&-k

n,q = map(int,input().split())
BIT = BIT(n)
for _ in range(q):
	c,x,y = map(int,input().split())
	if c==0:
		BIT.add(x,y)
	else:
		print(BIT.p_sum(x,y))


Measured memory_bytes: 7924
#include <iostream>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <cstring>

using namespace std;
// ascending order
#define vsort(v) sort(v.begin(), v.end())
// descending order
#define vsort_r(v) sort(v.begin(), v.end(), greater<int>())
// ascending order
#define asort(array, N) sort(array, array + N)
// descending order
#define asort_r(array, N) sort(array, array + N, greater<int>())
#define vunique(v) v.erase(unique(v.begin(), v.end()), v.end())
#define mp make_pair
#define ts(x) to_string(x)
typedef long long ll;
typedef pair<int, int> P;
const ll INF = 1e18;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int c[3][3];
	for(int i = 0; i < 3; i++) {
		cin >> c[i][0] >> c[i][1] >> c[i][2];
	}
	int a[3];
	int b[3];
	for(int i = 0; i < 3; i++) {
		a[i] = 0;
		b[i] = 0;
	}
	for(int j = 0; j < 3; j++) b[j] = c[0][j];
	for(int i = 1; i < 3; i++) a[i] = c[i][1] - b[1];
	for(int i = 0; i < 3; i++) {
		for(int j = 0; j < 3; j++) {
			if(a[i] + b[j] != c[i][j]) {
				cout << "No" << endl;
				return 0;
			}
		}
	}
	cout << "Yes" << endl;
}



Measured memory_bytes: 256
loop do
  m, f, r = gets.chomp.split.map(&:to_i)
  break if m == -1 && f == -1 && r == -1
  sum = m + f
  if m == -1 || f == -1
    puts 'F'
  elsif sum >= 80
    puts 'A'
  elsif sum >= 65
    puts 'B'
  elsif sum >= 50
    puts 'C'
  elsif sum >= 30
    puts r >= 50 ? 'C' : 'D'
  else
    puts 'F'
  end
end

Measured memory_bytes: 8644
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val n = sc.nextInt()
    val a = (0 until n).map { sc.next().toLong() }
    println(problem035a(n, a))
}

fun problem035a(n: Int, a: List<Long>): String {
    val set = a.toSet()
    if (set.size == 1) {
        if (a.all { it == 0L }) {
            return "Yes"
        }
    } else if (set.size == 2) {
        val min = set.sorted()[0]
        if (min == 0L) {
            if (a.count { it ==min } * 3 == n ) {
                return "Yes"
            }
        }
    } else if (set.size == 3) {
        val list = set.toList()
        if (a.count { it == list[0]} == a.count { it == list[1] } && a.count { it == list[1] } == a.count { it == list[2] }) {
            if (list[0] xor list[1] == list[2]) {
                return "Yes"
            }
        }
    }

    return "No"
}

Measured memory_bytes: 50672
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rrep(i, n) for(int i = 1; i <= (int)(n); i++)
#define drep(i, n) for(int i = (n)-1; i >= 0; i--)
#define ALL(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;

// Mod int
const int mod = 1000000007;
// const int mod = 998244353;
struct mint {
  ll x;
  mint():x(0){}
  mint(ll x):x((x%mod+mod)%mod){}
  // mint(ll x):x(x){}
  mint& fix() { x = (x%mod+mod)%mod; return *this;}
  mint operator-() const { return mint(0) - *this;}
  mint& operator+=(const mint& a){ if((x+=a.x)>=mod) x-=mod; return *this;}
  mint& operator-=(const mint& a){ if((x+=mod-a.x)>=mod) x-=mod; return *this;}
  mint& operator*=(const mint& a){ (x*=a.x)%=mod; return *this;}
  mint operator+(const mint& a)const{ return mint(*this) += a;}
  mint operator-(const mint& a)const{ return mint(*this) -= a;}
  mint operator*(const mint& a)const{ return mint(*this) *= a;}
  bool operator<(const mint& a)const{ return x < a.x;}
  bool operator==(const mint& a)const{ return x == a.x;}
};
istream& operator>>(istream&i,mint&a){i>>a.x;return i;}
ostream& operator<<(ostream&o,const mint&a){o<<a.x;return o;}
//



int main() {
  int n, k;
  string s;
  cin >> n >> k >> s;
  int ans = 0;
  int c = 0;
  int r = 0;
  if (s[0] == '0') ++c;
  rep(l, n) {
    while (r < n && c <= k) {
      if (r+1 < n && s[r] == '1' && s[r+1] == '0') ++c;
      ++r;
    }
    ans = max(ans, r - l);
    if (l+1 < n && s[l] == '0' && s[l+1] == '1') --c;
  }
  cout << ans << endl;
}

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

void lcs(string s1,string s2)
   {
       int n=s1.length();
       int m=s2.length();
       int res[n+1][m+1];
       for(int i=0;i<=n;i++)
           res[i][0]=0;
       for(int i=0;i<=m;i++)
           res[0][i]=0;
        for(int i=1;i<=n;i++)
         {
             for(int j=1;j<=m;j++)
              {
                   if(s1[i-1]==s2[j-1])
                       res[i][j]=1+res[i-1][j-1];
                   else
                       res[i][j]=max(res[i-1][j],res[i][j-1]);
              }
         }
        string s; 
        int i1=n,i2=m;
        while(i1!=0 && i2!=0 )
          {
              if(s1[i1-1]==s2[i2-1])
                {
                    s.push_back(s1[i1-1]);   
                    i1--;
                    i2--;
                }
              else if(res[i1-1][i2]>res[i1][i2-1])
                {
                    i1--;
                }
              else
                {
                    i2--;
                }
          }
        reverse(s.begin(),s.end());
        cout<<s;
        
   }

int main()
 {
     string s1,s2;
     cin>>s1;
     cin>>s2;
     lcs(s1,s2);
     return 0;
 }

Measured memory_bytes: 35456
#include<bits/stdc++.h>
using namespace std;
#define MAX_V 500
#define INF 1<<28
typedef pair<int,int> P;
struct edge{
  int to,cap,cost,rev;
  edge(){}
  edge(int to,int cap,int cost,int rev):to(to),cap(cap),cost(cost),rev(rev){}
};

int V;
vector<edge> G[MAX_V];
int h[MAX_V];
int dist[MAX_V];
int prevv[MAX_V],preve[MAX_V];

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

int min_cost_flow(int s,int t,int f){
  int res=0;
  fill(h,h+V,0);
  while(f>0){
    priority_queue<P,vector<P>,greater<P> > que;
    fill(dist,dist+V,INF);
    dist[s]=0;
    que.push(P(0,s));
    while(!que.empty()){
      P p=que.top();que.pop();
      int v=p.second;
      if(dist[v]<p.first) continue;
      for(int i=0;i<(int)G[v].size();i++){
	edge &e=G[v][i];
	if(e.cap>0&&dist[e.to]>dist[v]+e.cost+h[v]-h[e.to]){
	  dist[e.to]=dist[v]+e.cost+h[v]-h[e.to];
	  prevv[e.to]=v;
	  preve[e.to]=i;
	  que.push(P(dist[e.to],e.to));
	}
      }
    }
    if(dist[t]==INF){
      return -1;
    }
    for(int v=0;v<V;v++) h[v]+=dist[v];

    int d=f;
    for(int v=t;v!=s;v=prevv[v]){
      d=min(d,G[prevv[v]][preve[v]].cap);
    }
    f-=d;
    res+=d*h[t];
    for(int v=t;v!=s;v=prevv[v]){
      edge &e=G[prevv[v]][preve[v]];
      e.cap-=d;
      G[v][e.rev].cap+=d;
    }
  }
  return res;
}

int main(){
  int v,e,f;
  cin>>v>>e>>f;
  for(int i=0;i<e;i++){
    int u,v,c,d;
    cin>>u>>v>>c>>d;
    add_edge(u,v,c,d);
  }
  V=v;
  cout<<min_cost_flow(0,v-1,f)<<endl;
  return 0;
}
/*
verified on 2017/04/26
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=GRL_6_B
*/

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

const int mod=1e9+7,N=1e7+5,M=5e3+5;
int n,m,ans,fac[N],inv[N],C[M][M];

signed main(){
	read(n,m);
	fac[0]=1; for(int i=1;i<=n;i++) fac[i]=1ll*fac[i-1]*i%mod;
	inv[1]=1; for(int i=2;i<=n;i++) inv[i]=1ll*(mod-mod/i)*inv[mod%i]%mod;
	for(int i=0;i<=m;i++){
		C[i][0]=1;
		for(int j=1;j<=i;j++) C[i][j]=(C[i-1][j-1]+C[i-1][j])%mod;
	}
	for(int i=1;i<=m+1;i++) for(int j=0;j<i;j++){
		int a=i-1-j,c=max(m-i,0),b=n-m;
		int cur=1ll*C[i-1][j]*fac[a+b+c]%mod*a%mod*inv[a+b]%mod;
		if(j&1) ans=(ans-cur+mod)%mod;
		else ans=(ans+cur)%mod;
	}
	write(ans);
}

Measured memory_bytes: 148496
#include <bits/stdc++.h>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int n;
int p[51];

int main(void){
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%d",&p[i]);
	}
	int diff=0;
	for(int i=0;i<n;i++){
		if((i+1)!=p[i]){
			diff++;
		}
	}
	printf("%s\n",diff<=2?"YES":"NO");
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i, k, n) for(int i = (k); i < (n); i++)
#define FORe(i, k, n) for(int i = (k); i <= (n); i++)
#define FORr(i, k, n) for(int i = (k)-1; i > (n); i--)
#define FORre(i, k, n) for(int i = (k)-1; i >= (n); i--)
#define REP(i, n) FOR(i, 0, n)
#define REPr(i, n) FORre(i, n, 0)
#define ALL(x) (x).begin(), (x).end()
#define ALLr(x) (x).rbegin(), (x).rend()
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;
using ll = long long;

const int INF = 1001001001;

int main(void){
  int n, q;
  cin >> n >> q;
  vector<tuple<int, int, int>> event;
  REP(i, n){
    int s, t, x;
    cin >> s >> t >> x;
    event.emplace_back(s-x, 1, x);
    event.emplace_back(t-x, -1, x);
  }
  REP(i, q){
    int d;
    cin >> d;
    event.emplace_back(d, 2, 0);
  }

  sort(ALL(event));
  
  int m = event.size();
  set<int> stop;
  
  REP(i, m){
    int a, b, c;
    tie(a, b, c) = event[i];
    if(b == 1) stop.insert(c);
    if(b == -1) stop.erase(c);
    if(b == 2){
      int ans = (stop.empty()) ? -1 : *stop.begin();
      cout << ans << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 19688
#include<iostream>
 using namespace std;
 int main (){
 int a;
 cin >> a;
 int b;
 cin >> b;
 int c;
 cin >> c;
 int t;
 t = 0; 
 for (int i = a; i<=b; i=i+1) {
     if (c % i == 0) {
        t=t+1;
        }
 }
 cout << t << endl;
 return 0;
 }
   
	


Measured memory_bytes: 3104
#include <stdio.h>
#include<math.h>
int main(void) {
	double s[10001],n,max,min,sum;
	int a;
	scanf("%lf",&n);
	max=-10000000000;
	min=10000000000;
	sum=0;
	for(a=0;a<n;a++){
		scanf("%lf",&s[a]);
		if(s[a]>max){max=s[a];}
		if(s[a]<min){min=s[a];}
		sum=sum+s[a];
	}
	printf("%.0lf %.0lf %.0lf\n",min,max,sum);
	return 0;
}

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

int dfs(bool** graph, int v, bool *visited, int N) {
  
  bool visit_a_vertex = false;
  bool all_visited = true;
  int ret = 0;
  
  for(int i = 0; i < N ; i++) {
    if(!visited[i]){
       all_visited = false; 
    }
  }
  if( all_visited){
     return 1;
  }
  for(int i = 0; i < N; i++) {
    
    
    if(graph[v][i] && !visited[i]) {
       visited[i] = true; 
       ret += dfs(graph,i,visited,N);
       visited[i] = false;
    }

  }

  return ret;
}

int main() {
  
  int N,M;
  cin >> N >> M;
  bool **graph = new bool*[N];
  bool *visited = new bool[N];
  
  for(int i = 0; i < N; i++) {
    graph[i] = new bool[N];
  	visited[i] = false;
  }
    
  for(int i = 0 ; i < M  ;i++) {
    unsigned s,t;
    cin >> s >> t;
    graph[s-1][t-1] = true; 
    graph[t-1][s-1] = true;
  }
  
  visited[0] = true;
  cout << dfs(graph,0,visited,N) << endl;
  
  
  return 0; 
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <stdio.h>
//#define _USE_MATH_DEFINES
#include <math.h>
#include <set>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <limits>
#include <bitset>
#include <stack>
#include <queue>
#include <ctype.h>

typedef long long int lli;
#define rep(i,s,N) for(int i=s;i<N;i++)
#define MOD 1000000007
#define more(a,b) (((a)>(b))?(a):(b))
#define less(a,b) (((a)<(b))?(a):(b))

using namespace std;


int main(void)
{
	int N, C, K; cin >> N >> C >> K;
	vector<int> T(N); rep(i, 0, N)cin >> T[i];
	sort(T.begin(), T.end());
	int ans = 0;
	int i = 0;
	while(i < N) {
		ans++;
		int start = i;
		while (i < N && T[i] - T[start] <= K && i - start < C)i++;
	}
	cout << ans << endl;


	return 0;
}

Measured memory_bytes: 640
#include<iostream>
using namespace std;
int main(){
	long long a,b,k;
  	cin>>a>>b>>k;
    if(a>k) cout<<(a-k)<<" "<<b<<endl;
    if(k>=a&&k<(a+b)) cout<<0<<" "<<a+b-k<<endl;
    if(k>=(a+b)) cout<<0<<" "<<0<<endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

//(iwi)
public class Main{

	void run(){
		Scanner sc = new Scanner(System.in);
		char[] s = sc.nextLine().toCharArray();
		int c = 0;
		int n = s.length;
		for(int i=0;i<=(n%2==1?n/2:n/2-1);i++){
			char c1 = s[i];
			char c2 = s[n-i-1];
			if(c1=='i'){
				if(c2!='i')c++;
			}
			else if(c1=='w'){
				if(c2!='w')c++;
			}
			else if(c1=='('){
				if(c2!=')')c++;
			}
			else{
				if(c2!='(')c++;
			}
		}
		System.out.println(c);
	}
	
	public static void main(String[] args) {
		new Main().run();
	}
}

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

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

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define RREP(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define RFOR(i, a, b) for (int i = (a); i >= (b); --i)
#define ALL(v) (v).begin(), (v).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
                      << " " << __FILE__ << endl;

typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vi> vvi;
typedef pair<int, int> pii;

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

    int A, B;
    cin >> A >> B;

    int ans = max(0, A-B*2);

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 896
#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<map>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())

const int MAX = 510000;
const int MOD = 1000000007;

int main(){
  ll a;cin>>a;
  string s;cin>>s;
  if(a>=3200) cout<<s<<endl;
  else cout<<"red"<<endl;


}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll L,a,b,mod;
struct Matric
{
    ll a[3][3];
    Matric(){memset(a,0,sizeof(a));}
    Matric operator*(const Matric&o)const
    {
        Matric ans;
        for(int i=0;i<3;i++)
            for(int j=0;j<3;j++)
            for(int k=0;k<3;k++)
            ans.a[i][j]=(ans.a[i][j]+a[i][k]*o.a[k][j]%mod)%mod;
        return ans;
    }
};
Matric Mqpow(Matric a,ll n)
{
    Matric ans;
    ans.a[0][0]=ans.a[1][1]=ans.a[2][2]=1;
    while(n)
    {
        if(n&1) ans=ans*a;
        a=a*a;
        n>>=1;
    }
    return ans;
}
ll qpow(ll a,ll n)
{
    ll ans=1;
    while(n)
    {
        if(n&1) ans=ans*a%mod;
        a=a*a%mod;
        n>>=1;
    }
    return ans;
}
int getlen(ll x)
{
    int ans=0;
    while(x)
    {
        x/=10;
        ans++;
    }
    return ans;
}
ll getpos(int x)
{
    ll l=1,r=L,ans=1;
    while(l<=r)
    {
        ll m=l+r>>1;
        if(getlen(a+(m-1)*b)<=x) ans=m,l=m+1;
        else r=m-1;
    }
    return ans;
}
/*
si=s(i-1)*qpow(10,i)+qi+B;
gi=g(i-1)+B;
|10i 1 1| |si-1|
|0   1 1| |gi-1|
|0   0 1| |B|
*/
int main()
{
    scanf("%lld%lld%lld%lld",&L,&a,&b,&mod);
    ll ans=a%mod,res=a%mod,now=1;
    for(int i=1;i<=18;i++)
    {
        ll p=getpos(i);
        if(p==now) continue;
        Matric A;
        A.a[0][0]=qpow(10,i);A.a[0][1]=1;A.a[0][2]=1;
        A.a[1][0]=0;A.a[1][1]=1;A.a[1][2]=1;
        A.a[2][0]=0;A.a[2][1]=0;A.a[2][2]=1;
        A=Mqpow(A,p-now);
        ans=(A.a[0][0]*ans%mod+res*A.a[0][1]%mod+b%mod*A.a[0][2]%mod)%mod;
        res=(res+b*(p-now))%mod;
        now=p;
    }
    printf("%lld\n",ans);
}


Measured memory_bytes: 256
def c_walk_on_multiplication_table():
    N = int(input())

    ans = float('inf')
    for i in range(1, int(N**0.5) + 1):
        if N % i == 0:
            ans = min(ans, (i - 1) + ((N // i) - 1))
    return ans

print(c_walk_on_multiplication_table())

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i, s, n) for (int i = (s); i < (n); ++i)
#define rrep(i, n, g) for (int i = (n)-1; i >= (g); --i)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define len(x) (int)(x).size()
#define dup(x, y) (((x) + (y)-1) / (y))
#define pb push_back
#define Field(T) vector<vector<T>>
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
  int k, x;
  cin >> k >> x;
  if (500 * k >= x)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

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

const int MAX_N = (int)(1e5 + 5);
using pp = pair<int, int>;
bool vis[MAX_N];

int k;
deque<pp> dq;

int solve() {
  fill(vis, vis + MAX_N, false);

  dq.push_front(pp(1, 1));

  while (!dq.empty()) {
    pp p = dq.front(); dq.pop_front();
    int cur = p.first; int cnt = p.second;

    if (cur == 0) return cnt;
    vis[cur] = true;

    int next = (cur + 1) % k;
    if (!vis[next]) {
      dq.push_back(pp(next, cnt + 1));
    }

    next = (cur * 10) % k;
    if (!vis[next]) {
      dq.push_front(pp(next, cnt));
    }
  }
}

int main(void) {
  // Here your code !
  scanf("%d", &k);

  int ans = solve();
  printf("%d\n", ans);

  return 0;
}


Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
int main(){
  while (1){
    int n;
    cin >> n;
    if (n == 0){
      break;
    }
    vector<string> s(n);
    for (int i = 0; i < n; i++){
      cin >> s[i];
      s[i] += '{';
    }
    vector<set<int>> E(26);
    bool ok = true;
    for (int i = 0; i < n - 1; i++){
      if (s[i] != s[i + 1]){
        int c = 0;
        while (s[i][c] == s[i + 1][c]){
          c++;
        }
        if (s[i + 1][c] == '{'){
          ok = false;
        } else if (s[i][c] != '{'){
          E[s[i][c] - 'a'].insert(s[i + 1][c] - 'a');
        }
      }
    }
    if (!ok){
      cout << "no" << endl;
    } else {
      vector<int> deg(26, 0);
      for (int i = 0; i < 26; i++){
        for (int j : E[i]){
          deg[j]++;
        }
      }
      queue<int> Q;
      for (int i = 0; i < 26; i++){
        if (deg[i] == 0){
          Q.push(i);
        }
      }
      while (!Q.empty()){
        int v = Q.front();
        Q.pop();
        for (int w : E[v]){
          deg[w]--;
          if (deg[w] == 0){
            Q.push(w);
          }
        }
      }
      for (int i = 0; i < 26; i++){
        if (deg[i] != 0){
          ok = false;
        }
      }
      if (!ok){
        cout << "no" << endl;
      } else {
        cout << "yes" << endl;
      }
    }
  }
}


Measured memory_bytes: 3132
import sys
import decimal # 10進法に変換，正確な計算

def input():
    return sys.stdin.readline().strip()

def main():
    n = int(input())
    a = list(map(int, input().split()))
    ans = "DENIED"
    for i in a:
        if i % 2 == 0:
            if i % 3 != 0 and i % 5 != 0:
                print(ans)
                return
    print("APPROVED")
    
main()

Measured memory_bytes: 5076
import java.util.*;

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

      if(S.charAt(0)==S.charAt(1) && S.charAt(1)==S.charAt(2)){
        res = "No";
      }else{
        res ="Yes";
    }
    System.out.println(res);
  }
}

Measured memory_bytes: 21588
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int i=1;
		while(true){
			int x=sc.nextInt();
			int y=sc.nextInt();
			if(x==0&&y==0)break;
			if(x<y){
				System.out.println(x+" "+y);
			}else{
				System.out.println(y+" "+x);
			}
			i++;
		}
	}
}

Measured memory_bytes: 35612
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<string>
#include<cstring>
#include<algorithm>
#include<sstream>
#include<complex>
#include<functional>
#include<vector>
#include<map>
#include<queue>
#include<deque>
#include<stack>
#include<set>

using namespace std;
#define endl '\n'
#define eb emplace_back
#define fst first
#define scd second
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define YES(n) cout << ((n) ? "YES" : "NO" ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No" ) << endl

constexpr int MOD = 1000000007;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vector<int>> vii;
typedef vector<ll> vl;

ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }

// value
int N, M;
vector<pair<ll, ll>> cards;

void solve() {

	cin >> N >> M;
	for (int i = 0; i < N; i++) {
		ll tmp;
		cin >> tmp;
		cards.eb(tmp, 1LL);
	}
	for (int i = 0; i < M; i++) {
		ll tmp1, tmp2;
		cin >> tmp1 >> tmp2;
		cards.eb(tmp2, tmp1);
	}

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

	ll ans = 0;
	int num = 0;
	for (int i = cards.size() - 1; i >= 0; i--) {
		for (int j = 0; j < cards[i].scd; j++) {
			ans += cards[i].fst;
			num++;
			if (num >= N) goto ANS;
		}
	}
ANS:
	cout << ans << endl;
	
	return;

}

int main() {

	cin.tie(0);
	ios::sync_with_stdio(false);

	solve();

	return 0;

}

Measured memory_bytes: 6596
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); ++i)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define fi first
#define se second
#define INF 1000000009
#define LLINF 1000000000000000009LL
using ll = long long;

int main(){
  string s,t;
  cin>>s>>t;
  t.pop_back();
  if(s==t)puts("Yes");
  else puts("No");
  return(0);
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
const int INF=1145141919,MOD=1e9+7;
const int64_t LINF=8931145141919364364,LMOD=998244353;
// const int dy[]={0,-1,0,1,1,-1,-1,1};
// const int dx[]={1,0,-1,0,1,1,-1,-1};

int main() {
	int n, k; cin >> n >> k;
	int cnt[n] = {};
	for(int i = 0; i < k; ++i) {
		int d; cin >> d;
		for(int j = 0; j < d; ++j) {
			int a; cin >> a;
			cnt[a - 1]++;
		}
	}
	int ans = 0;
	for(int i = 0; i < n; ++i) {
		ans += (cnt[i] == 0);
	}
	cout << ans << '\n';
	return 0;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
#define N 200005
#define mod 1000000007
ll powmod(ll a, ll b){
	ll res = 1;
	a %= mod;
	while(b) {
		if(b & 1) {
			res = res * a % mod;
		}
		b >>= 1;
		a = a * a % mod;
	}
	return res % mod;
}
ll fac[N], inv[N];
void init() {
	fac[0] = 1;
	for(int i = 1; i < N; i++) {
		fac[i] = fac[i - 1] * i % mod;
	}
	inv[N - 1] = powmod(fac[N - 1], mod - 2);
	for(int i = N - 2; i >= 0; i--) {
		inv[i] = inv[i + 1] * (i + 1) % mod;
	}
}
ll c(ll n, ll m) {
	if(m > n) {
		return 0;
	}
	if(m == 0) return 1;
	if(n < N) return fac[n] * inv[m] % mod * inv[n - m] % mod;
	//c(m,k) = m!/(k! * (m - k))= m-k+1~m/(k!)
	ll res = inv[m];
	for(int i = n - m + 1; i <= n; i++) {
		res = res * i % mod;
	}
	return res;
}
int main() {
	init();
	int n, a, b;
	scanf("%d%d%d", &n, &a, &b);
	ll res = powmod(2, n);
//	cout<<res<<endl;
	res = (res - c(n,a) + mod - c(n ,b) - 1 + mod) % mod;
	printf("%lld\n",res);
}


Measured memory_bytes: 3328
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<map>
#include<iomanip>
#include<sstream>
using namespace std;


int main() {
	long long int a, b, c, d, n, m;
	string str;
	c = 0;
	cin >> n>>a>>b;
	cout << min(a,b)<<" "<< max(a+b-n,c);
	}

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

#include <vector>
using namespace std;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define deg_to_rad(deg) (((deg) / 360) * 2 * M_PI)
#define rad_to_deg(rad) (((rad) / 2 / M_PI) * 360)

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

typedef long long ll;

int main() {
    int N;
    vector<int> arr(100000);
    cin >> N;
    rep1(x, 100 + 1) {
        rep1(y, 100 + 1) {
            rep1(z, 100 + 1) {
                int ans = x * x + y * y + z * z + x * y + y * z + z * x;
                arr[ans]++;
            }
        }
    }
    for (int i = 1; i <= N; i++) {
        cout << arr[i] << endl;
    }
    return 0;
}


Measured memory_bytes: 3744
#include<iostream>
using namespace std;
#define R(i,n) for(int i=0;i<n;i++)
int n,a=1e9,c[2][20],p[1<<18][51];main(){cin>>n;R(i,n*2)cin>>c[i/n][i%n];fill(p[1],p[1<<n],1e9);;R(B,1<<n){int o=0,d[n];R(i,n)if(~B&1<<i)d[i]=o++;R(i,n){int k=c[abs(i-n+o)%2][i];R(j,k+1)p[B|1<<i][k]=min(p[B|1<<i][k],p[B][j]+d[i]);}}R(i,51)a=min(a,p[(1<<n)-1][i]);cout<<(a>1e8?-1:a);}

Measured memory_bytes: 52480
using System;

namespace AtCoder._20200621
{
    class Alphabet
    {
        public static void Main(string[] args)
        {
            // 文字列の入力
            string s = Console.ReadLine();

            string result = char.IsUpper(char.Parse(s)) ? "A" : "a";

            Console.WriteLine(result);
        }
    }
}


Measured memory_bytes: 25880
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

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

    cout << min(b / a, c) << endl;

    return 0;
}

Measured memory_bytes: 764
#include <iostream>

using namespace std;
typedef long long lint;

void resolve()
{
    lint X;
    cin >> X;

    lint ans = (X / 500) * 1000;
    X -= (X / 500) * 500;
    ans += (X / 5) * 5;
    cout << ans << endl;
}

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


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

using namespace std;

const int INF = 1e9 + 7;

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    
    int n, x;
    cin >> n >> x;
    int ans = INF;
    for (int i = 0; i < n; ++i) {
        int c, t;
        cin >> c >> t;
        if (t <= x) ans = min(ans, c);
    }
    if (ans == INF) cout << "TLE\n";
    else cout << ans << '\n';

    return 0;
}

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

int main() {
    int n,w;
    cin >> n >> w;
    vector<int> V(n);
    vector<int> W(n);
    rep(i,n){
        cin >> V[i];
        cin >> W[i];
    }
    vector<int> dp(w+1);
    rep(i,n) rep(j,w+1){
        if (j >= W[i]){
            dp[j] = max(dp[j],dp[j-W[i]]+V[i]);
        }
    }
    cout << dp[w] << endl;
}


Measured memory_bytes: 3148
N = int(input())
ans = 0
l=[[0]*10 for _ in range(10)]
for i in range(1,N+1):
  s = str(i)
  l[int(s[0])][int(s[-1])]+=1
  
for i in range(10):
  for j in range(10):
    ans+=l[i][j]*l[j][i]
    
print(ans)

Measured memory_bytes: 3064