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






Measured memory_bytes: 24148
import java.io.*;
import java.util.*;

public class Main {

	final static long MOD = 1000000007;
	public static String[] Ws = null;
	public static int wsIndx = 0;
	public static BufferedReader in = null;
	public static void main(String[] args) throws Exception {
		solution(args);
		if(in!=null){
			in.close();
		}
	}

	public static void solution(String[] args) throws Exception{

		String S = nextString();
		String[] p = {"Sunny","Cloudy","Rainy","Sunny","Cloudy","Rainy"};
		for(int i=0;i<p.length;i++){
			if(p[i].equals(S)){
				System.out.println(p[i+1]);
				return;
			}
		}

	}
	public static String[] toStringArray(String s) {
		String[] tmp = new String[s.length()];
		char[] c = s.toCharArray();
		for (int i = 0; i < tmp.length; i++) {
			tmp[i] = String.valueOf(c[i]);
		}
		return tmp;
	}

	public static void check() throws Exception{
		if(in == null){
			in = new BufferedReader(new InputStreamReader(System.in));
		}
		if(Ws==null || Ws.length<=wsIndx){
			Ws = in.readLine().split(" ");
			wsIndx=0;
		}
	}
	public static int nextInt()throws Exception{
		check();
		return Integer.parseInt(Ws[wsIndx++]);
	}

	public static long nextLong()throws Exception{
		check();
		return Long.parseLong(Ws[wsIndx++]);
	}

	public static String nextString()throws Exception{
		check();
		return Ws[wsIndx++];
	}

	public static int[] nextInts()throws Exception{
		check();
		int[] tmp = new int[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Integer.parseInt(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static long[] nextLongs()throws Exception{
		check();
		long[] tmp = new long[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Long.parseLong(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static String[] nextStrings()throws Exception{
		check();
		wsIndx=Ws.length;
		return Ws;
	}


}


Measured memory_bytes: 20692
// {{{ Template for Competitive Programming
// -std=c++14 -Wall -g -fsanitize=undefined -D_GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;

#define int long long
#define FOR(i, a, b)  for (int(i) = (a); (i) < (b); ++(i))
#define CFOR(i, a, b) for (int(i) = (a); (i) <= (b); ++(i))
#define RFOR(i, a, b) for (int(i) = (a); (i) >= (b); --(i))
#define rep(i, n) FOR((i), 0, (n))
#define crep(i, n) CFOR((i), 0, (n))
#define rrep(i, n) RFOR((i), (n), 0)
#define ALL(x) (x).begin(), (x).end()
#define SUM(x) accumulate(ALL(x), 0)

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

const int INF = 1'010'000'000'000'000'017LL;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

using vint = vector<int>;
using pint = pair<int, int>;
// }}}

signed main() {
	int a, b, c;
	cin >> a >> b >> c;
	if (c - (a - b) >= 0) cout << c - (a - b) << endl;
	else cout << 0 << endl;
}



Measured memory_bytes: 256
# include <bits/stdc++.h>
#pragma GCC optimize("Ofast")

# define pb push_back
# define fr first
# define sc second
# define mk make_pair

using namespace std;

const long long linf = 1e18 + 7;
const int inf = 1e9 + 7;
const int N = 1e6 + 5;

typedef long long ll;

int x;

int main(){
      cin >> x;

      if(x % 10 == 9 || (x / 10) == 9)
            puts("Yes");
      else
            puts("No");
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
int main(){ 
    long long int n,m;
    cin>>n>>m;
    long long int a;
    if(n==1&&m==1){
        cout<<1;
    }else if(n==1||m==1){
        cout<<n*m-2;
    }else if(n==2||m==2){
        cout<<0;
    }else{
        a=(n-2)*(m-2);
        cout<<a;
    }
    return 0;
}



Measured memory_bytes: 256
import scala.io.StdIn._
object Main extends App {
  val Array(h, w) = readLine.trim.split(' ').map(_.toInt)
  val map = Array.fill(h){readLine.trim.toCharArray}
  val buildings = (0 until w).flatMap{x ⇒ (0 until h).collect{
    case y if map(y)(x) == 'B' ⇒ Coordinate(x, y)
  }}.toArray.sortBy(c ⇒ c.x + c.y)
  val building2 = buildings.sortBy(c ⇒ c.x - c.y)
  println(
    math.max(buildings.head.manhattanDistance(buildings.last), building2.head.manhattanDistance(building2.last))
  )
}

case class Coordinate(x: Int, y: Int) {
  def manhattanDistance(that: Coordinate): Int = math.abs(x - that.x) + math.abs(y - that.y)
}


Measured memory_bytes: 44504
#include<stdio.h>
#define MAX 2000000
#define INFTY (1<<30)

int h, a[MAX+1];

void maxHeapify(int i){
	int l, r, largest, tmp;
	l = 2 * i;
	r = 2 * i + 1;
	
	if(l <= h && a[l] > a[i]){
		largest = l;
	} else {
		largest = i;
	}
	
	if(r <= h && a[r] > a[largest]){
		largest = r;
	}
	
	if(largest != i){
		tmp = a[i];
		a[i] = a[largest];
		a[largest] = tmp;
		maxHeapify(largest);
	}
}

int extract(){
	int max;
	
	if(h < 1){
		return -INFTY;
	}
	
	max = a[1];
	a[1]= a[h--];
	maxHeapify(1);
	return max;
}

void increaseKey(int i, int key){
	int tmp;
	
	if(key < a[i]){
		return;
	}
	a[i] = key;
	while(i > 1 && a[i/2] < a[i]){
		tmp = a[i];
		a[i] = a[i/2];
		a[i/2] = tmp;
		i = i / 2;
	}
}

void insert(int key){
	h++;
	a[h] = -INFTY;
	increaseKey(h, key);
}

int main(){
	int key;
	char com[10];
	
	while(1){
		scanf("%s", com);
		if(com[0] == 'e' && com[1] == 'n'){
			break;
		}
		if(com[0] == 'i'){
			scanf("%d", &key);
			insert(key);
		} else {
			printf("%d\n", extract());
		}
	}
	return 0;
}
	


Measured memory_bytes: 5756
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i,n) for(int i=n; i>-1; --i)
#define ALL(a) (a).begin(),(a).end()
#define INIT(a,n,x); REP(i,(n)){ (a)[i]=(x); }
#define CINA(a,n); REP(i,(n)){ cin >> (a)[i]; }
#define INIT2(a,n,m,x); REP(i,(n)){ REP(j,(m)){(a)[i][j]=(x);} }
#define CINA2(a,n,m); REP(i,(n)){ REP(j,(m)){cin >> (a)[i][j];} }
#define Liny "Yes\n"
#define Linn "No\n"
#define LINY "YES\n"
#define LINN "NO\n"

#define umap unordered_map
//cout << setfill('0') << right << setw(4) << 12; // "0012"
int keta(ll x){ if(x<10){return 1;} else{return keta(x/10) + 1;}}
int keta_wa(ll x){ if(x<10){return x;} else{return keta_wa(x/10) + x%10;} }
int ctoi(char c){ return ( (c>='0' && c<='9')? c - '0': 0 );}
ll sum(ll a[],ll N){ return accumulate(a,a+N,0LL);}
ll gcd(ll a,ll b){if(a<b)swap(a,b); return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){if(a<b){swap(a,b);} return a/gcd(a,b)*b;}

int main(){
  // floor(X * 1.08) = N
  ld N; cin >> N;
  ld X = ceil(N/1.08);
  if(floor(X*1.08)==N){ cout << X;}
  else{ cout << ":("; }
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <algorithm>
#include <iomanip>
#include <string.h>

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()

typedef long long lint;

using namespace std;

int main(){
  int n;
  cin>>n;
  int a[n];
  REP(i,n)cin>>a[i];
  int m=*max_element(a,a+n);
  int ans=-1;
  double d=m-ans;
  REP(i,n){
    if(a[i]==m)continue;
    double temp=abs((double)m/2.0 - (double) a[i]);
    if(temp<d){
      d=temp;
      ans=a[i];
    }
  }
  cout<<m<<" "<<ans<<endl;
  return 0;
}


Measured memory_bytes: 768
#include <stdio.h>

int n[4];

void printstr (char op1, char op2, char op3) {
	printf ("%d%c%d%c%d%c%d=7\n",n[0],op1,n[1],op2,n[2],op3,n[3]);
}


int main () {
	char str[5];
	scanf ("%s", str);
	for (int i=0; i<4; i++)
		n[i] = (int)(str[i] - '0');

	if (n[0]+n[1]+n[2]+n[3]==7)
		printstr('+','+','+');
	else if (n[0]+n[1]+n[2]-n[3]==7)
		printstr ('+','+','-');
	else if (n[0]+n[1]-n[2]+n[3]==7)
		printstr ('+','-','+');
	else if (n[0]+n[1]-n[2]-n[3]==7)
		printstr ('+','-','-');
	else if (n[0]-n[1]+n[2]+n[3]==7)
		printstr ('-','+','+');
	else if (n[0]-n[1]+n[2]-n[3]==7)
		printstr ('-','+','-');
	else if (n[0]-n[1]-n[2]+n[3]==7)
		printstr ('-','-','+');
	else if (n[0]-n[1]-n[2]-n[3]==7)
		printstr ('-','-','-');
	return 0;
}


Measured memory_bytes: 128
Ai, Ao, At, Aj, Al, As, Az = map(int, input().split())

ans = Ao + 2*(Ai//2 + Aj//2 + Al//2)
if Ai>0 and Aj>0 and Al>0:
  ans = max(ans, Ao + 2*((Ai-1)//2 + (Aj-1)//2 + (Al-1)//2) + 3)
  
print(ans)


Measured memory_bytes: 2940
#include <stdio.h>

#define REP(i,n) for(int i = 0; i < (n); i++)
#define RREP(i,n) for(int i = (n) - 1; i >= 0; i--)
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define RFOR(i,b,a) for(int i = (b) - 1; i >= (a); i--)
#define STRS(i,str) for(int i = 0; (str)[i]; i++)

int main(){
	int n, a;
	int count = 0;
	scanf("%d", &n);
	REP(i, n){
		scanf("%d", &a);
		int b = 0, c = a;
		for(;;){
			if(b == c) break;
			else if((b + c + 1)/2 > a/((b + c + 1)/2)) c = (b + c - 1)/2;
			else b = (b + c + 1)/2;
		}
		FOR(j, 2, b + 1) if(a % j == 0) goto TGGX;
		count++;
TGGX:;
	}
	printf("%d\n", count);
}

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

using namespace std;


bool e[7368792];

int main() {
  while (true) {
    int m, n;
    cin >> m >> n;
    if (m + n == 0) {
      break;
    }

    memset(e, false, sizeof(e));
    int count = 0;
    for (int i = m; count < n; i++) {
      if (!e[i]) {
        count++;
      } else {
        continue;
      }
      for (int j = 1; i * j < 7368792; j++) {
        e[i * j] = true;
      }
    }

    for (int i = m + 1; ; i++) {
      if (!e[i]) {
        cout << i << endl;
        break;
      }
    }
  }

  return 0;
}

Measured memory_bytes: 10288
#include <iostream>
#include <math.h>
#include <stdio.h>
using namespace std;

 
    
    
int main()
{
   int k,a,b,c,s,t=0;
   cin>>k;
   for ( a= 1;a < (k+1); a++)
   {
     for ( b = 1; b < (k+1); b++)
     {
       for ( c= 1; c< (k+1); c++)
       {
         for ( int i = 1; (i<a+1)&&(i<b+1)&&(i<c+1); i++)
         {
           if ((a%i==0)&&(b%i==0)&&(c%i==0))
           {
             s=i;
           }
           
         }
         t=t+s;
       }
       
     }
     
   }
   cout<<t<<endl;
    return 0;
}

Measured memory_bytes: 3608
from sys import stdin,stdout
d={}
for _ in range(int(stdin.readline())):
    #n=int(stdin.readline())
    s=input()
    d[s]=d.get(s,0)+1
print('AC x',d.get('AC',0))
print('WA x',d.get('WA',0))
print('TLE x',d.get('TLE',0))
print('RE x',d.get('RE',0))

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

typedef long long ll;

const int MAXN = 50;
const int MOD = 1e9 + 7;

struct matrix{

	ll mat[MAXN][MAXN];

	matrix(int idd = 0){
		for(int i = 0;i<MAXN;i++){
			for(int j = 0;j<MAXN;j++){
				mat[i][j] = (idd) ? (i == j) : (0);
			}
		}
	}

	matrix operator*(const matrix& other)const{
		matrix ans;
		for(int i = 0;i<MAXN;i++){
			for(int j = 0;j<MAXN;j++){
				for(int k = 0;k<MAXN;k++){
					ans.mat[i][j] += mat[i][k]*other.mat[k][j];
					if(ans.mat[i][j] > MOD) ans.mat[i][j] %= MOD;
				}
			}
		}
		return ans;
	}

};

matrix exponentiation(matrix base, ll K){

	matrix ans(1);

	for(int i = 0;(1LL << i) <= K;i++){
		if((1LL << i) & K) ans = ans*base;
		base = base*base;
	}

	return ans;

}

int main(){

	matrix base;
	int N;
	ll K;
	cin >> N >> K;
	for(int i = 0;i<N;i++){
		for(int j = 0;j<N;j++) cin >> base.mat[i][j];
	}

	matrix ans = exponentiation(base,K);
	ll paths = 0;
	for(int i = 0;i<N;i++){
		for(int j = 0;j<N;j++){
			paths = (paths + ans.mat[i][j]) % MOD;
		}
	}

	cout << paths << endl;

	return 0;

}

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

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

    int h,w;
    char chars[2] = { '#', '.' };
    while(cin >> h >> w){
        if(h == 0 && w == 0)
            return 0;

        int row_switch = 0;
        int char_switch = 0;
        for (int row = 0; row < h; row++ ){
            char_switch = row_switch;

            for(int col = 0; col < w; col++ ){
                cout << chars[char_switch];
                char_switch = (char_switch + 1) % 2;
            }
            cout << endl;
            row_switch = (row_switch + 1) % 2;
        }

        cout << endl;
    }

    return 0;
}

Measured memory_bytes: 3116
#include <iostream>
#include <algorithm>
#include <set>
#include <string>
#include <vector>
#include <cmath>

int main(void){
    int a, b, c, d;

    std::cin >> a >> b >> c >> d;

    int box1,box2;
    if(a > b){
        box1 = b;
    }
    else{
        box1 = a;
    }
    if(c > d){
        box2 = d;
    }
    else{
        box2 = c;
    }

    std::cout << box1 + box2;
    return 0;
}


Measured memory_bytes: 888
#include <iostream>
#include <vector>
 
using namespace std;
 
int main(){
	int N, X;
	cin >> N >> X;
	vector<int> L(N);
	for(int i = 0; i < N; i++)
		cin >> L[i];
	
	int i;
	int d = 0;
	for(i = 0; i < N; i++){
		d = d + L[i];
		if(d > X)
			break;
	}
 
	cout << i+1 << endl;
}

Measured memory_bytes: 256
#include<cstdio> 
#include<cstring>
#include<algorithm>
#include<iostream>
#include<cmath>
#include<map>
#include<queue>
#include<set>
#define ms(i, j) memset(i, j, sizeof i)
#define LL long long
#define db double
#define fir first
#define sec second
#define mp make_pair
using namespace std;

namespace flyinthesky {

	const LL MO = 1e9 + 7;

	int n, tax[30];
	char s[100000 + 5];

    void clean() {
    }
    int solve() {
    	
    	clean();
    	cin >> n;
    	scanf("%s", s + 1);
    	LL ans = 0;
    	for (int i = n; i; --i) {
    		LL tmp = 1;
    		for (int j = 0; j < 26; ++j) if (j != s[i] - 'a') tmp = tmp * 1ll * (tax[j] + 1) % MO;
    		tax[s[i] - 'a']++;
			(ans += tmp) %= MO;
		}
		cout << ans;
    	
        return 0;
    }  
}
int main() {
    flyinthesky::solve();
    return 0;
}
/*
*/

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

typedef long long LL;
typedef unsigned long long LONG;
const int N = 1e5 + 5;
const int INF = 0x3f3f3f3f;
const int MAXINT = 2147483647;
const int mod = 1000000007;
const long long MAXLONG = 9223372036854775807;
const LL INT32 = (LL(MAXINT) + 1) * 2;
using namespace std;
typedef pair<int, int> PII;
#define ft fisrt
#define sd second
#define eb emplace_back
#define END '\n'

template <class T>
inline bool Read(T &ret)
{
    char c;
    int sgn;
    if (static_cast<void>(c = getchar()), c == EOF)
        return 0;
    while (c != '-' && (c < '0' || c > '9'))
        c = getchar();
    sgn = (c == '-') ? -1 : 1;
    ret = (c == '-') ? 0 : (c - '0');
    while (static_cast<void>(c = getchar()), c >= '0' && c <= '9')
        ret = ret * 10 + (c - '0');
    ret *= sgn;
    return 1;
}

template <class T>
inline void Write(T x)
{
    if (x < 0)
        putchar('-'), Write(x);
    if (x > 9)
        Write(x / 10);
    putchar(x % 10 + '0');
}
LL a[N * 2], b[N * 2];
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    LL n, m, k;
    cin >> n >> m >> k;
    for (int i = 1; i <= n; ++i)
    {
        cin >> a[i];
        a[i] += a[i - 1];
    }
    for (int i = 1; i <= m; ++i)
    {
        cin >> b[i];
        b[i] += b[i - 1];
    }
    LL ans = 0, cur = m;
    for (LL i = 0; i <= n; ++i)
    {
        if (a[i] > k)
            break;
        while (b[cur] > (k - a[i]))
        {
            cur--;
        }
        ans = max(ans, i + cur);
    }
    cout << ans << endl;
    //system("pause");
    return 0;
}

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

int main() {
    long long h, w;
    cin >> h >> w;

    long long ans = h * w / 2 + (h * w % 2);

    if (h == 1LL || w == 1LL) cout << 1 << endl;
    else cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N; cin >> N;
  int ans = 0;
  vector<int>p(N);
  for (int i=0; i<N; i++) cin >> p[i];
  sort(p.begin(), p.end());
  for (int i=0; i<N-1; i++){
    ans += p[i];
  }
  ans += p[N-1]/2;
  cout << ans << endl;
}

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

using namespace std;


int main(){
	int n,k,q,a;
	cin>>n>>k>>q;
	vector<int>v(n,k);
	for(int i=0; i<q; i++){
		cin>>a;
		v[a-1]++;
	}
	for(int i=0; i<n; i++){
		v[i]-=q;
		if(v[i]>0){
			cout<<"Yes"<<endl;
		}else{
			cout<<"No"<<endl;
		}
	}
	return 0;
}

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

int main()
{
	int d, n;

	cin >> d >> n;

	int ret = 0;
	if (d == 0) {
		if (n != 100) {
			ret = n;
		}
		else {
			ret = 101;
		}
	}
	else if (d == 1) {
		if (n != 100) {
			ret = n * 100;
		}
		else {
			ret = 10100;
		}
	}
	else if (d == 2) {
		if (n != 100) {
			ret = n * 10000;
		}
		else {
			ret = 1010000;
		}
	}

	cout << ret << endl;

	return 0;
}

Measured memory_bytes: 256
using System;
using System.Linq;

namespace ABC131_B
{
    class Program
    {
        static void Main(string[] args)
        {
            var NL = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var N = NL[0];
            var L = NL[1];
            var ans = N + L < 0 ? -1 * (N + L - 1) : L <= 0 ? 0 : -1 * L;

            Console.WriteLine(Enumerable.Range(L, N).Sum() - Enumerable.Range(L, N).OrderBy(Math.Abs).First());
        }
    }
}


Measured memory_bytes: 13396
#include<bits/stdc++.h>
using namespace std;
typedef long long llint;
typedef long double ld;

#define inf 1e18
#define mod 1000000007
priority_queue<llint,vector<llint>,greater<llint> > que;
priority_queue<llint> Que;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


string s;
void solve(){
  cin >> s;
  int ans=0;
  for(char c:s){
    if(c=='2')ans++;
  }
  cout << ans << endl;
}

int main(){
  solve();
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define pii_ pair<int,int>
#define mp_ make_pair
#define pb push_back
#define fi first
#define se second
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define show1(a) cout<<#a<<" = "<<a<<endl
#define show2(a,b) cout<<#a<<" = "<<a<<"; "<<#b<<" = "<<b<<endl
using namespace std;
const ll INF = 1LL<<60;
const int inf = 1<<30;
const int maxn = 2e5+5;
inline void fastio() {ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);}

int n;

set<int> U[maxn],D[maxn],L[maxn],R[maxn];
set<int> RU1[maxn<<1],LD1[maxn<<1],LU1[maxn<<1],RD1[maxn<<1];
set<int> RU2[maxn<<1],LD2[maxn<<1],LU2[maxn<<1],RD2[maxn<<1];
int main()
{
    fastio();
    cin>>n; int x,y; char d;
    int base = 200000;
    ll ans = INF;
    rep(i,1,n){
        cin>>x>>y>>d;
        if(d=='U'){
            U[x].insert(y);
            RU1[y-x+base].insert(y);
            LU1[x+y].insert(y);
        }else if(d=='D'){
            D[x].insert(y);
            RD1[y+x].insert(y);
            LD1[y-x+base].insert(y);
        }else if(d=='L'){
            L[y].insert(x);
            LU2[x+y].insert(y);
            LD2[y-x+base].insert(y);
        }else{
            R[y].insert(x);
            RU2[y-x+base].insert(y);
            RD2[y+x].insert(y);
        }
    }
    rep(i,0,200000){
        for(int x:U[i]){
            auto it = D[i].upper_bound(x);
            if(it!=D[i].end()){
                int y = *it;
                ans = min(ans,5LL*(y-x));
            }else break;
        }
        for(int x:R[i]){
            auto it = L[i].upper_bound(x);
            if(it!=L[i].end()){
                int y = *it;
                ans = min(ans,5LL*(y-x));
            }else break;
        }
    }
    rep(i,0,400000){
        for(int x:RU1[i]){
            auto it = LD2[i].upper_bound(x);
            if(it!=LD2[i].end()){
                int y = *it;
                ans = min(ans,10LL*(y-x));
            }else break;
        }
        for(int x:RU2[i]){
            auto it = LD1[i].upper_bound(x);
            if(it!=LD1[i].end()){
                int y = *it;
                ans = min(ans,10LL*(y-x));
            }else break;
        }
        for(int x:LU1[i]){
            auto it = RD2[i].upper_bound(x);
            if(it!=RD2[i].end()){
                int y = *it;
                ans = min(ans,10LL*(y-x));
            }else break;
        }
        for(int x:LU2[i]){
            auto it = RD1[i].upper_bound(x);
            if(it!=RD1[i].end()){
                int y = *it;
                ans = min(ans,10LL*(y-x));
            }else break;
        }
    }
    if(ans!=INF)cout<<ans<<endl;
    else cout<<"SAFE"<<endl;
    return 0;
}


Measured memory_bytes: 219276
def main():
    n,k = map(int, input().split())
    i = []
    nn = []
    for d in range(n):
        nn.append(0)

    for kk in range(k):
        kn = int(input())
        s = list(map(int,input().strip().split()))
        for kk in range(kn):
            nn[s[kk] - 1] += 1
    
    c = 0
    for ni in nn:
        if ni == 0:
            c += 1
    
    print(c)
    return 

main()


Measured memory_bytes: 9092
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1000000007;
#define INF 1LL<<30
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()

// nCr mod を計算する O(n)
const int MAX_N = 1000010;
ll fac[MAX_N], finv[MAX_N], inv[MAX_N];
// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX_N; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

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

    COMinit();
    sort(all(a));
    ll maxX=0;
    for(int i=k-1;i<n;i++){
        ll tmp=COM(i,k-1);
        tmp=(tmp*a[i]);
        maxX=(maxX+tmp)%MOD;
    }
    reverse(all(a));
    for(int i=k-1;i<n;i++){
        ll tmp=COM(i,k-1);
        tmp=(tmp*a[i]);
        maxX=(maxX-tmp)%MOD;
    }

    cout<<maxX<<endl;
}


Measured memory_bytes: 27524
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main(){
    int n;
    cin>>n;
    vector<pair<ll,ll>> a(n);
    for(int i=0;i<n;i++){
        ll val;
        cin>>val;
        a[i].second = val;
        cin>>val;
        a[i].first = val;
    }
    sort(a.begin(),a.end());
    ll cnt = 0;
    for(int i=0;i<n;i++){
        cnt += a[i].second;
        if(cnt>a[i].first)
        {
            cout<<"No"<<'\n';
            return 0;
        }
    }
    cout<<"Yes"<<'\n';
    return 0;
}


Measured memory_bytes: 3328
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
#include <queue>
#include <set>
#include <cmath>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)

using namespace std;
typedef long long int lli;
const int MOD=1e9+7;
const int MAX=1e5;

int pow2(int k){
	if(k==0)return 1;
	return (pow2(k-1)*2)%MOD;
}

int main(){
	int N;
	cin>>N;
	int A[MAX];
	rep(i,N)cin>>A[i];
	sort(A,A+N);
	int ans=0;
	if(N%2==0){
		bool pos=true;
		rep(i,N)if(A[i]!=i+(i+1)%2)pos=false;
		if(pos)ans=pow2(N/2);
	}
	else{
		bool pos=true;
		rep(i,N)if(A[i]!=i+i%2)pos=false;
		if(pos)ans=pow2(N/2);
	}
	cout<<ans;
}

Measured memory_bytes: 1408
/**
 *    created by : PawPaw       
**/

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

using namespace __gnu_pbds;  
using namespace std;

typedef tree<int, null_type, less<int>, rb_tree_tag,  
        tree_order_statistics_node_update>  
        ordered_set;  

#define F(i,a,b) for(int i = (int)(a); i <= (int)(b); i++)
#define RF(i,a,b) for(int i = (int)(a); i >= (int)(b); i--)
#define LL long long
#define PHI acos(-1)
#define EPS 0.000000001
#define N 1000001
#define MOD 1000000007
#define PB push_back
#define MP make_pair
#define FbO find_by_order
#define OoK order_of_key

int solve(){
  int m[3][3], lim = 0, add;
  bool flag = true;

  F(i, 0, 2){
    F(j, 0, 2){
      cin >> m[i][j];
      if(i == 0) lim = max(lim, m[i][j]);
    }
  }

  F(j, 0, 2){
    add = lim - m[0][j];
    F(i, 0, 2){
      m[i][j] += add;
    }
  }

  F(i, 0, 2){
    F(j, 0, 2){
      if(m[i][j] != m[i][1]) flag = false;
    }
  }

  if(flag) cout << "Yes\n";
  else cout << "No\n";

  return 0;
}

void fun(){
  int t = 1;
  // cin >> t;
  while(t--) solve();
} 

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

Measured memory_bytes: 256
import bisect as bs
a, b, q = map(int, input().split())
INF = 10**18
s = [-INF] + sorted([int(input()) for _ in range(a)]) + [INF]
t = [-INF] + sorted([int(input()) for _ in range(b)]) + [INF]

for _ in range(q):
    z = int(input())
    x, y = bs.bisect_right(s, z), bs.bisect_right(t, z)
    s1, s2, t1, t2 = s[x-1], s[x], t[y-1], t[y]
    print(min(max(z - s1, z - t1), max(s2 - z, t2 - z),
    min(2 * t2 - z - s1, 2 * s2 - z - t1), min(z + t2 - 2 * s1, z + s2 - 2 * t1)))

Measured memory_bytes: 12784
#include <bits/stdc++.h>
#define REP(i, n) for (long long i = 0; i < (long long)n; i++)
//#define _GLIBCXX_DEBUG
using namespace std;
using ll = long long;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
using Vl = vector<ll>;
using vi = vector<int>;
using Graph = vector<vi>;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  // std::cout << std::fixed << std::setprecision(15); //"for float-base
  // problem"
  string S;
  cin >> S;
  for (int t = 0; t < S.size(); t++) {
    if (S.at(t) == '?') S.at(t) = 'D';
  }
  cout << S << endl;
}

Measured memory_bytes: 3772
n = int(input())

opens = [list(map(int, input().split())) for _ in range(n)]

score = [list(map(int, input().split())) for _ in range(n)]

INF = 1e100
ans = -1 * INF
for i in range(2**10):
    ch = [0] * 10
    cnt = 0
    for j in range(10):
        if (i >> j) & 1:
            ch[j] = 1
            cnt += 1
    if not cnt:
        continue
    total = 0
    for k in range(n):
        ct = 0
        for l in range(10):
            if opens[k][l] and ch[l]:
                ct += 1
        total += score[k][ct]
    ans = max(ans, total)

print(ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>  
using namespace std;  
typedef long long LL;  
const int maxn=1e5+10;  
int n,a[maxn];  
bool check()  
{  
    LL s=0;  
    for (int i=1;i<=n;i++) s+=a[i];  
    s*=2;  
    if (s%((LL)n*(n+1))!=0) return 0;  
    s/=n;s/=(n+1);  
    for (int i=1;i<n;i++)  
    {  
        LL s1=a[i]-a[i+1]+s;  
        if (s1<0||s1%n!=0) return 0;  
    }  
    LL s1=a[n]-a[1]+s;  
    if (s1<0||s1%n!=0) return 0;  
    return 1;  
}  
int main()  
{  
    cin>>n;  
    for (int i=1;i<=n;i++) scanf("%I64d",&a[i]);  
    if (check()) printf("YES");  
    else printf("NO");  
    return 0;  
}  

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

// syntax sugar: `for (int i = 0; i < N; ++i)`
#define rep(i, N) for (int i = 0; i < (int)(N); ++i)
// syntax sugar: `for (int i = 0; i < N; ++i)`
#define REP(type, name, beginValue, endCondValue) \
  for (type name = beginValue; name < endCondValue; ++name)
// syntax sugar: 多次元vector
#define VECTOR_DIM3(T, name, d1, d2, d3, initValue) \
    std::vector<std::vector<std::vector<T>>> name(d1, std::vector<std::vector<T>>(d2, std::vector<int>(d3, initValue)));
#define VECTOR_DIM2(T, name, d1, d2, initValue) \
    std::vector<std::vector<T>> name(d1, std::vector<T>(d2, initValue));
#define VECTOR_DIM1(T, name, d1, initValue) \
    std::vector<T> name(d1, initValue);
#define ll long long
#define ld long double


// ABC059C - Sequence
int main(){
  int n; // 2 <= n <= 1e5
  cin >> n;
  vector<int64_t> a(n+10, 0);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }

  // a_1を与えられた正負のどちらかの符号に決めて、
  // 残りを計算する
  ll sum1 = 0, sum2 = 0;
  ll ans1 = 0, ans2 = 0;
  rep(i, n) {
    sum1 += a[i];
    sum2 += a[i];
    if (i % 2 == 0) {
      if (sum1 <= 0) {
        ans1 += 1 - sum1;
        sum1 = 1;
      }
      if (sum2 >= 0) {
        ans2 += sum2 - (-1);
        sum2 = -1;
      }
    } else {
      if (sum1 >= 0) {
        ans1 += sum1 - (-1);
        sum1 = -1;
      }
      if (sum2 <= 0) {
        ans2 += 1 - sum2;
        sum2 = 1;
      }

    }
  }

  cout << min(ans1, ans2) << endl;
  return 0;
}



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

const ll MOD = pow(10, 9) + 7;
const int A = 0;
const int C = 1;
const int G = 2;
const int T = 3;

ll cache[100][4][4][4];

/**
 * AGC
 * GAC
 * ACG
 * A?GC
 * AG?C
 */
ll calc(int remain, int c1, int c2, int c3) {
    if (remain == 0) {
        return 1;
    }
    if (cache[remain][c1][c2][c3] > 0) {
        return cache[remain][c1][c2][c3];
    }

    //CG それぞれ利用可能なときtrue
    bool fc, fg;
    fc = fg = true;
    if (c2 == A && c3 == G || c2 == G && c3 == A) {
        fc = false;
    } else if (c2 == A && c3 == C) {
        fg = false;
    } else if (c1 == A && c3 == G || c1 == A && c2 == G) {
        fc = false;
    }
    ll ret = 0;
    ret = (ret + calc(remain - 1, c2, c3, A)) % MOD;
    if (fc) {
        ret = (ret + calc(remain - 1, c2, c3, C)) % MOD;
    }
    if (fg) {
        ret = (ret + calc(remain - 1, c2, c3, G)) % MOD;
    }
    ret = (ret + calc(remain - 1, c2, c3, T)) % MOD;
    cache[remain][c1][c2][c3] = ret;
    return ret;
}

int main()
{
    int N;
    cin >> N;
    int ans = calc(N, T, T, T);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);

		while (true) {
			int w = sc.nextInt();
			int h = sc.nextInt();

			if(w==0&&h==0)break;
			// boolean[][] map=new boolean[h][w];
			// boolean[][] flag=new boolean[h][w];
			Masu[][] map = new Masu[h][w];

			for (int i = 0; i < h; i++) {
				for (int j = 0; j < w; j++)
					map[i][j] = new Masu(sc.nextInt() == 1 ? true : false, j, i);
			}

			for (int i = 0; i < h; i++) {
				for (int j = 0; j < w; j++) {
					if (i + 1 < h && map[i + 1][j].flag)
						map[i][j].list.add(map[i + 1][j]);
					if (j + 1 < w && map[i][j + 1].flag)
						map[i][j].list.add(map[i][j + 1]);
					if (i - 1 >= 0 && map[i - 1][j].flag)
						map[i][j].list.add(map[i - 1][j]);
					if (j - 1 >= 0 && map[i][j - 1].flag)
						map[i][j].list.add(map[i][j - 1]);
					if (i + 1 < h && j + 1 < w && map[i + 1][j + 1].flag)
						map[i][j].list.add(map[i + 1][j + 1]);
					if (i - 1 >= 0 && j - 1 >= 0 && map[i - 1][j - 1].flag)
						map[i][j].list.add(map[i - 1][j - 1]);
					if (i + 1 < h && j - 1 >= 0 && map[i + 1][j - 1].flag)
						map[i][j].list.add(map[i + 1][j - 1]);
					if (i - 1 >= 0 && j + 1 < w && map[i - 1][j + 1].flag)
						map[i][j].list.add(map[i - 1][j + 1]);
				}
			}

			int count = 0;

			for (int i = 0; i < h; i++) {
				for (int j = 0; j < w; j++) {
					if (map[i][j].flag && !map[i][j].sw){
						map[i][j].search();
						count++;
					}
				}
			}

			System.out.println(count);
		}
	}

}

class Masu {
	boolean flag;
	int ww;
	int hh;
	boolean sw;
	ArrayList<Masu> list = new ArrayList<Masu>();

	public Masu(boolean flag, int ww, int hh) {
		this.flag = flag;
		this.ww = ww;
		this.hh = hh;
		this.sw = false;

	}

	public void search() {
		sw = true;
		while (true) {
			if (list.isEmpty())
				return;
			Masu sub = list.remove(0);
			if (!sub.sw)
				sub.search();
		}

	}

}

Measured memory_bytes: 46808
#include <bits/stdc++.h>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
using namespace std; 
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define FORD(i,a,b) for(int i=(a);i>=(b);i--)
inline bool EQ(double a, double b) { return fabs(a-b) < 1e-9; }
const int INF = 1<<29;
typedef long long int ll;
inline int two(int n) { return 1 << n; }
inline int test(int n, int b) { return (n>>b)&1; }
inline void set_bit(int & n, int b) { n |= two(b); }
inline void unset_bit(int & n, int b) { n &= ~two(b); }
inline int last_bit(int n) { return n & (-n); }
inline int ones(int n) { int res = 0; while(n && ++res) n-=n&(-n); return res; }
template<class T> void chmax(T & a, const T & b) { a = max(a, b); }
template<class T> void chmin(T & a, const T & b) { a = min(a, b); }
const int MOD=1000000007;

bool isPowerOfTwo (ll x)  
{  
    return x && (!(x&(x-1)));  
}
bool isPrime(int n) 
{ 
    if (n <= 1)  return false; 
    if (n <= 3)  return true; 
    if (n%2 == 0 || n%3 == 0) return false; 
  
    for (int i=5; i*i<=n; i=i+6) 
        if (n%i == 0 || n%(i+2) == 0) 
           return false; 
  
    return true; 
}
int highestPowerof2(unsigned int n) 
{ 
    // Invalid input 
    if (n < 1) 
        return 0; 
  
    int res = 1;
    for (int i=0; i<8*sizeof(unsigned int); i++) 
    { 
        int curr = 1 << i; 
        if (curr > n) 
           break; 
  
        res = curr; 
    } 
  
    return res; 
} 
long long binpow(long long a, long long b) {
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}
const int dx[] = {1,0,-1,0,1,1,-1,-1};
const int dy[] = {0,-1,0,1,1,-1,-1,1};
/*lcm(gcd(N1, M), gcd(N2, M), ..., gcd(Nk, M)) = gcd(lcm(N1, ..., Nk), M)
gcd(lcm(N1, M), lcm(N2, M), ..., lcm(Nk, M)) = lcm(gcd(N1, ..., Nk), M).

If gcd(N1, N2) = 1, then
gcd(N1·N2, M) = gcd(N1, M)·gcd(N2, M)
lcm(N1·N2, M) = lcm(N1, M)·lcm(N2, M)/M.

lcm(M, N, P) · gcd(M, N) · gcd(N, P) · gcd(P, M) = NMP · gcd(N, M, P).
*/
////////////////////////////////////////////////////////////////////

int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);  
  cout.tie(NULL);
  ll t=1;
  while(t--)
  {
    int k,s;
    cin>>k>>s;
    ll ans=0;
    for(int x=0;x<=k;x++)
    {
        for(int y=0;y<=k;y++)
        {
            int z=s-x-y;
            if(z>=0 && z<=k)
            ans++;
        }
    }
    cout<<ans;
  }  
  return 0;
}
/* Look for:
* the exact constraints (multiple sets are too slow for n=10^6 :( )
* special cases (n=1?)
* 1LL<<i and not 1<<i
* overflow (int vs ll?)
* array bounds
* if you have no idea just guess the appropriate well-known algo instead of doing nothing :/
*/

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <string.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i, n) for(int i = 1; i <= (int)(n); i++)
const long long INF = 1LL << 60;
const double PI=3.14159265358979323846;
#define M 1046527
#define NIL (-1)
#define L 14

char H[M][L];

int getChar(char ch){
        if (ch == 'A') return 1;
        else if(ch == 'G') return 2;
        else if (ch == 'C') return 3;
        else if(ch == 'T') return 4;
        else return 0;
}

long long getkey(char str[]){
    long long p=1,sum=0, i;
       for(i=0; i<strlen(str);i++){
           sum += p*getChar(str[i]);
            p *=5;
        }
    return sum;
}
    
int h1(int key){ return key % M;}
int h2(int key){return 1 + ( key % (M-1));}

int find(char str[]){
    long long key, i,h;
    key = getkey(str);
    for(i=0;;i++){
        h= (h1(key) + i*h2(key))%M;
        if(strcmp(H[h],str) == 0) return 1;
        else if(strlen(H[h]) == 0)return 0;
    }
    return 0;
}
int insert(char str[]){
    long long key, i, h;
    key = getkey(str);
        for(i=0;;i++){
            h = (h1(key) + i*h2(key))%M;
            if(strcmp(H[h],str) == 0)return 1;
            else if(strlen(H[h]) == 0){
                strcpy(H[h],str);
                return 0;
            }
        }
    return 0;
}

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

    char com[9], str[L];
    rep(i,n){
        cin >> com >> str;
        if(com[0] == 'i'){
            insert(str);
        }
        else{
            if(find(str))cout << "yes" << endl;
            else
            {
               cout << "no" << endl;
            }
            
        }
    }

    
}


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

int main() {
  int N;
  int a[100010];
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> a[i];
  }

  int min = abs(a[0]);
  int minus_count = 0;
  long sum_abs = 0;
  for(int i = 0; i < N; i++) {
    sum_abs += abs(a[i]);
    if (min > abs(a[i])) {
      min = abs(a[i]);
    }
    if(a[i] < 0) {
      minus_count++;
    }
  }

  if (minus_count % 2 == 1) {
    sum_abs -= 2 * min;
  }
  cout << sum_abs << endl;

  return 0;
}



Measured memory_bytes: 640
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <utility>
#include <vector>
#define MOD 1000000007
using namespace std;
typedef long long ll;

int main() {
  int n;
  string s;
  map<string, int> m;
  cin >> n;
  m.insert({"AC", 0});
  m.insert({"WA", 0});
  m.insert({"TLE", 0});
  m.insert({"RE", 0});
  for (int i = 0; i < n; i++) {
    cin >> s;
    m[s]++;
  }
  cout << "AC x " << m["AC"] << endl;
  cout << "WA x " << m["WA"] << endl;
  cout << "TLE x " << m["TLE"] << endl;
  cout << "RE x " << m["RE"] << endl;
}

Measured memory_bytes: 3628
use proconio::input;
use std::collections::HashMap;

fn main() {
  input! {
    n: u64,
    a: [u64; n]
  };
  
  let mut counts: HashMap<u64, u64> = HashMap::new();
  
  for x in a {
    if let Some(&count) = counts.get(&x) {
      counts.insert(x, count+1);
    } else {
      counts.insert(x, 1);
    }
  }
  
  let mut elim = 0;
  for (&x, &count) in &counts {
    let mut min = count;
    if count >= x && min > count - x {
      min = count - x;
    }
    elim += min;
  }
  
  println!("{}", elim);
}

Measured memory_bytes: 7088
import bisect
import copy
import heapq
import math
import sys
from collections import *
from itertools import accumulate, combinations, permutations, product
from math import gcd
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

n,m=map(int,input().split())
ab=[list(map(int,input().split())) for i in range(m)]

dic=defaultdict(list)
for i in range(m):
    a,b=ab[i]
    dic[a-1].append(b-1)
    dic[b-1].append(a-1)

itta=[-1]*n

d=deque([0])
while d:
    tmp=d.popleft()
    for i in range(len(dic[tmp])):
        if itta[dic[tmp][i]]==-1:
            itta[dic[tmp][i]]=tmp
            d.append(dic[tmp][i])

# print(itta)
print("Yes")
for i in range(1,n):
    print(itta[i]+1)

Measured memory_bytes: 124196
#include<bits/stdc++.h>
using namespace std;
int main()
{
   long long int  n,i,s=0;
    cin>>n;
    for(i=1;i<=n;i++)
    {
        if(i % 3!=0 && i % 5!=0)
        {
            s=s+i;
        }
    }cout<<s;
}


Measured memory_bytes: 3644
#include <stdio.h>
#include <string.h>

#define N_MAX 5001

int main(void){
  int i, j, k;

  int n;
  scanf("%d", &n);

  char s[N_MAX];
  scanf(" %s", s);

  int len_max = 0;
  for(i = 0; i < n-len_max*2; i++){
    for(j = i+len_max+1; j < n-len_max; j++){
      for(k = 0; ; k++){
        if(i+k >= j || j+k >= n) break;
        if(s[i+k] != s[j+k]) break;
      }
      if(k > len_max) len_max = k;
    }
  }

  printf("%d\n", len_max);

  return 0;
}


Measured memory_bytes: 128
#pragma warning(disable: 4996)
#include <iostream>
#include <unordered_map>
#include <functional>
#include <cstdio>
#include <algorithm>
#include <vector>
using namespace std;

int main(void) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	double N, odds = 0;
	double ans = 0;
	cin >> N;

	for (int i = 1; i <= N; i++){
		if (i % 2 == 1) odds++;
	}

	cout << odds / N  << endl;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdint>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int, int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define irep(it, stl) for (auto it = stl.begin(); it != stl.end(); it++)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define mes(a) cout << (a) << endl
#define dmes(a, b) cout << (a) << " " << (b) << endl
#define re0 return 0
#define mp(p, q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define rSort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int;
int dx[8] = { 1, 0, -1, 0, 1, -1, -1, 1 };
int dy[8] = { 0, 1, 0, -1, 1, 1, -1, -1 };
template <class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template <class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
struct io { io() { ios::sync_with_stdio(false); cin.tie(0); } };
const int INF = INT_MAX;
const ll LLINF = 1LL << 60;
const ll MOD = 1000000007;
const double EPS = 1e-9;

signed main(void) 
{
    ll n, m;
    cin >> n >> m;
    if (abs(n-m) >= 2) {
        mes(0);
        re0;
    }
    
    ll r = 0;
    
    ll nf = 1;
    rrep(i, n) {
        nf *= i;
        nf %= MOD;
    }
    ll mf = 1;
    rrep(i, m) {
        mf *= i;
        mf %= MOD;
    }
    
    r = nf * mf;
    r %= MOD;
    if (n == m) {
        r *= 2;
        r %= MOD;
    }
    
    mes(r);
    
    
   
    
}


Measured memory_bytes: 3604
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        
        int a = sc.nextInt();
        int b = sc.nextInt();
        
        int res = 0;
        
        loop: for(int i = a; i <= b; i++){
            String s = String.valueOf(i);
            
            for(int j = 0; j < s.length(); j++){
                if(s.charAt(j) != s.charAt(s.length()-1-j)){
                    continue loop;
                }
            }
            res++;
        }
        System.out.println(res);
    }
}


Measured memory_bytes: 28496
#include<iostream>
#include<string.h>
#include<algorithm>
using namespace std;
int n;
struct A{
	int x;
	int y;
};
A a[100010];
bool cmp(A s,A d){
	return s.x<d.x;
}
int main(){
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a[i].x;
		a[i].y=i;
	}
	sort(a+1,a+n+1,cmp);
	for(int i=1;i<=n;i++){
		if(i!=1)cout<<' ';
		cout<<a[i].y;
	}
} 

Measured memory_bytes: 1536
#include <stdio.h>
int main(void){
	int W,H,x,y,r,X1,X2,Y1,Y2;
	scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);
	X1=x-r;
	X2=x+r;
	Y1=y-r;
	Y2=y+r;
	if(X1>=0 && X2<=W && Y1>=0 && Y2<=H){
		printf("Yes\n");
	}
	else{
		printf("No\n");
	}
	return 0 ;
}

Measured memory_bytes: 584
#include <bits/stdc++.h>
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    int x; cin >> x;
    cout << fixed << setprecision(20) << (x / 3.0) * (x / 3.0) * (x / 3.0) << '\n';

}

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

bool compare(int a,int b){
  return a<b;//ascending
} 

int32_t main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);


    int n,x,t;
    cin>>n>>x>>t;
    int naya=0;
    int count=0;
    while(naya<n){
      naya+=x;
      count++;
    }
    cout<<t*count<<endl;

  return 0;
}

Measured memory_bytes: 3608
void repeat(char c, int n) {
    for (; n; n--) putchar(c);
}

int main() {
    for (;;) {
        int h, w;
        scanf("%d %d", &h, &w);
        if (h == 0) return 0;

        for (; h; h--) {
            repeat('#', w);
            putchar('\n');
        }
        putchar('\n');
    }
}



Measured memory_bytes: 2112
#include <bits/stdc++.h>
#define mem(i,a) memset(i,a,sizeof(i))
#define PI acos(-1.0)
#define DMAX 100000+5
#define MOD 998244353
#define eps 1e-8
#define mp make_pair
#define pb push_back
#define INF 1000000000+9
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
inline void read(int &f){
	f=0;
    ll x=1;
    char ch=getchar();
    while(ch<48 || ch>57) {
        if(ch=='-') {
            x=-1;
        }
        ch=getchar();
    }
    while(ch<=57 && ch>=48) {
        f=f*10+ch-'0';
        ch=getchar();
    }
    f*=x;
}
int n;
int main(){
    read(n);
    int p=n/200;
    switch(p){
        case 2:cout<<8<<endl; break;
        case 3:cout<<7<<endl; break;
        case 4:cout<<6<<endl; break;
        case 5:cout<<5<<endl; break;
        case 6:cout<<4<<endl; break;
        case 7:cout<<3<<endl; break;
        case 8:cout<<2<<endl; break;
        case 9:cout<<1<<endl; break;
    }   
    return 0;
}


Measured memory_bytes: 3672