akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>
#include<iostream>
#include<set>
#include<algorithm>
#include<cstring>
using namespace std;
int c[10000];
int color[10000];
int h,w;
int n;
int flag;
int colorput[101][101];




int main(){
while(cin>>h>>w){
        memset(color,0,sizeof(color));
        memset(colorput,0,sizeof(colorput));
        int n;
cin>>n;
for(int i=0;i<n;i++){
    cin>>c[i];
}
int flag=0;
for(int i=0;i<n;i++){
    for(int j=0;j<c[i];j++){
        color[flag++]=i+1;
    }
}
/*for(int i=0;i<flag;i++){
    cout<<color[i];
}*/
//cout<<endl;


      int tot=colorput[0][w-1]=1;
      int x=0,y=w-1;

while(tot<w*h){

    while(x+1<h&&colorput[x+1][y]==0)colorput[++x][y]=++tot;
     while(y-1>=0&&colorput[x][y-1]==0)colorput[x][--y]=++tot;
      while(x-1>=0&&colorput[x-1][y]==0)colorput[--x][y]=++tot;
       while(y+1<w&&colorput[x][y+1]==0)colorput[x][++y]=++tot;
}
for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
        if(!j)cout<<color[colorput[i][j]-1];
        else printf(" %d",color[colorput[i][j]-1]);

}
cout<<endl;

}


}

return 0;
}


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

public class Main {
    static long mod = (int)Math.pow(10,9)+7;
	public static void main(String[] args) throws IOException {
		FastScanner sc = new FastScanner(System.in);
		PrintWriter pw = new PrintWriter(System.out);
		char[] s = sc.next().toCharArray();
		StringBuilder sb = new StringBuilder();
		for(char c : s){
		    char cc = c;
		    if(cc == '?'){
		        cc = 'D';
		    }
		    sb.append(cc);
		}
		pw.println(sb.toString());
		pw.close();
	}
}

class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;
    public FastScanner(InputStream in) {
        reader = new BufferedReader(new InputStreamReader(in));
        tokenizer = null;
    }

    public String next() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public String nextLine() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                return reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken("\n");
    }

    public long nextLong() {
        return Long.parseLong(next());
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    public double nextDouble() {
         return Double.parseDouble(next());
    }

    public int[] nextIntArray(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++)
            a[i] = nextInt();
        return a;
    }

    public long[] nextLongArray(int n) {
        long[] a = new long[n];
        for (int i = 0; i < n; i++)
            a[i] = nextLong();
        return a;
    } 
}



Measured memory_bytes: 31656
#include <iostream>
#include <cstring>
#include <map>
using namespace std;
const int MAXN=1e3+5;
int n,p,q,fa[MAXN],d[MAXN];
int w[MAXN][2],dp[MAXN][MAXN],vis[MAXN];
int find(int x) {
    if(fa[x]==x) return fa[x];
    int root=find(fa[x]);
    d[x]=(d[x]+d[fa[x]])%2;
    return fa[x]=root;
}
void work(int x,int y,int k) {
    int rx=find(x),ry=find(y);
    if(rx!=ry) {
        fa[ry]=rx;
        d[ry]=(d[x]-d[y]+2+k)%2;
    }
}
int main() {
    while(cin>>n>>p>>q&&n+p+q) {
        for(int i=1;i<=p+q;i++) fa[i]=i;
        memset(d,0,sizeof(d));
        memset(w,0,sizeof(w));
        memset(vis,-1,sizeof(vis));
        memset(dp,0,sizeof(dp));
        for(int i=1;i<=n;i++) {
            int x,y; char ch[10];
            cin>>x>>y>>ch;
            if(ch[0]=='y') work(x,y,0);
            else work(x,y,1);
        }
        map<int,int> mp;
        int cnt=0;
        for(int i=1;i<=p+q;i++) {
            int rx=find(i);
            if(!mp.count(rx)) mp[rx]=++cnt;
            w[mp[rx]][d[i]]++;
        }
        dp[0][0]=1;
        for(int i=1;i<=cnt;i++) {
            for(int j=0;j<=p;j++) {
                if(w[i][0]<=j) dp[i][j]+=dp[i-1][j-w[i][0]];
                if(w[i][1]<=j) dp[i][j]+=dp[i-1][j-w[i][1]];
            }
        }
        if(dp[cnt][p]==1) {
            int x=cnt,y=p;
            while(x!=0&&y!=0) {
                if(dp[x][y]==dp[x-1][y-w[x][0]]) {
                    vis[x]=0;
                    y-=w[x][0];
                }
                else if(dp[x][y]==dp[x-1][y-w[x][1]]) {
                    vis[x]=1;
                    y-=w[x][1];
                }
                x--;
            }
            for(int i=1;i<=p+q;i++) {
                int id=mp[fa[i]];
                if(vis[id]==d[i]) printf("%d\n",i);
            }
            puts("end");
        }
        else puts("no");
    }
}


Measured memory_bytes: 7108
import java.util.*;

public class Main {
    public static void main(String[] args) {
        try (Scanner s = new Scanner(System.in)) {
            long n = s.nextLong();
            StringBuilder sb = new StringBuilder();
            
            while (n > 0) {
                n--;
                long r = n % 26;
                n = n / 26;
                sb.append((char)('a' + r));
            }
            System.out.println(sb.reverse().toString());
        }
    }
}


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

using namespace std;
int n;
int a[55];
int main()
{
    scanf("%d",&n);
    int res=0;
    for(int i=1;i<=n;i++)
    {
        scanf("%d",&a[i]);
        if(a[i]!=i) res++;
    }
    if(res==0||res==2)
        printf("YES\n");
    else
        printf("NO\n");
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
  int A,N;
  cin >> N;
  int student[N];
  for (int i=0;i<N;i++){
    cin >> A;
    student[A-1]=i+1;
  }
  for(int i=0;i<N;i++)cout << student[i] << " ";
}

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

int main(){
    ll n; cin >> n;
    ll dp[n+1][n+1];
    ll a[n+1];
    roop(i, 1, n+1) cin >> a[i - 1] >> a[i];

    roop(i, 1, n+1) dp[i][i] = 0;
    roop(l, 2, n+1){
        roop(i, 1, n-l+2){
            ll j = i + l - 1;
            dp[i][j] = INT_MAX;
            roop(k, i, j) dp[i][j] = min(dp[i][j], dp[i][k] + dp[k+1][j] + a[i-1]*a[k]*a[j]);
        }
    }
    cout << dp[1][n] << endl;

    return 0;
}


Measured memory_bytes: 3164
#define FNAME ""

#include <bits/stdc++.h>

#define hash padjf9srpi
#define y0 sdkfaslhagaklsldk
#define y1 aasdfasdfasdf
#define yn askfhwqriuperikldjk
#define j1 assdgsdgasghsf
#define tm sdfjahlfasfh
#define lr asgasgash
#define pb push_back
#define mp make_pair
#define forn(i, n) for (int i = 0; i < (n); i++)
#define fornr(i, n) for (int i = (n) - 1; i >= 0; i--)
#define forab(i, a, b) for (int i = (a); i < (b); i++)
#define gcd __gcd
#define all(a) (a).begin(), (a).end()
 
#ifdef _WIN32
    #define I64 "%I64d"
#else
    #define I64 "%lld"
#endif

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair <int, int> pii;                                                                                                                                                                                      
typedef vector <int> vi;

template <class T> T sqr(const T &a) {return a * a;}

char s[1000];

int main()
{
#ifdef LOCAL
    freopen(FNAME".in", "r", stdin);
    freopen(FNAME".out", "w", stdout);
#endif
scanf("%s", s);
    forn(i, 4)
    	printf("%c", s[i]);
    printf(" " );
    forn(i, 8)
    	printf("%c", s[i + 4]);
	puts("");
}



Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>



void swap (int *x, int *y) {
  int temp;

  temp = *x;
  *x = *y;
  *y = temp;

  return;
}


int gcd(int a, int b){
  int c;

  while (b > 0){
    c = a % b;
    a = b;
    b = c;
  }

  return a;
}

/* クイックソート */
int dn(const void*a,const void*b){return*(int*)b-*(int*)a;}


long int modpow(long int a,long int n,long int mod){
  long int ans=1;
  while(n>0){
    if(n & 1){
      ans=ans*a%mod;
    }
    a=a*a%mod;
    n/=2;
  }
  return ans;
}

long int modinv(long int a,long int mod){
  return modpow(a,mod-2,mod);
}

int max(int a,int b){
  if(a<b){
    return b;
  }
  else{
    return a;
  }
}

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

void chmax(int *a,int b){
  if(*a < b){
    *a = b;
  }

  return;
}

void chmin(int *a,int b){
  if(*a > b){
    *a =b;
  }

  return;
}

/****************************************\
| Thank you for viewing my code:)        |
| Written by RedSpica a.k.a. RanseMirage |
| Twitter:@asakaakasaka                  | 
\****************************************/

int main(void){
  /*
  全ての1<=i<j<=nについてgcd(A[i],A[j])=1なら当然全体のgcdも1になります

  よって，まず全体のgcdが1かそれ以外かを見て，"non coprime"であるケースを排除します

  次に，"pairwise coprime"かどうかを判定します．Aの最大値をmとおくと，
  2<=d<=mを満たす各dに対して，A[i]%d=0となるiの数が1個以下である必要があります．

  なぜかというと，i!=jでA[i]%d=0,A[j]%d=0となるような(i,j,d)の組み合わせがあったとすると，
  gcd(A[i],A[j])>=dになるのは定義より明らかだからです．

  これを純粋に実装すればよいです．

  フローチャートとしては

  ・全体のgcdは1か
  NO:non coprime->return
  YES:続く

  ・i!=jでgcd(A[i],A[j])>1となるペアが存在するか
  YES:setwise coprime->return
  NO:pairwise coprime

  計算量がO(n*m)くらいになりそうな感じがしますが，下のような実装をすることで
  O(m*log(m))まで抑えることができ，十分高速です


  コードの下になぜ計算量がこうなるのかの解説があるので，アルゴリズムが理解できて
  興味があったら読んでください．
  */

  int n;
  scanf("%d",&n);
  
  //どう頑張ってもA[i]<2e6なのでmをこれで設定する
  int m=2e6;
  int A[m];
  //初期化
  for(int i=0;i<m;i++){
    A[i]=0;
  }

  //全体のgcd
  int g=0;

  /*
  A[i]<=1e6なので
  A[i]:=i番目の要素の値
  ではなく
  A[i]:=iが何個現れるか
  という配列の使い方をする
  */

  for(int i=0;i<n;i++){
    int a;
    scanf("%d",&a);
    A[a]++;

    //ついでに全体のgcdを取る
    //gcdの単位元は0なので，gの初期化はg=0
    g=gcd(g,a);
  }

  //まずnot primeである可能性を消す
  if(g!=1){
    printf("not coprime\n");
    
    return 0;
  }

  /*
  Aの中のdの倍数の個数は
  A[d]+A[2*d]+A[3*d]+...
  で取得できる
  */
  for(int d=2;d<m;d++){
    int cnt=0;
    for(int i=d;i<m;i+=d){
      cnt+=A[i];
    }

    if(cnt>1){
      printf("setwise coprime\n");

      return 0;
    }
  }

  printf("pairwise coprime\n");

  return 0;
}

/*
～計算量がO(m*log(m))になるワケ～

上にも書いたように
  Aの中のdの倍数の個数は
  A[d]+A[2*d]+A[3*d]+...
  で取得できる
ので，
d=2:A[2]+A[4]+A[6]+...->O(m/2)
d=3:A[3]+A[6]+A[9]+...->O(m/3)
d=4:A[4]+A[8]+A[12]+...->O(m/4)
d=5:A[5]+A[10]+A[15]+...->O(m/5)
...

となるので最終的な計算量は
 (m/2)+(m/3)+(m/4)+(m/5)+...
=m*H_m
となる(ただし，H_nはnまでの調和級数)

一般的に，H_n>=log(n)であり，H_nの増加オーダーは高々log(n)であることがわかるので
このアルゴリズム全体の計算量はO(m*log(m))となります．
*/

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

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<vvd> vvvd;
typedef pair<int, int> pii;
typedef vector<pii> vpii;

#define LL long long;
#define REP(i,s,N) for (int i=s; i<N; i++)

int main() {
	vector<string> pixel(100);
	int H, W;
	cin >> H >> W;

	REP(i, 0, H) {
		cin >> pixel[i];
	}
	REP(i, 0, H) {
		cout << pixel[i] << endl;
		cout << pixel[i] << endl;
	}
}

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

using namespace std;

int main(){
  string s, t;
  cin >> s >> t;
  
  sort(s.begin(), s.end());
  sort(t.begin(), t.end(), greater<char>());

  if (s<t) printf("Yes\n");
  else printf("No\n");
  return 0;
}

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

using namespace std;

void c()
{
    string abcd;
    cin >> abcd;
    int a = abcd[0] - '0';
    int b = abcd[1] - '0';
    int c = abcd[2] - '0';
    int d = abcd[3] - '0';
    vector<int> target = {a, b, c, d};
    vector<int> operations = {0,0,0,1,1,1};
    do{
        int total = target[0];
        for(int i = 0; i < 3; i++)
        {
            if(operations[i] == 0)
            {
                total += target[i + 1];
            }else{
                total -= target[i + 1];
            }
        }
        if(total == 7)
        {
            string result;
            char op1 = operations[0] == 0 ? '+' : '-';
            char op2 = operations[1] == 0 ? '+' : '-';
            char op3 = operations[2] == 0 ? '+' : '-';
            cout << target[0] << op1 << target[1]<< op2 << target[2] << op3 << target[3] << "=7" << endl;
            return;
        }
    }while (next_permutation(operations.begin(), operations.end()));
    return;
}

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
    
using namespace std;
    
#define endl "\n"
#define ll unsigned long long
#define int long long int
#define vi vector <int >
#define vii vector < pii >
#define vll vector <ll >
#define pii pair <int, int>
#define pdd pair< double, double>
#define piii pair < pii, int > 
#define pll pair<ll, ll >
#define umap unordered_map
#define pb push_back
#define pq priority_queue
#define forn(i, n) for(int i = 0; i < (int)n; i++)
#define rep(i,b,c) for(int i = (int)b; i < (int)c; i++)
#define double long double
#define a first
#define b second

int32_t main(){
    ios::sync_with_stdio(0),cin.tie(0);	
    int h, ans = 0;
    cin >> h;
    int i = 1;
    while(h > 1){
        ans += i;
        h /= 2;
        i = i << 1;
    }
    cout << ans + i << endl;

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>
#include <math.h>

#define SENTINEL 1000000000000000000

void merge(long long A[], long long left, long long mid, long long right){
  long long n1, n2, i, j, k;
  long long *L,*R;
  
  n1 = mid-left;
  n2 = right-mid;
  
  L = (long long*)malloc(sizeof(long long) *(n1 + 1));
  R = (long long*)malloc(sizeof(long long) *(n2 + 1));
  
  for(i = 0; i <= n1 - 1; i++){
    L[i] = A[left + i];
  }
  for(j = 0; j <= n2 - 1; j++){
    R[j] = A[mid + j];
  }
  
  L[n1] = SENTINEL;
  R[n2] = SENTINEL;
  
  i = 0;
  j = 0;
  
  for(k = left; k <= right - 1; k++){
   if(L[i] <= R[j]){
      A[k] = L[i];
      i++;
    }
    else{
      A[k] = R[j];
      j++;
    }
  }
  free(L);
  free(R);
}

void mergeSort(long long A[], long long left, long long right){
  long long mid;
  
  if(left + 1 < right){
    mid=(left + right)/2;
    mergeSort(A, left, mid);
    mergeSort(A, mid, right);
    merge(A, left, mid, right);
  }
}

int main(void){

    int N;

    scanf("%d", &N);

    long long s[N];

    int t = 0;
    long long sum = 0;

    for(int i = 0; i < N; i++){
        scanf("%lld", &s[i]);
        if(s[i] % 10 != 0){
            t = 1;
        }
        sum += s[i];
    }

    mergeSort(s, 0, N);

    if(t == 0){
        printf("0\n");
    }else if(sum % 10 != 0){
        printf("%lld\n", sum);
    }else{
        for(int i = 0; i < N; i++){
            if((sum - s[i]) % 10 != 0){
                printf("%lld\n", sum - s[i]);
                break;
            }
        }
    }

    return 0;
}

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

#include <bits/stdc++.h>

using namespace std;

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "


// CHECK THE LIMITS
typedef long long ll;

const int MOD = 1000000007;
const ll INFLL = 1e18;
const int INF = 1e9;
const int NMAX = 1000001;

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

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

	string s;
	int q;

	deque<char> res;

	

	
	cin >> s >> q;

	for(int i =0; i< s.length(); ++i)
	{
		res.push_back(s[i]);
	}
	int curr = 0;
	while(q--)
	{
		int c;
		cin >> c;
		if(c == 1)
		{
			curr^=1;
		}
		else
		{
			int tip;
			char car;
			cin >> tip >> car;
			if(curr == 0 && tip == 1)
			{
				res.push_front(car);
			}
			else if(curr == 0 && tip == 2)
			{
				res.push_back(car);
			}
			else if(curr == 1 && tip == 1)
			{
				res.push_back(car);
			}
			else
			{
				res.push_front(car);
			}
			
			
		}
	}
	if(curr == 0)
	{
		for(int i= 0; i< res.size(); ++i)
		{
			cout << res[i];
		}
	}
	else
	{

		for(int i = res.size() - 1; i>=0; --i)
		{
			cout << res[i];
		}
	}
	
	
    return 0;
}

Measured memory_bytes: 976
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <bitset>
#include <list>
#include <stdexcept>
#include <functional>
#include <utility>
#include <ctime>
#include <random>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;;
#define MEM(a,b) memset((a),(b),sizeof(a))
const LL INF = 1e9 + 7;
const int N = 3e2 + 10;

int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	int n, k;
	cin >> n >> k;
	int ans = 0;
	while (n--)
	{
		int x;
		cin >> x;
		ans += min(x, k - x) * 2;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
#include<iomanip>
#define mod 1000000007
#define int long long int
bool palindrome(string str)
{
	int i,l=str.size();
	for(i=0;i<l/2;i++)
	{
		if(str[i]!=str[l-i-1])
		   return false;
	}
	return true;
	
}
int32_t main()
{
     double l;
     cin>>l;
     double a=l/3.0;
     l=l-a;
     double b=l/2.0;
     l=l-b;
     double c=l;
     double answer=(a*b*c);
     printf("%.10f\n",answer);
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<map>
using namespace std;
const int N=20;
typedef long long ll;
map<pair<int,int>,int>sum;
ll ans[N];
int n,m;
void Paint(int x,int y){
    for(int i=-1;i<=1;i++)
        for(int j=-1;j<=1;j++){
            int a=x+i,b=y+j;
            if(a<=1||b<=1||a>=n||b>=m)
                continue ;
            int p=sum[make_pair(a,b)];
            sum[make_pair(a,b)]++;
            ans[p]--;
            ans[p+1]++;
        }
}
int main()
{
    int k;
    scanf("%d%d%d",&n,&m,&k);
    ans[0]=1ll*(n-2)*(m-2);
    for(int i=1;i<=k;i++){
        int u,v;
        scanf("%d%d",&u,&v);
        Paint(u,v);
    }
    for(int i=0;i<=9;i++)
        printf("%lld\n",ans[i]);
}


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

// Template START
#define endl "\n"
#define async ios_base::sync_with_stdio(false); cin.tie(NULL);
#define int long long int
#define all(y) y.begin(), y.end()
#define present( x, y ) (x.find( y ) != x.end())
const int mod = (int)1e9 + 7 ;
template<class T>
auto matrix( int r, int c, T v ){
    return vector<vector<T>>( r, vector<T>( c, v ) ) ;
}
template<class T>
auto matrix( int o1, int o2, int o3, T v ){ 
    return vector<vector<vector<T>>>( o1, vector<vector<T>>( o2, vector<T>( o3, v ) ) ) ;
}
#define v vector
// Template END

int power( int x, int n ){
    if( n == 0 ) return 1 ;
    else if( n & 1 ) return ( x * power( (x*x) % mod, n / 2 ) ) % mod ;
    return power( (x*x) % mod, n / 2 ) % mod ;
}



signed main(){
    int n ; cin >> n ;
    vector<pair<int,int>> D(n) ;
    for( int i = 0 ; i < n ; i++ ) cin >> D[i].first >> D[i].second ;
    int left = 0, right = 2 ;
    while( right < n ){
        if( D[left].first == D[left].second
         && D[left+1].first == D[left+1].second
         && D[left+2].first == D[left+2].second ){
             cout << "Yes" ;
             return 0 ;
        }
        ++left, ++right ;
    }
    cout << "No" ;
    return 0 ;   
}          

Measured memory_bytes: 3628
S = int(input())

front = S // 100
back = S % 100

if 1 <= front <= 12 :
    if  1 <= back <= 12:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if 1 <= back <= 12:
        print("YYMM")
    else:
        print("NA")


Measured memory_bytes: 38256
#include<bits/stdc++.h>
using namespace std;
 int dp[100005],check[100005],eg[100005][2];
 vector < int > vec[100005];

 int op(int pos,int parent)
 {
     //printf("pos=%d\n",pos);

     if(dp[pos]!=-1)
        return dp[pos];
     int i,j,k=0,x;
     x=eg[pos][1];
     for(i=0;i<vec[x].size();i++)
     {
         j=op(vec[x][i],parent);
         k=max(j,k);

     }

     //printf("pos=%d k=%d\n",pos,k);
     return dp[pos]=k+1;
 }

 int main()
 {
     int n,m,i,j,k,a,b,c,x,y,z;
     cin>>n>>m;
     for(i=1;i<=m;i++)
     {
         scanf("%d%d",&eg[i][0],&eg[i][1]);
         vec[eg[i][0]].push_back(i);
     }
     int ans=0;
     for(i=1;i<=m;i++){
        dp[i]=-1;
     }
     for(i=1;i<=m;i++)
     {
         a=op(i,i);
        //cout<<i<<"   "<<a<<endl;
         ans=max(ans,a);
     }
     cout<<ans<<endl;

 }



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

int main(){
    ll a,b,c,m,n,sm=0,i,j,x,y,ar[100010];
    string s;
    cin>>s;
    for(i=0;i<(ll)s.size();i++){
        sm+=(s[i]-'0');
    }
    if(sm%9==0) printf("Yes\n");
    else printf("No\n");

    return 0;
}


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

#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i, m, n) for(int i = (int)(m); i < (int)(n); ++i)

const int MOD = 1e+9 + 7;

int main()
{
    int N;
    cin >> N;
    vector<int> a(N), b(N);    
    REP(i, N) cin >> a[i];
    REP(i, N) cin >> b[i];

    sort(a.begin(), a.end());
    sort(b.begin(), b.end());

    long long ans = 1;  // 最初は a[i] - b[i] で繋がっている 
    REP(i, N){
        int pos = lower_bound(a.begin(), a.end(), b[i]) - a.begin(), n;
        if(a[i] < b[i]) n = pos-i;
        else n = i-pos+1;
        ans *= n;  // a[i] が繋げる可能性があるものは n 通り
        ans %= MOD;
        // cout << i << " " << ans << endl;
    } 
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<algorithm>
#include<queue>
using namespace std;
static const int MAX = 10000;
static const int INFTY = (1<<20);
static const int WHITE = 0;
static const int GRAY = 1;
static const int BLACK = 2;
 
int n;
vector<pair<int, int> > adj[MAX];
 
void dijkstra() {
  priority_queue<pair<int, int> > PQ;
  int color[MAX];
  int d[MAX];
  for ( int i = 0; i < n; i++ ) {
    d[i] = INFTY;
    color[i] = WHITE;
  }
 
  d[0] = 0;
  PQ.push(make_pair(0, 0));
  color[0] = GRAY;
 
  while ( !PQ.empty() ) {
    pair<int, int> f = PQ.top(); PQ.pop();
    int u = f.second;
 
    color[u] = BLACK;
 
    if ( d[u] < f.first * (-1) ) continue;
 
    for ( int j = 0; j < adj[u].size(); j++ ) {
      int v = adj[u][j].first;
      if ( color[v] == BLACK ) continue;
      if ( d[v] > d[u] + adj[u][j].second ) {
        d[v] = d[u] + adj[u][j].second;
        PQ.push(make_pair(d[v] * (-1), v));
        color[v] = GRAY;
      }
    }
  }
 
  for ( int i = 0; i < n; i++ )
    cout << i << " " << ( d[i] == INFTY ? -1 : d[i] ) << endl;
}
 
int main() {
  int k, u, v, c;
 
  cin >> n;
  for ( int i = 0; i < n; i++ ) {
    cin >> u >> k;
    for ( int j = 0; j < k; j++ ) {
      cin >> v >> c;
      adj[u].push_back(make_pair(v, c));
    }
  }
 
  dijkstra();
 
  return 0;
}


Measured memory_bytes: 8028
from operator import mul
from functools import reduce

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

MOD = 10**9 + 7
n, m = map(int, input().split())

def fact(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

l = fact(m)
ans = 1

if l[0][0] == 1 and len(l) == 1:
    print(1)
    exit()

for i in range(len(l)):
    b = l[i][1]
    ans *= cmb(b+n-1, b)
    ans %= MOD

print(ans)

Measured memory_bytes: 38512
#include "stdio.h"

int main(){
  int l,n;
  char s[51];
  scanf("%d %d",&l,&n);
  scanf("%s",&s);
  n--;
  if(s[n]=='A')s[n]='a';
  if(s[n]=='B')s[n]='b';
  if(s[n]=='C')s[n]='c';
  printf("%s",s);
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <bits/stdc++.h>
#include <set>
#define isPowerOfTwo(S) (!(S & (S - 1)))
#define ll long long
#define ull unsigned long long
#define MAXN 1000000007
#define INF 1e12
using namespace std;
typedef pair<int,int> pi;
typedef pair<pi,int> trip;
typedef pair<ll int,ll int> pli;
typedef vector<int> vi;
typedef vector<ll int> vli;
typedef vector<vi> vvi;
string getString(char x)
{
    string s(1, x);

    return s;
}
int highestPowerof2(ll int n)
{if(n==0)
    return 0;
   int p = (int)log2(n);
   //cout<<p<<"highest"<<endl;
   return p;
}


int main()
{ios::sync_with_stdio(0);
	cin.tie(0);
    int test=1;
    //int cas=
    //cin>>test;
    while(test--)
    {
       int n;cin>>n;
       vli vec(n);
        vli sum(n+1,0);
       for(int i=0;i<n;i++)
        {cin>>vec[i];vec[i]=vec[i]%1000000007;}
       for(int i=0;i<n;i++)
       {
           sum[i+1]=(sum[i]+vec[i])%1000000007;
          // cout<<sum[i+1]<<endl;
       }
       ll int ans=0;
       for(int i=0;i<n;i++)
       {
           //cout<<vec[n]
           ll int k=(((sum[n]+1000000007)-sum[i+1]))%1000000007;
           //cout<<k<<endl;
           k=(k*vec[i])%1000000007;
           ans+=k;
           ans=ans%1000000007;
       }
       cout<<ans<<endl;

    }

}


Measured memory_bytes: 6344
package main

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

var sc = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

func main() {
	/*/TODO:!!!!!!!テスト用!!!!!!!!!
	sc = bufio.NewScanner(strings.NewReader(`

				`))
	//TODO:!!!!!!!テスト用!!!!!!!!!*/

	buf := make([]byte, 1024*1024)
	sc.Buffer(buf, bufio.MaxScanTokenSize)
	sc.Split(bufio.ScanWords)
	defer out.Flush() // !!!!caution!!!! you must use Fprint(out, ) not Print()
	/* --- code --- */
	//fmt.Fprintln(out, "[DEBUG]", time.Now())

	n, m, x := nextInt(), nextInt(), nextInt()

	c := make([]int, n)
	a := make([][]int, n)
	for i := 0; i < n; i++ {
		c[i], a[i] = nextInt(), nextInts(m)
	}

	ans := -1

	for b := 1; b < int(math.Pow(2, float64(n))); b++ {
		wc := 0
		wa := make([]int, m)
		s := reverse(fmt.Sprintf("%b", b))
		for i := 0; i < len(s); i++ {
			if s[i] == '1' {
				wc += c[i]
				for j := 0; j < m; j++ {
					wa[j] += a[i][j]
				}
			}
		}

		t := true
		for j := 0; j < m; j++ {
			if wa[j] < x {
				t = false
				break
			}
		}
		//fmt.Fprintln(out, "[DEBUG]", wa)
		if t {
			if ans > wc || ans == -1 {
				ans = wc
			}
		}
	}

	//fmt.Fprintln(out, "[DEBUG]", d)
	//fmt.Fprintln(out, "[DEBUG]", time.Now())
	fmt.Fprintln(out, ans)
}
func reverse(s string) string {
	rs := []rune(s)
	for i, j := 0, len(s)-1; i < j; i, j = i+1, j-1 {
		rs[i], rs[j] = rs[j], rs[i]
	}
	return string(rs)
}

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

// -*-*-*-*-*-*-*-*-
// * I/O utilities *
// -*-*-*-*-*-*-*-*-

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

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

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

func nextInts(n int) []int {
	ret := make([]int, n)
	for i := 0; i < n; i++ {
		ret[i] = nextInt()
	}
	return ret
}
func nextFloats(n int) []float64 {
	ret := make([]float64, n)
	for i := 0; i < n; i++ {
		ret[i] = nextFloat64()
	}
	return ret
}
func nextStrings(n int) []string {
	ret := make([]string, n)
	for i := 0; i < n; i++ {
		ret[i] = next()
	}
	return ret
}

func chars(s string) []string {
	ret := make([]string, len([]rune(s)))
	for i, v := range []rune(s) {
		ret[i] = string(v)
	}
	return ret
}


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

int main()
{
    char s[100];
    char t[100];
    scanf("%s %s",s,t);
    int len=strlen(s);

    for(int i=0;i<len;i++)
    {
        bool judge=true;
        for(int j=0;j<len;j++)
        {
            int ij=i+j;
            if(ij>len-1) ij-=len;
            // printf("%d s[%d]=%c t[%d]=%c\n",i,ij,s[ij],j,t[j]);           
            if(s[ij]!=t[j])
            {
                judge=false;
                break;
            }
        }
        if(judge)
        {
            printf("Yes\n");
            return 0;
        }
    }
    printf("No\n");
    return 0;

}

Measured memory_bytes: 128
s=input()
count1=0
count2=0
for i,j in enumerate(s):
    if i%2==0:
        if j=='0':
            count1+=1
    else:
        if j=='1':
            count1+=1
    
for i,j in enumerate(s):
    if i%2==0:
        if j=='1':
            count2+=1
    else:
        if j=='0':
            count2+=1
print(min(count1,count2))

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

struct Card { char suit, value; };

void BubbleSort(Card c[], int n) {
    rep(i,n) {
        for (int j = n-1; j >= i+1; j--) {
            if (c[j].value < c[j-1].value) {
                Card t = c[j]; c[j] = c[j-1]; c[j-1] = t;
            }
        }
    }
}

void SelectionSort(Card c[], int n) {
    rep(i,n) {
        int minj = i;
        for (int j = i; j < n; j++) {
            if (c[j].value < c[minj].value) {
                minj = j;
            }
        }
        Card t = c[i]; c[i] = c[minj]; c[minj] = t;
    }
}

void print(Card c[], int n) {
    rep(i,n) {
        cout << c[i].suit << c[i].value;
        if (i < n-1) cout << ' ';
        else cout << endl;
    }
}

bool isStable(Card c1[], Card c2[], int n) {
    rep(i,n) {
        if (c1[i].suit != c2[i].suit) return true;
    }
    return false;
}

int main() {
    int n; cin >> n;
    Card c1[n], c2[n];

    rep(i,n) {
        cin >> c1[i].suit >> c1[i].value;
        c2[i].suit = c1[i].suit;
        c2[i].value = c1[i].value;
    }

    BubbleSort(c1, n);
    SelectionSort(c2, n);

    print(c1, n);
    cout << "Stable" << endl;
    print(c2, n);
    if (isStable(c1, c2, n)) cout << "Not stable" << endl;
    else cout << "Stable" << endl;
}


Measured memory_bytes: 3108
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<algorithm>
#include<cmath>
#include<queue>
#include<vector>
#include<stack>
#include<map>
using namespace std;

#define int long long
#define REP(i,n) for(int i=0;(i)<(n);(i)++)
#define ll long long

map<pair<int,int>, int> mp;

signed main() {
	int H, W, N;
	cin >> H >> W >> N;

	int a, b;
	pair<int, int> p;
	REP(i, N) {
		cin >> a >> b;

		for (int i = -1;i <= 1;i++) {
			for (int j = -1;j <= 1;j++) {
				p.first = a + i;
				p.second = b + j;
				if (p.first<2 || p.first > H - 1 || p.second < 2 || p.second > W - 1) continue;
				mp[p]++;
			}
		}

	}

	/*
	for (int i = 1;i <= H;i++) {
		for (int j = 1;j <= W;j++) {
			pair<int, int> yx;
			yx.first = i; yx.second = j;
			cout << mp[yx] << " ";
		}
		cout << endl;
	}
	*/


	ll ans[10];
	ans[0] = (H - 2)*(W - 2);
	for (int i = 1;i <= 9;i++) {
		ans[i] = 0;
		for (auto m : mp) {
			if (m.second == i) ans[i]++;
		}

		ans[0] -= ans[i];
	}

	REP(i, 10) cout << ans[i] << endl;


	return 0;
}

Measured memory_bytes: 56448
#include<bits/stdc++.h>
using namespace std;
string s[100005];
int n;
map<string,long>mp;
int main()
{
	long long ans=0;
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		cin>>s[i];
		sort(s[i].begin(),s[i].end());
		ans+=mp[s[i]];
		mp[s[i]]++;
	}
	printf("%lld",ans);
}

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

using namespace std;
using ll = long long;
int p(int a,int n){
    int ret =1;
    while(n>0){
        if(n&1)ret = ret * a;
        a = a*a;
        n>>=1;
    }
    return ret;
}
int main(){
    int n;
    cin>>n;
    vector<int> dp(n+5);
    for(int i=0;i<=n;++i){
        dp[i+1] = dp[i]+1;
    }
    for(auto e : {9,6}){
        int t = 1;
        int en = p(e,t);
        while(en <=n){
            for(int i=0;i<=n;++i){
                if(i+en<=n)dp[i+en] = min(dp[i+en],dp[i]+1);
            }
            t++;
            en = p(e,t);
        }
    }
    cout << dp[n] << endl;
return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <vector>

using namespace std;

int solve(int n, int s, int d = 0, int ss = 0, int bn = 0){
	if(ss == s && n == d){
		return 1;
	}
	if(n == d || ss > s){
		return 0;
	}
	int count = 0;


	for(int i = bn; i <= 9; i++){
		count += solve(n, s, d+1, ss+i, i+1);
	}

	return count;
}

int main(){
	int n, s;

	while(cin >> n >> s){
		if(n == 0 && s == 0) break;
		cout << solve(n, s) << endl;
	}

	return 0;
}

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

const int INF = 1e9;

int main() {
  long long n;
  long long a[5];
  cin>>n;
  long long minval = 1e15;
  for (int i=0;i<5;i++) {
    cin>>a[i];
    minval = min(minval, a[i]);
  }
  cout << (n-1) / minval + 5 << endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main (){
	int n;
	cin >> n;
	int a;
	int c = 1, d = 0; //c indexing d hancur
	for (int i = 0; i<n; i++){
		cin >> a;
		if (a!=c){
			d++;
		}
		else {
			c++;
		}
	}
	if (d==n) cout << -1 << endl;
	else cout << d << endl;
}

Measured memory_bytes: 256
using System;
using static System.Console;

namespace abc168
{
    class Program
    {
        static void Main()
        {
            var l = ReadLine().Split(' ');
            var a = int.Parse(l[0]);
            var b = int.Parse(l[1]);
            var h = int.Parse(l[2]);
            var m = int.Parse(l[3]);

            var hRad = 2 * Math.PI * ((double)h / 12 + (double)m / 720);
            var mRad = 2 * Math.PI * m / 60;
            var xDif = Math.Abs(a * Math.Sin(hRad) - b * Math.Sin(mRad));
            var yDif = Math.Abs(a * Math.Cos(hRad) - b * Math.Cos(mRad));
            WriteLine(Math.Pow(Math.Pow(xDif, 2) + Math.Pow(yDif, 2), 0.5));
        }
    }
}


Measured memory_bytes: 28048
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b,c,d;
  int h1,m1,s1,h2,m2,s2;
  int sum1,sum2,ans1,ansh,ansm,anss;
  for(int i=0; i<3; i++){
	cin >> h1 >> m1 >> s1;
	a = 60*60*h1;
	b = 60*m1;
	sum1 = a+b+s1;
	cin >> h2 >> m2 >> s2;
	c = 60*60*h2;
	d = 60*m2;
	sum2 = c+d+s2;

	ans1 = sum2-sum1;

	if(ans1 >= 3600 ){
	  ansh = ans1/(60*60);
	  ansm = (ans1%(60*60))/60;
	  anss = ((ans1%(60*60)))%60;
	} else if (ans1 >=60){
	  ansh = ans1/(60*60);
	  ansm = ans1/60;
	  anss = ans1%60;
	} else{
	  ansh = ans1/(60*60);
	  ansm = ans1/60;
	  anss = ans1%60;  
	}
	cout << ansh << " " << ansm << " " << anss << endl;
  }    
  return 0;
}


Measured memory_bytes: 3096
#include<bits/stdc++.h>
using namespace std;
int main(){
    int inp;
    string str;
    int nums[4] = {0};
    cin>>inp;
   while(inp--){
       cin>>str;
       if(str=="AC") nums[0]++;
       if(str=="WA") nums[1]++;
       if(str=="TLE") nums[2]++;
       if(str=="RE") nums[3]++;
   }
  cout<<"AC x "<<nums[0];
   cout<<"\nWA x "<<nums[1];
    cout<<"\nTLE x "<<nums[2];
     cout<<"\nRE x "<<nums[3];
   
    return 0;
}

Measured memory_bytes: 3620
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define N 100

char ss[N][16];
int pp[N];

int compare(const void *a, const void *b) {
	int i = *(int *) a;
	int j = *(int *) b;
	int c = strcmp(ss[i], ss[j]);

	return c ? c : pp[j] - pp[i];
}

int main() {
	static int ii[N];
	int n, i;

	scanf("%d", &n);
	for (i = 0; i < n; i++) {
		scanf("%s%d", ss[i], &pp[i]);
		ii[i] = i;
	}
	qsort(ii, n, sizeof *ii, compare);
	for (i = 0; i < n; i++)
		printf("%d\n", ii[i] + 1);
	return 0;
}


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

int main()
{
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  if(a + b > c + d)
    cout << "Left" << endl;
  else if(a + b < c + d)
    cout << "Right" << endl;
  else
    cout << "Balanced" << endl;
  
  return 0;
}

Measured memory_bytes: 3556
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        double[] x = new double[n];
        String[] v = new String[n];
        double ans = 0;
        for (int i = 0; i < n; i++) {
            x[i] = sc.nextDouble();
            v[i] = sc.next();
        }
        for (int i = 0; i < n; i++) {
            if (v[i].equals("JPY"))
                ans += x[i];
            else
                ans += x[i] * 380000;
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 23252
#include<iostream>
#include<vector>
#include<utility>
#include<algorithm>
#include<string>
#include<cstdio>
#include<queue>
#include<functional>
#include<tuple>
#include<iomanip>
#include<stack>
#include<cmath>
#define ll long long
using namespace std;
int main() {
	double d,m; cin >> d;
	m = sqrt(2)*d;
	if (sqrt(d*d - floor(d)*floor(d)) <= 1.0) m = max(m, floor(d) + 1);
	printf("%.10f\n", m);
	return 0;
}


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

typedef long long int ll;
typedef pair<ll, ll> pll;

#define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i))
#define REP(i, n) FOR(i, n, 0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

ll A[100005];
ll B[100005];

int main()
{
    int N;
    cin >> N;
    REP(i, N)
    {
        cin >> A[i] >> B[i];
    }

    ll sum = 0;
    for (int i = N - 1; i >= 0; --i)
    {
        ll t = (sum + A[i] + B[i] - 1) / B[i];
        sum += B[i] * t - (A[i] + sum);
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
const int N=200005;
int sd[N],fa[N],dis[N],fi[N],f[N],ne[N],tot,zz[N],n,k,a[N],ans;
void jb(int x,int y){
	ne[++tot]=fi[x];
	fi[x]=tot;
	zz[tot]=y;
}
void dfs(int x,int y,int z){
	sd[x]=z;fa[x]=y;
	for (int i=fi[x];i;i=ne[i])
		if (zz[i]!=y)dfs(zz[i],x,z+1);
}
int cmp(int x,int y){
	return sd[x]>sd[y];
}
int main(){
	scanf("%d%d",&n,&k);
	for (int i=1;i<=n;i++)scanf("%d",&a[i]),f[i]=i;
	if (a[1]!=1)ans++;
	for (int i=2;i<=n;i++)jb(a[i],i);
	dfs(1,0,0);
	sort(f+1,f+n+1,cmp);
	for (int i=1;i<=n;i++)dis[i]=1;
	for (int i=1;i<n;i++){
		if (fa[f[i]]!=1&&dis[f[i]]==k){
			ans++;
			continue;
		}
		dis[fa[f[i]]]=max(dis[fa[f[i]]],dis[f[i]]+1);
	}
	printf("%d",ans);
}

Measured memory_bytes: 10240
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
using namespace std;
vector<vector<int>> G(100000);
vector<bool> visit(100000, false);
vector<int> prenum(100000), parent(100000,-1), lowest(100000);
int timer = 1;

void dfs(int u, int prev) {
	prenum[u] = lowest[u] = timer++;
	visit[u] = true;
	for (int v : G[u]) {
		if (!visit[v]) {
			parent[v] = u;
			dfs(v, u);
			lowest[u] = min(lowest[u], lowest[v]);
		}
		else if (v != prev) {
			lowest[u] = min(lowest[u], prenum[v]);
		}
	}
}

int main() {
	cin.tie(0);ios::sync_with_stdio(false);
	int V, E; cin >> V >> E;
	set<int> Ans;
	for (int i = 0; i < E;i++) {
		int s, t; cin >> s >> t;
		G[s].emplace_back(t);
		G[t].emplace_back(s);
	}
	dfs(0, -1);

	int count = 0;
	for (int i = 0; i < V;i++) { 
		if (parent[i] == 0) count++;
		if (count >= 2) {
			Ans.insert(0); break;
		}
	}

	for (int i = 1; i < V;i++) {
		for (int v : G[i]) {
			int p = parent[v];
			if (p > 0) {
				if (prenum[p] <= lowest[v])Ans.insert(p);
			}
		}
	}

	for (int i : Ans) {
		cout << i << endl;
	}
}

Measured memory_bytes: 7732
#include<stdio.h>
#include<stdlib.h>

int main(void)
{
    char s[101],non1;
    long k,inip=-1,i;

    scanf("%s",s);
    scanf("%ld",&k);

    for ( i = 0; i < 101; i++)
    {
        if(s[i]!='1')
        {
            inip=i;
            non1=s[i];
            break;
        }
    }

    if(k-1<inip) printf("1");
    else printf("%c",non1);

    return 0;
}

Measured memory_bytes: 128
#include <stdio.h>

int main(void) {
  int a, b, c, d, e, f;
  double x, y;

  while (scanf("%d %d %d %d %d %d", &a, &b, &c, &d, &e, &f) != EOF) {
    x = (b * f - c * e) / (double)(b * d - a * e);
    y = c / (double)b - (a / (double)b) * x;

    if (x == -0) x = 0;
    if (y == -0) y = 0;

    printf("%.3f %.3f\n", x, y);
  }

  return 0;
}

Measured memory_bytes: 0
#include"bits/stdc++.h"

using namespace std; 

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
typedef long long LL;
typedef priority_queue<int> PQ_DESC;
typedef priority_queue<int, vector<int>, greater<int>> PQ_ASC;
typedef priority_queue<PII> PQ_DESC_PII;
typedef priority_queue<PII, vector<PII>, greater<PII>> PQ_ASC_PII;

#define SORT_ASC(c) sort((c).begin(), (c).end())
#define SORT_DESC(c) sort((c).begin(), (c).end(), greater<typeof((c).begin())>())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ROF(i,a,b) for(int i=(b-1);i>=(a);--i)
#define REP(i,n)  FOR(i,0,n)
#define PER(i,n)  ROF(i,0,n)
#define SIZE(a) int((a).size())

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int LARGE_INT = 1e9+100;
const int INF = 2e9+100;

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

void Main()
{
	int n;cin>>n;
	int nn=1;
	REP(i,n){
		nn *= 2;
	}
	PQ_DESC s;
	vector<PQ_DESC> q(n);
	REP(i,nn){
		int t;cin>>t;
		s.push(t);
	}
	//dump(nn)

	int tmp=s.top();s.pop();
	q[0].push(tmp);

	while(!s.empty()){
		int s2 = s.top();s.pop();
		bool f = false;
		REP(i,n){
			if(q[i].empty()){
				continue;
			}
			int s1 = q[i].top();
			if(s1 <= s2){
				continue;
			}
			q[i].pop();
			if(i+1 != n){
				q[i+1].push(s1);
				q[i+1].push(s2);
			}
			f = true;
			break;
		}
		if(!f){
			cout << "No" << endl;
			return;
		}
	}
	
	cout << "Yes" << endl;


	return;
}

int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
    return 0;
}

Measured memory_bytes: 2804
from math import ceil
q = int(input())
for _ in range(q):    
    a, b = sorted(map(int, input().split()))
    print(min(b-a, max((ceil((a*b)**0.5-a)-1)*2, (ceil((-(2*a-1)+(1+4*a*b)**0.5)/2)-1)*2-1, 0)) + 2*(a-1))

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define fi first
#define se second
#define show(x) cout<<#x<<"="<<x<<"\n"
typedef long long ll;
template<typename T>
void print_to(std::ostream &os,const char *,const char *tail,const T &fst){
  os<<fst<<tail;
}
template<typename Fst,typename... Rst>
void print_to(std::ostream &os,const char *del,const char *tail,const Fst &fst,const Rst &... rst){
  os<<fst<<del;
  print_to(os,del,tail,rst...);
}
template<typename Iter>
void print_to_(std::ostream &os,const char *del,const char *tail,Iter bgn,Iter end){
  for(Iter it=bgn;it!=end;){
    os<<*it;
    if(++it!=end)os<<del;
    else os<<tail;
  }
}
template<typename Fst,typename... Rst>
void println(const Fst &fst,const Rst &... rst){
  print_to(std::cout,"\n","\n",fst,rst...);
}
template<typename Fst,typename... Rst>
void print(const Fst &fst,const Rst &... rst){
  print_to(std::cout," ","\n",fst,rst...);
}
template<typename Iter>
void println_(Iter bgn,Iter end){
  print_to_(std::cout," ","\n",bgn,end);
}
using namespace std;
//const int MOD=(ll)1e10+7;
const int dy[]={1,0,-1};
const int dx[]={1,0,-1};
ll n,m,h,w;
string s;
ll dp[6][2][100000];

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.precision(10);
  cout<<fixed;
#ifdef LOCAL_DEFINE
  FILE *stream1;
  //FILE *stream2;
  stream1=freopen("in","r",stdin);
  //stream2=freopen("out","w",stdout);
  if(stream1==NULL)return 0;
  //if(stream2==NULL)return 0;
#endif
  ll k;cin>>n>>k;
  ll sum=0;
  for(ll b=k+1;b<=n;b++){
    if(n%b==0){
      sum+=(b-k)*(n/b);
    }else{
      sum+=(b-k)*(n/b);
      if(n%b-k>=0){
        if(k!=0)sum+=(n%b-k+1);
        else sum+=(n%b-k);
        //if(n%b-k==0)sum+=1;
      }
    }
    //show(sum);
  }
  cout<<sum<<endl;
#ifdef LOCAL_DEFINE
  cerr<<"Time elapsed: "<<1.0*clock()/CLOCKS_PER_SEC<<"s.\n";
  fclose(stream1);
  //fclose(stream2);
#endif
    return 0;
}






Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<bitset>
#include<queue>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) FOR(i,0,n)
typedef long long ll;
int main(){
	ll n;
	ll a[100001];
	ll sum=0;
	cin >> n;
	rep(i,n){
		cin >> a[i];
		sum += a[i];
	}
	ll ny = (n*(n+1))/2;
	ll k = sum / ny;
	if (sum%ny) {
		cout << "NO" << endl;
		return 0;
	}
	
	bool flag = 0;
	rep(i,n-1){
		ll dif = a[i+1] - a[i];
		if ((k-dif)%n != 0 || dif > k) {
			flag = 1;	//あかん
			break;
		}
	}
	ll dif = a[0] - a[n-1];
	if ((k-dif)%n != 0 || dif > k) {
			flag = 1;	//あかん
		}
	if (flag){
		cout << "NO" << endl;
	}
	else {
		cout << "YES" << endl;
	}

	return 0;
}


Measured memory_bytes: 1024
package main

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

var sc = bufio.NewScanner(os.Stdin)

func Scan() string {
	sc.Scan()
	return sc.Text()
}
func iScan() int {
	n, _ := strconv.Atoi(Scan())
	return n
}
func fScan() float64 {
	n, _ := strconv.ParseFloat(Scan(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func SScan(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scan()
	}
	return a
}
func iSScan(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = iScan()
	}
	return a
}
func abs(x int) int {
	if x < 0 {
		x = -x
	}
	return x
}
func larger(a, b int) int {
	if a < b {
		return b
	} else {
		return a
	}
}
func smaller(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}
func max(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x < a[i] {
			x = a[i]
		}
	}
	return x
}
func min(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x > a[i] {
			x = a[i]
		}
	}
	return x
}
func sum(a []int) int {
	x := 0
	for _, v := range a {
		x += v
	}
	return x
}

var mod int = 1000000007

func main() {
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	x := iScan()
	y := x / 100
	if x-y*100 <= y*5 {
		fmt.Println(1)
	} else {
		fmt.Println(0)
	}
}


Measured memory_bytes: 1772
import sys

s = input()
revs = ''.join(list(reversed(s)))
n = len(s)

if s == revs:
    revs = ''.join(list(reversed(s[:(n)//2])))
    if s[:(n)//2] == revs:
        revs = ''.join(list(reversed(s[(n+2)//2:])))
        if s[(n+2)//2:] == revs:
            print("Yes")
            sys.exit()
print("No")

Measured memory_bytes: 3064
//
#include <bits/stdc++.h>
using namespace std;
#define rp(i,n) for(int i=0;i<(n);i++)
#define ote(x) cout<<(x)<<endl

int main(){
	int a,b,c;
	cin>>a>>b>>c;
	bool can = false;
	rp(i,b){
		if(a*i%b==c){
			can=true;
			break;
		}
	}
	ote(can? "YES":"NO");
}


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

using namespace std;
using ll = long long;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  ll x; cin >> x;
  ll bal = 100;
  for(int f = 0; ; ++f) {
    if(bal >= x) {
      cout << f << '\n';
      break;
    }
    bal += bal / 100;
  }
  return 0;
}


Measured memory_bytes: 3608
#include <iostream>
#include <vector>

using namespace std;

int main()
{
	int n;
	cin >> n;
	vector<int> h(n);
	for (int i = 0; i < n; i++) {
		cin >> h[i];
	}

	vector<int> dp(n);
	dp[0] = 0;
	dp[1] = abs(h[1] - h[0]);
	for (int i = 2; i < n; i++) {
		int a = dp[i - 1] + abs(h[i] - h[i - 1]);
		int b = dp[i - 2] + abs(h[i] - h[i - 2]);
		dp[i] = (a < b) ? a : b;
	}

	cout << dp[n - 1] << endl;

	return 0;
}

Measured memory_bytes: 4056