akhauriyash/Code-Regression huggingface dataset:
import sys

def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  #空白あり

N = I()
xy = [LI() for i in range(N)]

# 円の中心の半径は、ある2点の中点か、ある3点の外心かである

ans = []

def distance(A,B):  # 2点間の距離
    x1,y1 = A
    x2,y2 = B
    return ((x1-x2)**2+(y1-y2)**2)**.5

for i in range(N-1):
    for j in range(i+1,N):
        x1,y1 = xy[i]
        x2,y2 = xy[j]
        x,y = (x1+x2)/2,(y1+y2)/2
        r = distance((x,y),(x1,y1))
        for k in range(N):
            if k == i or k == j:
                continue
            else:
                if distance(xy[k],(x,y)) > r+10**-8:
                    break
        else:
            ans.append(r)

def gaishin(A,B,C):  # 3点の外心
    x1,y1 = A
    x2,y2 = B
    x3,y3 = C
    a = 2*((x2-x1)*(y3-y1)-(x3-x1)*(y2-y1))
    b = x2**2-x1**2+y2**2-y1**2
    c = x3**2-x1**2+y3**2-y1**2
    if a == 0:
        return (0,float('inf'))  # 適当な値
    else:
        x = ((y3-y1)*b-(y2-y1)*c)/a
        y = (-(x3-x1)*b+(x2-x1)*c)/a
    return (x,y)

for i in range(N-2):
    for j in range(i+1,N-1):
        for k in range(j+1,N):
            x,y = gaishin(xy[i],xy[j],xy[k])
            if y == float('inf'):
                continue
            else:
                r = distance((x,y),xy[i])
                for l in range(N):
                    if l == i or l == j or l == k:
                        continue
                    else:
                        if distance(xy[l],(x,y)) > r+10**-8:
                            break
                else:
                    ans.append(r)

print(min(ans))

Measured memory_bytes: 76988
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <unordered_map>
#include <utility>
#include <algorithm>
#include <set>
#include <cmath>
#include <array>
#include <bitset>
using namespace std;
typedef long long ll;
const ll mod=1000000007;
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,n) for(int i=1;i<n+1;i++)
int main(){
    int N,M;
    cin>>N>>M;
    int keta[3],s,c;
    rep(i,3) keta[i] = -1;
    rep(i,M){
        cin>>s>>c;
        s--;
        if(keta[s]!=-1){
            if(keta[s] != c){
                cout<<"-1"<<endl;
                return 0;
            }
        }else{
            keta[s] = c;
        }
    }
    if(N!=1 && keta[0]==0){
        cout<<"-1"<<endl;
    }else if(N==1 && M==0){
        cout<<0<<endl;;
    }
    else{
        rep(i,N){
            if(keta[i]!=-1) cout<<keta[i];
            else if(i==0) cout<<1;
            else cout<<0;
        }cout<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
N, M = map(int, input().split())

S, C = [], []
for i in range(M):
  s, c = map(int, input().split())
  S += [s-1]
  C += [str(c)]
  
if N == 1:
  for i in range(10):
    flag = 1
    for m in range(M):
      if str(i) != C[m]:
        flag = 0
        break
    if flag:
      print(i)
      break
  else:
    print(-1) 
else:
  for i in range(10**(N-1), 10**N):
    flag = 1
    i_str = str(i)
    for m in range(M):
      if i_str[S[m]] != C[m]:
        flag = 0
        break
    if flag:
      print(i)
      break
  else:
    print(-1)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define MAXN 100005
#define INF 1000000000
#define MOD 1000000007
#define F first
#define S second
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int N,M,cnt[MAXN];
bool has[MAXN];
int main()
{
    scanf("%d%d",&N,&M);
    memset(has,false,sizeof(has));
    for(int i=1;i<=N;i++) cnt[i]=1;
    has[1]=true;
    for(int i=0;i<M;i++)
    {
        int x,y;
        scanf("%d%d",&x,&y);
        if(has[x]) has[y]=true;
        cnt[x]--; cnt[y]++;
        if(!cnt[x]) has[x]=false;
    }
    int ans=0;
    for(int i=1;i<=N;i++) if(has[i]) ans++;
    printf("%d\n",ans);
    return 0;
}


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

int main(){
    int n ;
    cin >> n ;
    if (n%2 == 0)
    {
        cout << n/2 - 1 << endl ;
    }else
    {
        cout << n/2 << endl ;
    }
    
    
    
    
    
    
}

Measured memory_bytes: 256
s = input().strip()
l = len(s)
d, a = {}, {}
for i, c in enumerate(s):
    if c in d:
        d[c] = max(d[c], i - a[c])
    else:
        d[c] = i
    a[c] = i + 1
for c, v in d.items():
    d[c] = max(v, l - a[c])
print(min(d.values()))


Measured memory_bytes: 3060
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;
import java.lang.Math;

public class Main {
	public static void main(String[] args) {
		FS reader = new FS();
		// write reader
		try {
    		String S = reader.next();
    		int c0 = 0;
    		int c1 = 0;
    		for (int i=0; i<S.length(); i++) {
    		    if (S.charAt(i) == '0') c0++;
    		    else c1++;
    		}
    		System.out.println(Math.min(c0, c1)*2);
		} catch (NoSuchElementException e) {
		    System.out.println(0);
		}
	}
	
	public static void solver() {
		// write logic
	}
	
	// Read Class
	static class FS {
		private final InputStream in = System.in;
		private final byte[] buffer = new byte[1024];
		private int ptr = 0;
		private int buflen = 0;
		private boolean hasNextByte() {
			if (ptr < buflen) {
				return true;
			} else {
				ptr = 0;
				try {
					buflen = in.read(buffer);
				} catch (IOException e) {
					e.printStackTrace();
				}
				if (buflen <= 0) {
					return false;
				}
			}
			return true;
		}
	
		private int readByte() { return hasNextByte() ? buffer[ptr++] : -1;}
		private boolean isPrintableChar(int c) {return 33 <= c && c <= 126;}
		private void skipUnprintable() {while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;}
	
		public boolean hasNext() { skipUnprintable(); return hasNextByte();}
		public String next() {
			if (!hasNext()) throw new NoSuchElementException();
			StringBuilder sb = new StringBuilder();
			int b = readByte();
			while(isPrintableChar(b)) {
				sb.appendCodePoint(b);
				b = readByte();
			}
			return sb.toString();
		}
		public int nextInt() {
			return (int)nextLong();
		}
		public long nextLong() {
			if (!hasNext()) throw new NoSuchElementException();
			long n = 0;
			boolean minus = false;
			int b = readByte();
			if (b == '-') {
				minus = true;
				b = readByte();
			}
			if (b < '0' || '9' < b) {
				throw new NumberFormatException();
			}
			while(true) {
				if ('0' <= b && b <= '9') {
					n *= 10;
					n += b - '0';
				} else if(b == -1 || !isPrintableChar(b)) {
					return minus ? -n : n;
				} else {
					throw new NumberFormatException();
				}
				b = readByte();
			}
		}
	}
}


Measured memory_bytes: 23124
using namespace std;
#include <bits/stdc++.h>
#define rep(i, s) for (int i = 0; i < s; ++i)
#define repr(i, n) for(int i = n-1; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define all(v) (v.begin(), v.end())
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define VEC(a, n) vector<int>a(n)
#define PQ(a) priority_queue<int>a
#define PQmin(a) priority_queue< int, :vector<int>, greater<int> >a
#define PAIR pair<int, int>
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
#define EPS (1e-7)
#define INF (1e10)
#define PI (acos(-1))
const ll mod = 1000000007;
bool f(string s){
  bool ans=true;
  rep(i,s.size()/2){
    if(s[i]!=s[s.size()/2+i]){
      ans=false;
      break;
    }
  }
  return ans;
}



int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int H,W;
  cin>>H>>W;
  vector<string>S(H);
  rep(i,H){
    cin>>S[i];
  }
  vector<vector<ll>> L(H, vector<ll>(W));
  vector<vector<ll>> R(H, vector<ll>(W));
  vector<vector<ll>> D(H, vector<ll>(W));
  vector<vector<ll>> U(H, vector<ll>(W));
  vector<vector<ll>> dp(H, vector<ll>(W));
  rep(i,H){
    rep(j,W){
      if(S[i][j]=='#')
        L[i][j]=0;
      else if(j==0)
        L[i][j]=1;
      else
        L[i][j]=L[i][j-1]+1;
      }
    }
  repr(i,H){
    repr(j,W){
        if(S[i][j]=='#')
          R[i][j]=0;
        else if(j==W-1)
          R[i][j]=1;
        else
          R[i][j]=R[i][j+1]+1;
        }
      }
  rep(i,H){
    rep(j,W){
          if(S[i][j]=='#')
            U[i][j]=0;
          else if(i==0)
            U[i][j]=1;
          else
            U[i][j]=U[i-1][j]+1;
          }
        }
  repr(i,H){
    rep(j,W){
                if(S[i][j]=='#')
                  D[i][j]=0;
                else if(i==H-1)
                  D[i][j]=1;
                else
                  D[i][j]=D[i+1][j]+1;
                }
              }
  ll ans=0;
  rep(i,H){
    rep(j,W){
      dp[i][j]=L[i][j]+R[i][j]+U[i][j]+D[i][j]-3;
      ans=max(dp[i][j],ans);
      
    }
  }

  
  cout<<ans<<endl;


}


Measured memory_bytes: 161280
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = s; i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << '\n';
#define CFYN(n) cout << ( (n) ? "YES":"NO") << '\n';
#define OUT(n) cout << (n) << '\n';
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

int main(void)
{
    IOS
    int n; cin >> n;
    vector<int> p6,p9;
    for(int i = 0;pow(6,i)<=n; i++) {
        p6.push_back(pow(6,i));
    }
    reverse(ALL(p6));
    for(int i = 0;pow(9,i)<=n; i++) {
        p9.push_back(pow(9,i));
    }
    reverse(ALL(p9));

    int ans = n;
    REP(i,n+1) {
        int cnt = 0;
        int m = i;
        for(auto x:p6) {
            int d = m / x;
            cnt += d;
            m -= d * x;
        }
        m = n - i;
        for(auto x:p9) {
            int d = m / x;
            cnt += d;
            m -= d * x;
        }
        ans = min(ans,cnt);
    }

    cout << ans << '\n';

    return 0;
}

Measured memory_bytes: 256
#include <string>
#include <vector>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <map>
#include <list>
#include <set>
#include <numeric>
#include <queue>
#include <stack>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <climits>
#include <cfloat>
#include <ctime>
#include <complex>
#include <cassert>
#include <array>
#include <bitset> 
#include <unordered_map>
using namespace std;
typedef long long LL;
typedef pair<LL,LL> P;


void solve(std::string S){
	for(int i=0;i<S.size();i++){
		S[i]='x';
	}
	cout << S << endl;

}

int main(){
    std::string S;
    std::cin >> S;
    solve(S);
    return 0;
}


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

using namespace std;

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

#define sz(a) (int)a.size()
#define all(a) a.begin(), a.end()
#define pb push_back
#define ppb pop_back
#define mkp make_pair
#define F first
#define S second
#define show(a) cerr << #a <<" -> "<< a <<"\n"
#define fo(a, b, c, d) for(int (a) = (b); (a) <= (c); (a) += (d))
#define foo(a, b, c ,d) for(int (a) = (b); (a) >= (c); (a) -= (d))
//#define int ll

const int N = 2e5;
const int INF = 1e9;

int n, m;
string s;
vector <int> ans;

int main () {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cin >> n >> m;
	cin >> s;
	for(int i = n; i >= 1;) {
		bool ok = 0;
		for(int j = max(i - m, 0); j < i; ++j) {
			if(s[j] == '0') {
				ans.pb(i - j);
				i = j;
				ok = 1;
				break;
			}
		}
		if(!ok) {
			cout << -1;
			return 0;
		}
	}	
	reverse(all(ans));
	for(int it : ans)
		cout << it <<' ';
	return 0;
}












Measured memory_bytes: 1096
#include <iostream>

using namespace std;

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

    char pic_a[n][n], pic_b[m][m];

    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            cin >> pic_a[i][j];
        }
    }
    for (int i = 0; i < m; i++) {
        for (int j = 0; j < m; j++) {
            cin >> pic_b[i][j];
            }
    }

  //bool flag = true;
    for (int i = 0; i < n - m + 1; i++) {
      //bool flag = true;
        for (int j = 0; j < n - m + 1; j++) {
            bool flag = true;
            for (int k = 0; k < m; k++) {
                for (int u = 0; u < m; u++) {
                    if (pic_b[k][u] != pic_a[i + k][j + u]) {
                        flag = false;
                    }
                }
            }
        if (flag == true) {
            cout << "Yes" << endl;
            return 0;
            }
            }

    }

    cout << "No" << endl;


}



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


using namespace std;

int main(){
    string S; 
    int N, i, j, ans = 0;
    set<char> X, Y, max;
    //vector<string> X, Y;

    cin >> N >> S;



    for( i = 1; i < N; i++){
        //cout << "i = " << i << endl;
        for(j = 0; j < i; j++){
            X.insert(S[j]);
            // cout << S[j];
        }
        for(j = i; j < N; j++){
            Y.insert(S[j]);
        }
        auto itr = X.begin();
        for(; itr != X.end(); itr++){
            if(Y.find(*itr) != Y.end()) max.insert(*itr);
        }
        if(ans < max.size()) ans = max.size();

        X.clear();
        Y.clear();
        max.clear();
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
#define ROF(i,a,b) for(int i=a;i>=b;i--)
#define per(i,a) ROF(i,a,0)
#define pb push_back
using namespace std;
using ll=long long;
using ld=long double;
using ch=char;
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<P> vP;
typedef vector<ch> vc;
typedef vector<vc> vvc;
const ll MOD=1000000007;
const ll MOD2=998244353;
const ld PI=acos(-1);
const ll INF=1e18;
struct edge{ll to,cost;};
struct edge2{ll from,to,cost;};

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

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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int H,W,K;
    cin >> H >> W >> K;
    int x0,y0,x1,y1;
    cin >> x0 >> y0 >> x1 >> y1;
    x0--;y0--;x1--;y1--;
    vvc c(H,vc(W));
    rep(i,H){
        rep(j,W){
            cin >> c[i][j];
        }
    }
    vvl dist(H,vl(W,INF));
    int dx[]={1,0,-1,0},dy[]={0,1,0,-1};
    dist[x0][y0]=0;
    queue<P> q;
    q.push({x0,y0});
    while(!q.empty()){
        P now=q.front();
        q.pop();
        int x=now.first,y=now.second;
        rep(i,4){
            int nx=x,ny=y;
            ll now_d=dist[x][y]+1;
            rep(t,K){
                nx+=dx[i],ny+=dy[i];
                if((min(nx,ny)<0||max(nx-H+1,ny-W+1)>0||(dist[nx][ny]!=-1&&now_d>dist[nx][ny])||c[nx][ny]=='@'))break;
                if(now_d<dist[nx][ny]){
                    dist[nx][ny]=now_d;
                    q.push({nx,ny});
                }
            }
        }
    }
    cout << (dist[x1][y1]>=INF?-1:dist[x1][y1]) << endl;
}
/*
overflow checked?
corner case checked?
boundary checked?
not TLE in worst case checked?
*/

Measured memory_bytes: 19876
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <queue>
using ll = long long;
using graph = std::vector<std::vector<ll>>;

using namespace std;

int main() {
    ll H,A;
    cin >> H >> A;
    cout << ceil((double)H / (double)A) << endl;

}

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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------


int N;

int hoge6(int v) {
	int ret=0;
	ret+=v/(6*6*6*6*6*6*6);
	v%=(6*6*6*6*6*6*6);
	ret+=v/(6*6*6*6*6*6);
	v%=(6*6*6*6*6*6);
	ret+=v/(6*6*6*6*6);
	v%=(6*6*6*6*6);
	ret+=v/(6*6*6*6);
	v%=(6*6*6*6);
	ret+=v/(6*6*6);
	v%=(6*6*6);
	ret+=v/(6*6);
	v%=(6*6);
	ret+=v/(6);
	v%=(6);
	ret+=v;
	return ret;
}

int hoge9(int v) {
	int ret=0;
	ret+=v/(9*9*9*9*9*9);
	v%=(9*9*9*9*9*9);
	ret+=v/(9*9*9*9*9);
	v%=(9*9*9*9*9);
	ret+=v/(9*9*9*9);
	v%=(9*9*9*9);
	ret+=v/(9*9*9);
	v%=(9*9*9);
	ret+=v/(9*9);
	v%=(9*9);
	ret+=v/(9);
	v%=(9);
	ret+=v;
	return ret;
}

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N;
	int mi=N;
	for(i=0;i*9<=N;i++) {
		mi=min(mi,hoge9(i)+hoge6((N-(i*9))/6)+(N-(i*9))%6);
	}
	cout<<mi<<endl;
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 256
N = int(input())
dp = [[[[0]*4 for _ in range(4)] for _ in range(4)] for _ in range(N+1)]
# A:0, G:1, C:2, T:3
dp[0][3][3][3] = 1
mod = 10**9+7

for i in range(N):
  for j in range(4):
    for k in range(4):
      for l in range(4):
        if dp[i][j][k][l] == 0:
          continue

        for m in range(4):
          if k == 1 and l == 0 and m == 2: # GAC
            continue
          if k == 0 and l == 2 and m == 1: # ACG
            continue
          if k == 0 and l == 1 and m == 2: # AGC
            continue
          if j == 0 and l == 1 and m == 2: # A?GC
            continue
          if j == 0 and k == 1 and m == 2: # AG?C
            continue
          dp[i+1][k][l][m] += dp[i][j][k][l]
          dp[i+1][k][l][m] %= mod

ans = 0
for i in range(4):
  for j in range(4):
    for k in range(4):
      ans += dp[-1][i][j][k]
print(ans%mod)
  

Measured memory_bytes: 50288
#include<stdio.h>
int main(void){
  int i,y;
  char a[1002];
  while(1){
    y=0;
    scanf("%s",&a);
    if(a[0] == '0')
    break;
    for(i=0;a[i]!='\0';i++){
      if('0'<=a[i] && a[i]<='9'){
      y+=a[i]-'0';
      }
    }
    printf("%d\n",y);
  }
  return 0;
}


Measured memory_bytes: 2056
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

fn f(s: &[char]) -> bool {
    let m = s.len();
    for i in 0..m {
        if s[i] != s[m - 1 - i] {
            return false;
        }
    }
    true
}

use std::iter::Iterator;

fn main() {
    input! {
        x: i64,
    }

    let mut x1 = x;
    let max = ((x1 as f64).sqrt()) as i64;

    let mut ans = 2;

 'outer:   loop {


            if x == 2 {
                break;
            }


            if x1 % 2 == 0{
                x1 = x1 + 1;
                continue;
            }

            for i in 2..max + 1 {

                if x1 % i == 0 {
                    break;
                }

                if i == max {
                    ans = x1;
                    break 'outer;
                }
            }

        x1 = x1 + 1;
    }

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


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define rep(i,n) for (long long i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vec = vector<ll>;
using vecp = vector<P>;
using mat = vector<vec>;
using matp = vector<vecp>;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define all(v) v.begin(), v.end()

int main(){
  ll D,T,S;
  cin >> D >> T >> S;
  if(S*T>=D){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}

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

int main()
{
    string s;
    cin>>s;
    for(int i=0;i<s.length();i++){
        if(i%2==0){
            if(s[i]=='L'){
                cout<<"No"<<endl;
                return 0;
            }
        }else{
            if(s[i]=='R'){
                cout<<"No"<<endl;
                return 0;
            }
        }
    }
    cout<<"Yes"<<endl;
}


Measured memory_bytes: 3588
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;

const int MOD = (int)1e9 + 7;

int n,m,h[101],hnum[101],dh[101];///h记录每一列高度 dh记录离散化后的各不相同的高度 hnum记录h对应dh中的位置，即第几高的高度
long long dp[101][101];

int pow_(long long x,int y) {///快速幂求 x的y次方
    long long ans = 1;
    if(y > 0) {
        while(y) {
            if(y % 2)ans = ans * x % MOD;
            x = x * x % MOD;
            y /= 2;
        }
    }
    return ans;
}

int main() {
    scanf("%d",&n);
    for(int i = 1;i <= n;i ++) {
        scanf("%d",&h[i]);
        dh[++ m] = h[i];///先把高度存到dh数组 下标从1开始，方便后面dp
    }
    sort(dh + 1,dh + m + 1);///dh数组排序
    m = unique(dh + 1,dh + m + 1) - dh - 1;///dh数组离散化去掉重复的高度 m是不相同的高度数
    for(int i = 1;i <= n;i ++) {
        hnum[i] = lower_bound(dh + 1,dh + m + 1,h[i]) - dh;///每一列高度在dh数组中对应的位置
    }
    dp[0][0]=1;///初始化 当第0列有1个无连续相同的方案
    for(int i = 1;i <= n;i ++) {///对每一列每个高度段进行更新 更新过程为从下往上
        (dp[i][0] += dp[i - 1][0] * 2 % MOD) %= MOD;///无连续相同方案  加上前i - 1列无连续相同方案数*2 因为可以是与前一列对应位置同色或者异色一共两种方案
        for(int j = hnum[i] + 1;j <= hnum[i - 1];j ++)///如果前一列比这一列高，高出的部分也存着接触部分无连续相同的方案 但是可能会重复加上上一步的方案数所以下面更新高出的部分时会避免
            (dp[i][0] += dp[i - 1][j] * 2 % MOD) %= MOD;
        int d = pow_(2,h[i] - h[i - 1]);///比前一列高出部分的涂色方案数，如果比前一列低 d就等于1
        for(int j = 1;j <= min(hnum[i - 1],hnum[i]);j ++) {
            dp[i][j] = dp[i - 1][j] * d % MOD;///有连续相同颜色的方案数 已经分析过接触部分的颜色一定是定下的 所以这一列接触部分有连续相同部分的方案数由高出部分的变化决定 即 乘上d
        }
        for(int j = hnum[i - 1] + 1;j <= hnum[i];j ++) {///更新比前一列高出的部分 j从上一列的高度加1的下标开始
            if(j > 1)(dp[i][j] += dp[i - 1][0] * (pow_(2,dh[j] - dh[j - 1]) - 1) % MOD * 2 % MOD * pow_(2,h[i] - dh[j]) % MOD) %= MOD;
            ///一般情况 前i - 1列无连续方案 * （第j块高度变化方案 -1表示去掉重复的 这里会包括一种前面计算过的方案 容易想到) * 剩下几块高度的变化方案数
            else (dp[1][1] += dp[0][0] * (pow_(2,dh[1]) - 2) % MOD * pow_(2,h[i] - dh[1]) % MOD) %= MOD;
            ///第一列的第一块高度 记录随意变化方案数 -2表示除去dp[i][0]已经记录过的 勿重复记录
        }
    }
    long long ans = 0;
    for(int i = 0;i <= hnum[n];i++)
        (ans += dp[n][i]) %= MOD;
    printf("%lld",ans);
    return 0;
}


Measured memory_bytes: 384
import java.util.*;

class Main{
    public static void main(String[] arg){
      Scanner sc = new Scanner(System.in);
      String A = sc.nextLine();
      String B = sc.nextLine();
      String C = sc.nextLine();
      char[] listA = A.toCharArray();
      char[] listB = B.toCharArray();
      char[] listC = C.toCharArray();
      int a = 0;int b = 0;int c = 0;
      char now = listA[0];
      a = 1;
      while(true){
        switch(now){
          case 'a':
            if(a == listA.length){
              System.out.println("A");
              System.exit(0);
            }
            now = listA[a];
            a++;
            break;
          case 'b':
            if(b == listB.length){
              System.out.println("B");
              System.exit(0);
            }
            now = listB[b];
            b++;
            break;
          case 'c':
            if(c == listC.length){
              System.out.println("C");
              System.exit(0);
            }
            now = listC[c];
            c++;
            break;
        }
      }

    }
}


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

#define ll long long

using namespace std;

const int maxn = (int)2e5 + 7;
const int INF = (int)1e9;

ll a,b[maxn],c,d,cnt,e[(int)2e3 + 1][(int)2e3 + 1],cost[maxn],tout[maxn],mn = INF,p[maxn];

vector < pair < ll, ll> > g[maxn];

vector <ll> ans;

string s,t;

int main()
{
    //freopen("island2.in" , "r" , stdin);
    //freopen("island2.out" , "w" , stdout);
    cin >> a;
    if(a < 1200){
    	cout << "ABC";
    }
    else if(a < 2800){
    	cout << "ARC";
    }
    else{
    	cout << "AGC";
    }
    return 0;
}


Measured memory_bytes: 6400
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<stack>
#include<queue>
#include<deque>
#include<map>
#include<set>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
#define FOR(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR1(i,n) for(int (i)=1;(i)<(n);(i)++)
#define eFOR(i,n) for(int (i)=0;(i)<=(n);(i)++)
#define eFOR1(i,n) for(int (i)=1;(i)<=(n);(i)++)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i) sort((i).begin(),(i).end(), greater<int>());
#define YES(i) cout << ((i) ? "Yes" : "No") << endl;
constexpr auto INF = 1000000000;
constexpr auto LLINF = 1LL << 62;
constexpr auto mod = 1000000007;
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; }


int a[2000][2000], b[2000][2000];
int main() {
    int h, w;
    cin >> h >> w;
    vector<string> s(h);
    FOR(i, h)cin >> s[i];

    FOR(i, h) {
        if (s[i][0] == '.')a[i][0] = 1;
        else a[i][0] = 0;
    }
    FOR(i, w) {
        if (s[0][i] == '.')b[0][i] = 1;
        else b[0][i] = 0;
    }

    FOR(i, h) {
        FOR1(j, w) {
            if (s[i][j] == '.')a[i][j] = a[i][j - 1] + 1;
            else a[i][j] = 0;
        }
        FOR1(j, w-1) {
            if (s[i][w - j - 1] == '.')chmax(a[i][w - j - 1], a[i][w - j]);
            else a[i][w-j-1] = 0;
        }
        if (w > 1 && s[i][0] == '.')chmax(a[i][0], a[i][1]);
    }
    FOR(j, w) {
        FOR1(i, h) {
            if (s[i][j] == '.')b[i][j] = b[i - 1][j] + 1;
            else b[i][j] = 0;
        }
        FOR1(i, h-1) {
            if (s[h - i - 1][j] == '.')chmax(b[h - i - 1][j], b[h - i][j]);
            else b[h - i - 1][j] = 0;
        }
        if (h > 1&&s[0][j]=='.')chmax(b[0][j], b[1][j]);
    }
    int ans = 1;
    FOR(i, h)FOR(j, w)chmax(ans, a[i][j] + b[i][j] - 1);
    cout << ans << endl;
}


Measured memory_bytes: 35584
#include <stdio.h>

int main(void)
{
    int i;
    int n;
    int in_i;

    scanf("%d", &n);
    int in[n], out[n];

    for (i = 0; i < n; i++){
        scanf("%d", &in_i);
        in[i] = in_i;
    }

    for (i = 0; i < n; i++){
        out[i] = in[n - 1 - i];
    }

    for (i = 0; i < n; i++){
        if (i){
            printf(" ");
        }
        printf("%d", out[i]);
    }
    printf("\n");

    return 0;
}

Measured memory_bytes: 1028
#include<bits/stdc++.h>
using namespace std;
    int main(){
        int N; int x = 0;
            string S;
                cin >> N >> S;
                    if(N % 2 == 1){
                        cout << "No" << endl;
                    }else{
                        for(int i = 0; i < N/2; i++){
                            if(S.at(i) == S.at(N/2 + i)){
                            }else{
                                x = 1;
                            }
                        }
                            if(x == 0){
                                cout << "Yes" << endl;
                            }else{
                                cout << "No" << endl;
                            }
                    }
    return 0;}


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

int main() {
    int a[9];
    cin >> a[0] >> a[1] >> a[2];
    cin >> a[3] >> a[4] >> a[5];
    cin >> a[6] >> a[7] >> a[8];
    int n = 0;
    cin >> n;
    vector<int> b;
    int tmp = 0;
    for (int i = 0; i < n; ++i)
    {
        cin >> tmp;
        b.push_back(tmp);
    }


    int x[9];
    for (auto& ix : x)
        ix = 0;

    for (auto& it : b)
    {
        for (int i = 0; i < 9; ++i)
        {
            if (a[i] == it)
                x[i] = 1;
        }
    }

    bool yes = false;
         if (x[0] && x[1] && x[2])
        yes = true;
    else if (x[3] && x[4] && x[5])
        yes = true;
    else if (x[6] && x[7] && x[8])
        yes = true;
    else if (x[0] && x[3] && x[6])
        yes = true;
    else if (x[1] && x[4] && x[7])
        yes = true;
    else if (x[2] && x[5] && x[8])
        yes = true;
    else if (x[0] && x[4] && x[8])
        yes = true;
    else if (x[2] && x[4] && x[6])
        yes = true;

         if (yes)
             cout << "Yes";
         else
             cout << "No";
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <iostream>
#include <istream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <tuple>
#include <iomanip>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vec;
typedef vector<vec> mat;
#define rep(i, n) for(ll i = 0; i < (n); i++)
#define revrep(i, n) for(ll i = (n)-1; i >= 0; i--)
#define pb push_back
#define f first
#define s second
/*
ll max(ll a, ll b){return (a > b) ? a : b;}
ll min(ll a, ll b){return (a < b) ? a : b;}
ll max3(ll a, ll b, ll c){return max(a, max(b, c));};
ll min3(ll a, ll b, ll c){return min(a, min(b, c));};
ll max4(ll a, ll b, ll c, ll d){return max(max(a, b), min(c, d));};
ll min4(ll a, ll b, ll c, ll d){return min(min(a, b), min(c, d));};
ll max5(ll a, ll b, ll c, ll d, ll e){return max(max(a, b), max3(c, d, e));};
ll min5(ll a, ll b, ll c, ll d, ll e){return min(min(a, b), min3(c, d, e));};
*/
const ll INFL = 1LL << 60;//10^18 = 2^60
const int INF = 1 << 30;//10^9
ll MOD = 1000000007;
//ll MOD = 998244353;

vector<ll> dy = {0, 0, 1, -1, 1, 1, -1, -1, 0};
vector<ll> dx = {1, -1, 0, 0, 1, -1, 1, -1, 0};


ll pow_long(ll x, ll k){
  ll res = 1;
  while(k > 0){
    if(k % 2) res *= x;
    x *= x;
    k /= 2;
  }
  return res;
}
ll pow_mod(ll x, ll k){
  ll res = 1;
  while(k > 0){
    if(k % 2){
      res *= x; res %= MOD;
    }
    x *= x; x %= MOD;
    k /= 2;
  }
  return res;
}

ll inverse(ll x){return pow_mod(x, MOD - 2);};

ll gcd(ll a, ll b){
    if(b == 0) return a;
    return gcd(b, a % b);
}

ll lcm(ll x, ll y){return x / gcd(x, y) * y;};

ll kai_mod(ll x){
  if(x == 0) return 1;
  return x * kai_mod(x-1) % MOD;
}


//コンビネーション
const int MAXcomb = 200010;
ll fac[MAXcomb], finv[MAXcomb], inv[MAXcomb];
//facはn!,finvは1/n!
//invは逆元
void COMinit(){
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for(int i = 2; i < MAXcomb; 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;
    }
}
ll comb(int n, int k){
    if(n < k) return 0;
    if(n < 0 || k < 0) return 0;
    return fac[n] * finv[k] % MOD * finv[n-k] % MOD;
}

ll N, D, Q;
ll d[500010], q[500010];
int main(){
  cin >> N >> D;
  rep(i, N) cin >> d[i];
  cin >> Q;
  rep(i, Q) cin >> q[i];

  vector<ll> A(N + 1, 0);//1_index, i回目の操作が終わった時にいる距離
  A[0] = D;
  rep(i, N){
    A[i+1] = min(A[i], abs(A[i] - d[i]));
  }

  vector<ll> NG(N+1, 0);//i回目以降の操作が行われてもgoalできない最小値
  NG[N] = 1;
  revrep(i, N){
    if(d[i] >= NG[i+1] * 2){
      NG[i] = NG[i+1];
    }else{
      NG[i] = NG[i+1] + d[i];
    }
  }

  rep(i, Q){
    if(A[q[i]-1] >= NG[q[i]]){
      cout << "YES" << endl;
    }else{
      cout << "NO" << endl;
    }
  }





}


Measured memory_bytes: 17920
//g++  7.4.0

#include <iostream>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define MAXX 1e9
#define MOD 1000000007

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    ll N; cin>>N;
    map<pair<ll,ll>,ll> mp;
    ld prod = 1000000000.00;
    //cout<<fixed<<MAXX<<endl;
    
    for(ll i=0;i<N;++i)
    {
        ld ai; cin>>ai;
        ll num = llround(ai*prod);
        ll one = 0;
        ll two = 0;
        //cout<<ai<<" "<<num<<"";
        
        while(num%2 == 0)
        {
            num = num/2;
            one++;
        }
        
        while(num%5 == 0)
        {
            num = num/5;
            two++;
        }
        
        //cout<<" "<<one<<" "<<two<<endl;
        mp[{one,two}]++;
    }
    
    ll ans = 0;
    
    for(auto it1: mp)
    {
        for(auto it2: mp)
        {
            if((it1.first.first + it2.first.first >= 18) && (it1.first.second + it2.first.second >= 18))
            {
                ll f1 = it1.second;
                ll f2 = it2.second;
                
                if(it1 < it2)
                    ans += (f1*f2);
                else if(it1 == it2)
                    ans += (f1 * (f1 - 1))/2LL;
            }
        }
    }
    
    cout<<ans<<endl;
}

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

class Graph {
    public ArrayList<Integer>[] adjacency;

    Graph(int n){
        adjacency = new ArrayList[n];
        for(int i = 0; i < n; i++){
            adjacency[i] = new ArrayList<Integer>();
        }
    }

    public void add_edge(int from, int to, boolean is_directed){
        adjacency[from].add(to);
        if(!is_directed){
            adjacency[to].add(from);
        }        
    }
}

public class Main {
    
    static Graph graph;
    static List<Integer> u_to_v_path = new LinkedList<Integer>();
    
    public static void main(String[] args) throws IOException {

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] in1 = br.readLine().split(" ");
        int N = Integer.parseInt(in1[0]);
        int u = Integer.parseInt(in1[1]);
        int v = Integer.parseInt(in1[2]);
        u--; v--;
        graph = new Graph(N);
        for(int i = 0; i < N-1; i++){
            in1 = br.readLine().split(" ");
            int A = Integer.parseInt(in1[0]);
            int B = Integer.parseInt(in1[1]);
            graph.add_edge(A-1, B-1, false);
        }
        br.close();
        find_u_to_v_path(u, v, -1);

        int u_v_length = u_to_v_path.size();

        int start_point = u_to_v_path.get(u_v_length / 2 - 1);
        int start_parent = u_to_v_path.get(u_v_length / 2);

        int ans = u_v_length / 2 + dfs(start_point, start_parent) - 1;
        if(u_v_length % 2 == 1){
            ans++;
        }
        System.out.println(ans);
    }

    public static boolean find_u_to_v_path(int u, int v, int parent){
        if(u == v) {
            u_to_v_path.add(u);
            return true;
        }

        for(int next : graph.adjacency[v]){
            if(next == parent) continue;
            if(find_u_to_v_path(u, next, v)){
                u_to_v_path.add(v);
                return true;
            }
        }

        return false;
    }

    public static int dfs(int now, int parent){
        if(graph.adjacency[now].size() == 1 && graph.adjacency[now].get(0) == parent){
            return 0;
        }

        int ret = 0;

        for(int next : graph.adjacency[now]){
            if(next == parent) continue;
            ret = Math.max(ret, dfs(next, now));
        }

        return ret + 1;
    }
}

Measured memory_bytes: 69280
#!/usr/bin/env python3
import sys
import queue


YES = "Yes"  # type: str


def solve(N: int, M: int, A: "List[int]", B: "List[int]"):
    root = []
    for i in range(N):
        root.append([])
    next = [-1] * N
    for a, b in zip(A, B):
        root[a - 1].append(b - 1)
        root[b - 1].append(a - 1)

    q = queue.Queue()
    q.put(0)

    while not q.empty():
        #print(next)
        n = q.get()
        for i in root[n]:
            if next[i] == -1:
                next[i] = n
                q.put(i)

    if -1 in next:
        print("No")
        exit()
    
    print("Yes")
    for i in range(1, len(next)):
        print(next[i] + 1)
    

    return


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    A = [int()] * (M)  # type: "List[int]"
    B = [int()] * (M)  # type: "List[int]"
    for i in range(M):
        A[i] = int(next(tokens))
        B[i] = int(next(tokens))
    solve(N, M, A, B)

if __name__ == '__main__':
    main()


Measured memory_bytes: 49856
//152 C - Low Elements 2020/01/19

#include <bits/stdc++.h>
#define rep(i ,n) for(int i=0;i<(int)(n);++i)
using namespace std;
typedef long long int int64;
typedef unsigned long long uint64;

//Debug
void print(const vector<int>& v){
    for( int x : v){
        cout << x << ' ';
    }
    cout << endl;
}

int main(){
    int n; cin >> n;
    vector<int> p(n+1);
    bool flag = true;
    int counter = 0;
    p[0] = 0;
    
    for(int i = 1 ; i <= n ; ++i) cin >> p[i];
    int min = p[1];
    for(int i = 1 ; i <= n ; ++i){
        if(p[i] < min) min = p[i];
        if(p[i] == min ) ++counter;
    }
    cout << counter << endl;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
const int N = 50;
int a[N], b[N];
int main()
{
	int len;
	cin>>len;
	string str;
	cin >> str;
	int ans = -1;
	for (int i = 0; i < len; i++)
	{
		memset(a, 0, sizeof a);
		memset(b, 0, sizeof b);
		int cnt = 0;
		for (int j = 0; j <= i; j++)
			a[str[j] - 'a']++;			
		for (int j = i + 1; j < len; j++)
			b[str[j] - 'a']++;		
		for (int j = 0; j < 26; j++)
		{
			if (a[j] == 0 && b[j] == 0) continue;
			if (a[j] > 0 && b[j] > 0) cnt++;
		}
		ans = max(ans, cnt);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>

std::vector<std::vector<int>> edges;
std::vector<int> dis;
std::vector<int> pre;

void bfs(int n) {
  dis[1] = 0;
  std::queue<int> que;
  que.push(1);
  while (!que.empty()) {
    int u = que.front();
    que.pop();
    for (const auto& v : edges[u]) {
      if (dis[v] > dis[u] + 1) {
        dis[v] = dis[u] + 1;
        pre[v] = u;
        que.push(v);
      }
    }
  }
}

bool solve(int n) {
  bfs(n);
  for (int i = 2; i <= n; ++i) {
    if (dis[i] >= n)
      return false;
  }
  return true;
}

int main() {
  int n, m;
  std::cin >> n >> m;
  
  dis = std::vector<int>(n + 1, n + 1);
  pre = std::vector<int>(n + 1, -1);
  edges = std::vector<std::vector<int>>(n + 1);
  
  for (int i = 0; i < m; ++i) {
    int u, v;
    std::cin >> u >> v;
    edges[u].emplace_back(v);
    edges[v].emplace_back(u);
  }
  if (solve(n)) {
    std::cout << "Yes" << std::endl;
    for (int i = 2; i <= n; ++i) 
      std::cout << pre[i] << std::endl;
  } else {
    std::cout << "No" << std::endl;
  }
  return 0;
}


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

struct node{
    unsigned int key;
    struct node *next;
    struct node *prev;
};

typedef struct node * NodePointer;

NodePointer nil;

NodePointer listSearch(int key){
    NodePointer cur = nil->next;
    while (cur!=nil&&cur->key!=key){
        cur=cur->next;
    }
    return cur;
}

void init(){
    nil = malloc(sizeof(struct node));
    nil->next = nil;
    nil->prev = nil;
}

void printList(){
    NodePointer cur = nil->next;
    int isf = 1;
    while(1){
        if ( cur == nil ) break;
        if ( isf == 0)  printf(" ");
        printf("%d", cur->key);
        cur = cur->next;
        isf = 0;
    }
    printf("\n");
}

void deleteNode(NodePointer t){
    if(t==nil)return;
    t->prev->next = t->next;
    t->next->prev = t->prev;
    free(t);
}

void deleteFirst(){
    NodePointer t = nil->next;
    if ( t == nil ) return;
    deleteNode(t);
}

void deleteLast(){
    deleteNode(nil->prev);
}

void delete(int key){
    deleteNode(listSearch(key));
}


void insert(int key){
    NodePointer x;
    x = malloc(sizeof(struct node));
    x->key = key;
    
    x->next=nil->next;
    nil->next->prev=x;
    nil->next=x;
    x->prev=nil;
}

int main(){
    int key, n, i;
    int size = 0;
    char com[20];
    int np = 0, nd = 0;
    scanf("%d", &n);
    init();
    for ( i = 0; i < n; i++ ){
        scanf("%s%d", com, &key);
        if ( com[0] == 'i' ) {insert(key); np++; size++;}
        else if ( com[0] == 'd' ) {
            if (strlen(com) > 6){
                if ( com[6] == 'F' ) deleteFirst();
                else if ( com[6] == 'L' ) deleteLast();
            } else {
                delete(key); nd++;
            }
            size--;
        }
    }
    
    printList();
    return 0;
}



Measured memory_bytes: 32940
#include<iostream>
#include<algorithm>
#include <iostream> 
#include <algorithm> 
#include<string>
#include<queue>
#include<utility>
#include<fstream>
#include<queue>
#include<set>
#include<stack>
//#include<bits/stdc++.h>
#define ll long long int
#define ull unsigned long long int
#define I(a) scanf("%d",&a)
#define I2(a,b) scanf("%d%d",&a,&b)
#define I3(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define L(a) scanf("%lld",&a)
#define L2(a,b) scanf("%lld%lld",&a,&b)
#define L3(a,b,c) scanf("%lld%lld%lld",&a,&b,&c)
#define PI(a) printf("%d",a)
#define PL(a) printf("%lld",a)
#define PT(t) printf("Case %d: ",t)
#define PB push_back
#define x first
#define y second
#define xx first.first
#define xy first.second
#define yx second.first
#define yy second.second
#define SC scanf
#define PC printf
#define NL printf("\n")
#define SET(a) memset(a,0,sizeof a)
#define SETR(a) memset(a,-1,sizeof a)
#define SZ(a) ((int)a.size())-1
#define f(i,a,b) for(int i=a;i<=b; i++)
#define fr(i,a,b) for(int i=a;i<=b; i++)
#define frr(i,a,b) for(int i=a;i>=b; i--)
#define frv(i,a)  for(int i=0;i<a.size();i++)
#define pi 2.0*acos(0.0)
#define R(a) freopen(a, "r", stdin);
#define W(a) freopen(a, "w", stdout);
#define CB(x) __builtin_popcount(x)
#define STN(a) stringtonumber<ll>(a)
#define lol printf("BUG\n")
#define Endl "\n"
#define mk make_pair
using namespace std;
template <class T> inline T BM(T p, T e, T M)
{
    ll ret = 1;
    for(; e > 0; e >>= 1)
    {
        if(e & 1) ret = (ret * p) % M;
        p = (p * p) % M;
    }
    return (T)ret;
}
template <class T> inline T gcd(T a, T b)
{
    if(b == 0)return a;
    return gcd(b, a % b);
}
template <class T> inline T mdINV(T a, T M)
{
    return BM(a, M - 2, M);
}
template <class T> inline T PW(T p, T e)
{
    ll ret = 1;
    for(; e > 0; e >>= 1)
    {
        if(e & 1) ret = (ret * p);
        p = (p * p);
    }
    return (T)ret;
}
 
 
template <class T>bool ISLEFT(T a, T b, T c)
{
    if(((a.xx - b.xx) * (b.yy - c.yy) - (b.xx - c.xx) * (a.yy - b.yy)) < 0.0)return 1;  //Uporer dike //A,b,c, x okkher ordera sorted
    else return 0;
}
 
 
typedef pair<int,int >P;
//////////////////////////
/////////////////////////

int main(){

    int n,k;
    I2(n,k);
    int res = k;
    if(n<10){
        res += 100 *(10-n);
    }

    cout<<res<<endl;

    return 0;
}

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

const llong MOD = 1e9+7;
const llong inf = 1<<30;

int N, K;
vector<bool> sunuke_has; //もってる:もってない

int main() {
    cin >> N >> K;
    sunuke_has.resize(N);
    rep(i,K) {
        int d; cin >> d;
        rep(j,d) {
            int a; cin >> a;
            sunuke_has[a-1] = 1;
        }
    }
    int count = 0;
    rep(i,N) {
        count += !sunuke_has[i];
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <string>
#include <unordered_map>
#include <stdio.h>
#include <list>
#include <vector>
#include <algorithm>
#include <stack>
#include <climits>
#include <cmath>
#include <queue>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; ++i)
#define ALL(v) v.begin(), v.end()
typedef long long ll;

int main()
{
	int n;cin >> n;
	int k= n;
	int sum=0;
	while(k!=0)
	{
		sum+=k%10;
		k/=10;
	}
	if(n%sum==0)cout<<"Yes";
	else cout << "No";
	return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import itertools

def solve(x: int) -> int:
    y = 100
    for i in itertools.count(1):
        y = y * 101 // 100
        if x <= y:
            return i

# generated by online-judge-template-generator v4.1.0 (https://github.com/kmyk/online-judge-template-generator)
def main():
    X = int(input())
    unz = solve(X)
    print(unz)

if __name__ == '__main__':
    main()


Measured memory_bytes: 9172
#include <stdio.h>

int main(void){
	int N;
	scanf("%d",&N);
	int i;
	int a[N];
	int yonnobaisu=0;
	int ninobaisu= 0;
	for(i=0;i<N;i++){
		scanf("%d",&a[i]);
		if(a[i]%4==0){
			yonnobaisu++;
			continue;
		}else if(a[i]%2==0){
			ninobaisu++;
		}
	}
	if( ((N)/2)<= yonnobaisu+(ninobaisu/2)){
		printf("Yes");
	}else{
		printf("No");
	}
	return 0;
}

Measured memory_bytes: 512
#include<iostream>
using namespace std;
int main()
{
  double a ,b;
  cin >> a >> b;
    if(a > b){
      cout << "GREATER" << endl;
    } else if(a < b) {
      cout << "LESS" << endl;
    } else if(a == b){
      cout << "EQUAL" << endl;
    }
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;

int main() {
    string s;
    cin >> s;

    int n = s.size();

    int k = n / 2;
    for (int i = n / 2; i < n; i++) {
        if (s[i] != s[n / 2]) break;
        if (s[n - 1 - i] != s[n / 2]) break;
        k = i + 1;
    }

    cout << k << endl;

    return 0;
}

Measured memory_bytes: 512
/* Trico */
#include <iostream>
#include <bits/stdc++.h>
#define inf 1e18
#define ll long long
#define x first
#define y second
#define pll pair<ll, ll>
#define pii pair<int, int>
#define mll map<ll, ll>
#define mii map<int, int>
#define vll vector<ll>
#define vi vector<int>
#define pb push_back
#define p push
using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int ans = 0, ans2 = 0;
    string s, t;
    cin>>s;
    t = s;
    for(int i = 1;i<s.size();i++){
        if(s[i] == s[i-1]){
            s[i] = (s[i-1] == '0')?'1':'0';
            ans++;
        }
    }
    ans = ans;
    cout<<ans;
} 

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin >> n;
    int ans = 0;
    int cand[] = {105,135,165,189,195};
    for(int i = 0;i < 5;i++)ans += (n >= cand[i]);
    cout << ans << endl;
}

Measured memory_bytes: 256