akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <bitset>
#include <iostream>
#include <iomanip>
#include <memory>
#include <string>
#include <vector>
#include <list>
#include <numeric>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <deque>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e16;

/*
<url:>
問題文============================================================

=================================================================

解説=============================================================

================================================================
*/
int main(void) {
	cin.tie(0); ios::sync_with_stdio(false);
    string s,p;cin >> s >> p;
    int len = s.length();
    s += s;
    for(int i = 0; i < len;i++){
        if(s.substr(i,p.length()) == p){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
	return 0;
}



Measured memory_bytes: 3228
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include <boost/multiprecision/cpp_ll.hpp>
//typedef boost::multiprecision::cpp_ll ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E18;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define endl "\n"
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);

ll dp[3010+1][3010+1][4];
ll V[3010+1][3010+1];

int main(){fastio
    ll R,C,K;cin>>R>>C>>K;
    rep(i,0,R)rep(j,0,C)rep(k,0,3)dp[i][j][k]=-1;
    rep(i,0,R)rep(j,0,C)V[i][j]=0;
    rep(i,0,K-1){
        ll r,c,v;cin>>r>>c>>v;
        V[r][c]=v;
    }
    if(V[1][1]>0){
        dp[1][1][0]=0;
        dp[1][1][1]=V[1][1];
    }else{
        dp[1][1][0]=0;
    }
    rep(i,1,R){
        rep(j,1,C){
            if(i==1 && j==1)continue;
            if(i>1){
                if(V[i][j]>0){
                    rep(k,0,3){
                        if(dp[i-1][j][k]>=0){
                            dp[i][j][0]=max(dp[i][j][0],dp[i-1][j][k]);
                            dp[i][j][1]=max(dp[i][j][1],dp[i-1][j][k]+V[i][j]);
                        }
                    }
                }else{
                    rep(k,0,3){
                        if(dp[i-1][j][k]>=0){
                            dp[i][j][0]=max(dp[i][j][0],dp[i-1][j][k]);
                        }
                    }
                }
            }
            if(j>1){
                if(V[i][j]>0){
                    rep(k,0,3){
                        if(dp[i][j-1][k]>=0){
                            dp[i][j][k]=max(dp[i][j][k],dp[i][j-1][k]);
                        }
                    }
                    rep(k,1,3){
                        if(dp[i][j-1][k-1]>=0){
                            dp[i][j][k]=max(dp[i][j][k],dp[i][j-1][k-1]+V[i][j]);
                        }
                    }
                }else{
                    rep(k,0,3){
                        if(dp[i][j-1][k]>=0){
                            dp[i][j][k]=max(dp[i][j][k],dp[i][j-1][k]);
                        }
                    }
                }
            }
        }
    }
    /*
    rep(k,0,3){
        cout<<endl;
        rep(i,1,R){
            rep(j,1,C){
                cout<<dp[i][j][k]<<' ';
            }
            cout<<endl;
        }
    }*/
    ll ans=0;
    rep(i,0,3){
        ans=max(ans,dp[R][C][i]);
    }
    cout<<ans<<endl;

    return 0;
}





Measured memory_bytes: 356492
from heapq import heappush, heappop

N, K = map(int, input().split())
h = []
for i in range(N):
  t, d = map(int, input().split())
  heappush(h, (-d, t))

# initial
res = 0
sum = 0
q = []
used = {}
for i in range(K):
  (d, t) = heappop(h)
  if t not in used:
    used[t] = 1
  else:
    heappush(q, (-d, t))
  sum += -d
res = len(used)*len(used)+sum

# swap minimum
while q and h:
  (d, t) = heappop(h)
  if t not in used:
    used[t] = 1
    m, _ = heappop(q)
    sum = sum - m - d
  res = max(res, len(used)*len(used) + sum)
  
print(res)

Measured memory_bytes: 21284
N=int(input())
S=list(map(int,input().split()))
S.sort()
S.reverse()

dic={}
for i in range(N):
    tmp=S[i]
    if tmp in dic:
        dic[tmp]+=1
    else:    
        dic[tmp]=1
kouho1=0
keys = [k for k, v in dic.items() if v >= 4]
keys.sort()
keys.reverse()
if len(keys)>=1:
    kouho1=keys[0]*keys[0]

kouho2=0
keys = [k for k, v in dic.items() if v >= 2]
keys.sort()
keys.reverse()
if len(keys)>=2:
    kouho2=keys[0]*keys[1]

print(max(kouho1,kouho2))




Measured memory_bytes: 17932
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int main(){
  ll i,j,n,k,a[200010];
  cin >> n >>k;
  for(i=0;i<n;i++){
    cin >> a[i];
  }
  if(k==0){
    sort(a,a+n,greater<int>());
    cout << a[0] << endl;
    return 0;
  }
  ll min=0,max=1000000001;
  while(abs(min-max)>1){
    ll mid=(min+max)/2;
    ll sum=0,ch=0;
    for(j=0;j<n;j++){
      if(a[j]<=mid){
        continue;
      }
      ll x=a[j];
      sum+=(x/mid);
      if(sum>k){
        ch=1;
        break;
      }
    }
    if(ch==0){
      max=mid;
    }
    else{
      min=mid;
    }
  }
  cout << max << endl;
}

Measured memory_bytes: 5076
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define isYES(x) printf("%s\n",(x) ? "YES" : "NO")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define isYes(x) printf("%s\n",(x) ? "Yes" : "No")
#define isIn(x,y,h,w) (x >= 0 && x < h && y >= 0 && y < w)

#define int long long
//using ll = long long;
using P = pair<int,int>;

ostream &operator<<(ostream &os,const P &p){ return os << "(" << p.first << "," << p.second << ")"; }
template<class T>
ostream &operator<<(ostream &os,const vector<T> &v){
	for(int i = 0;i < v.size();i++) os << (i ? "," : "[") << v[i];
	os << "]";
	return os;
}

template<class T> T &chmin(T &a,const T &b){ return a = min(a,b); }
template<class T> T &chmax(T &a,const T &b){ return a = max(a,b); }

const int INF=1e+18;
const double EPS=1e-9;
const int MOD=1000000007;

const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};

signed main(){
	int a,b,c;
	cin >> a >> b >> c;
	if(c - a - b < 0){
		No();
		return 0;
	}
	isYes(4 * a  *b < (c - a - b) * (c - a - b));
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
#define REP(i,n) for(int i = 1; i<=n; ++i)
#define all(x) begin(x),end(x)
typedef long long ll;
typedef pair<int,int> ip;
typedef pair<ll,ll> lp;
const int inf = 1001001000;
const ll INF = 1LL<<60;
const int MOD = (int)1e9 + 7;

int main(){
	int n,k;
	cin>>n>>k;
	int ans = 1;
	ans += (n-2)/(k-1);
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
import java.util.ArrayList;
import java.util.Collections;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    for (int i = 111; i <= 999; i += 111) {
      if (i >= N) {
        System.out.println(i);
        break;
      }
    }
  }
}


Measured memory_bytes: 21844
import java.util.*;
public class Main{
	    public static void main(String[] args) {
	        Scanner sc = new Scanner(System.in);
	        StringBuilder sb = new StringBuilder();
	        int sx =  Integer.parseInt(sc.next());
	        int sy =  Integer.parseInt(sc.next());      
	        int tx =  Integer.parseInt(sc.next());               
	        int ty =  Integer.parseInt(sc.next());        
	        int dx = tx - sx;
	        int dy = ty - sy;
	        for(int i = 0; i < dx; i++){
	            sb.append('R');            
	        } 
	        for(int i = 0; i < dy; i++ ){ 
	            sb.append('U');
	        }
	        for(int i = 0; i < dx; i++ ){
	            sb.append('L');
	        } 
	        for(int i = 0; i < dy; i++){
	            sb.append('D');
	        }
	        sb.append('D');
	        for(int i = 0; i < dx+1; i++){
	            sb.append('R');            
	        }       
	        for(int i = 0; i < dy+1; i++ ){ 
	            sb.append('U');
	        }
	        sb.append('L');
	        sb.append('U');
	        for(int i = 0; i < dx+1; i++ ){
	            sb.append('L');
	        }        
	        for(int i = 0; i < dy+1; i++){
	            sb.append('D');
	        } 
	        sb.append('R'); 
	        System.out.println(new String(sb));
	    }
 }

Measured memory_bytes: 23892
import sys

S = input()

for i in range(len(S)):
  if i % 2 == 0:
    if S[i] != 'R' and S[i] != 'U' and S[i] != 'D':
      print('No')
      sys.exit()
  else:
    if S[i] != 'L' and S[i] != 'U' and S[i] != 'D':
      print('No')
      sys.exit()

print('Yes')

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define ll long long int
#define vi vector<int>
#define vl vector<ll>
#define v2i vector<vector<int>>
#define v2l vector<vector<ll>>
#define ppi pair<int,int>
#define vpi vector<ppi>
#define ppl pair<ll,ll>
#define all(x) x.begin(),x.end()
#define ii int,int 
#define ff first    
#define ss second
#define forn(i,a,b) for(int i=a;i<b;i++)
#define forr(i,a,b) for(int i=a;i>=b;i--)
#define forv(i,m) for(auto i : m)
#define imx INT_MAX
#define imn INT_MIN
#define inf LONG_MAX
#define minf LONG_MIN
#define endl "\n"
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define sze size()
#define rvs reverse 
#define itr iterator 
#define pre cout<<fixed<<setprecision(10);
#define umap unordered_map
#define uset unordered_set

/*
#define MODM(a,b,md) ((a%md)*(b%md))%md
#define MODA(a,b,md) ((a%md)+(b%md))%md
#define ull unsigned long long int
#define si short int
*/

/*
bool compare(int a,int b) {return a > b;}
bool compare1(ppi a,ppi b) {return a.ff > b.ff;}
bool compare2(ppi a,ppi b) {return a.ss < b.ss;}
ll Npower(ll a,ll b) {ll product = 1; while(b){if(b&1){product = product*a;}a = a*a;b = b>>1;} return product;}
ll power(ll a,ll b,ll md) {ll product = 1; while(b){if(b&1){product = MODM(product,a,md);}a = MODM(a,a,md);b = b>>1;} return product%md;}
ll GCD(ll a,ll b) {return b==0 ? a:GCD(b,a%b);}
ll LCM(ll a,ll b) {return (a/GCD(a,b))*b; }
*/

int main()
{
    fast

    pre
        
    double a,b;
    cin>>a>>b;

    cout<<a/b;    












    return 0;
}

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

int main(){
	string s;
	cin >> s;
	vector<char> show;
	rep(i,s.size()) {
		if (s[i] == '0' || s[i] == '1') show.push_back(s[i]);
		else {
			if (show.size() == 0) continue;
			show.pop_back();
		}
	}
	for(char c : show) cout << c;
	cout << endl;

	return 0;
}


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

#define INF INT_MAX
#define UINF UINT_MAX
#define MOD 1000000007
#define REP(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()

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

using namespace std;

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

    ll n,m;
    cin >> n >> m;

    ll ans = 0;
    if(n > 1)ans += n * (n-1) / 2;

    if(m > 1)ans += m * (m-1) / 2;

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define int long long
#define endl "\n"
#define pii pair<int,int> 
#define ff first
#define ss second
#define mii map<int,int>
#define si set<int>
#define sti stack<int>
#define qi queue<int>
#define vi vector<int>
#define pq priority_queue<int>
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
const int M=1e9+7;

int32_t main(){
    IOS;
    int r;
    cin>>r;
    cout<<(double)2*3.14159*(double)r<<endl;
}

Measured memory_bytes: 3800
s=str(input())
n=len(s)
ans=0
if n%2==0:
  for i in range(int(n/2)):
    if s[i]!=s[n-1-i]:
      ans+=1
else:
  for i in range(int((n-1)/2)):
    if s[i]!=s[n-1-i]:
      ans+=1
print(ans)

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

int d[4][2] = {-1,0,0,-1,1,0,0,1};

struct node{
	int x,y;
	node(int a,int b)
	{
		x = a;
		y = b;
	}
};

int n,m,k;
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin >> n >> m >> k;
	vector<vector<char> > maze(n+1,vector<char>(m+1));
	vector<vector<int> > vis(n+1,vector<int>(m+1));
	vector<vector<int> > dist(n+1,vector<int>(m+1));
	int x1,y1,x2,y2;
	cin >> x1 >> y1 >> x2 >> y2;
	for (int i = 1; i <= n; i++)
	{
		for (int j = 1; j <= m; j++)
		{
			cin >> maze[i][j];
			dist[i][j] = 1e9;
		} 
	}
	queue<node> q;
	q.push(node(x1,y1));
	vis[x1][y1] = 1;
	dist[x1][y1] = 0;
	while( !q.empty() )
	{
		node t = q.front();
		q.pop();
		vector<node> temp;
		for (int i = 0; i < 4; i++)
		{
			for (int j = 1; j <= k; j++)
			{
				int newx = t.x + d[i][0] * j;
				int newy = t.y + d[i][1] * j;
				if( newx < 1 || newx > n || newy < 1 || newy > m || dist[newx][newy] < dist[t.x][t.y] + 1 || maze[newx][newy] == '@') break;
				if( dist[newx][newy] == 1e9 )
				{
					dist[newx][newy] = dist[t.x][t.y] + 1;
					//temp.push_back(node(newx,newy));
					q.push(node(newx,newy));
				}
				
			}
		}
		//for (int i = 0; i < temp.size(); i++) vis[temp[i].x][temp[i].y] = 1;
	}
	if( dist[x2][y2] == 1e9 ) cout << -1 << '\n';
	else cout << dist[x2][y2] << '\n';
	return 0;
}


Measured memory_bytes: 24684
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	Scanner sc = new Scanner(System.in);
	int INF = 1 << 27;

	public static void main(String[] args) {
		new Main().run();
	}

	void run() {
		while (true) {
			int n = sc.nextInt();
			if (n == 0)
				break;
			int[][] cs = new int[10][10];
			for (int i = 0; i < 10; i++) {
				Arrays.fill(cs[i], INF);
			}
			int max = 0;
			for (int i = 0; i < n; i++) {
				int a = sc.nextInt();
				int b = sc.nextInt();
				int c = sc.nextInt();
				cs[a][b] = c;
				cs[b][a] = c;
				max = Math.max(Math.max(a, b), max);
			}
			for (int i = 0; i < 10; i++)
				cs[i][i] = 0;
			for (int k = 0; k < 10; k++) {
				for (int i = 0; i < 10; i++) {
					for (int j = 0; j < 10; j++) {
						cs[i][j] = Math.min(cs[i][j], cs[i][k] + cs[k][j]);
					}
				}
			}
			int min_idx = -1;
			int min = INF;
			for (int i = 0; i <= max; i++) {
				int sum = 0;
				for (int j = 0; j <= max; j++) {
					sum += cs[i][j];
				}
				if (sum < min) {
					min_idx = i;
					min = sum;
				}
			}
			System.out.println(min_idx + " " + min);
		}
	}
}

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



int main(){
  int a,b,c;
  scanf("%d %d",&a,&b);
  
  if(a<b){
    c=b;
    b=a;
    a=c;
  }//a>=bの状態になる
  
  while(1){
    c=a%b;
    if(c==0) break;
    a=b;
    b=c;
  }//ユークリッドの互除法
  
  printf("%d\n",b);
  return 0;
}


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

#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define RREP(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();++i)
#define LET(x,a) __typeof(a) x(a)
//#define IFOR(i,it,c) for(__typeof((c).begin())it=(c).begin();it!=(c).end();++it,++i)
#define ALL(c) (c).begin(), (c).end()
#define MP make_pair

#define EXIST(e,s) ((s).find(e)!=(s).end())

#define RESET(a) memset((a),0,sizeof(a))
#define SET(a) memset((a),-1,sizeof(a))
#define PB push_back
#define DEC(it,command) __typeof(command) it=command

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define debug2(x) cerr << #x << " = [";REP(__ind,(x).size()){cerr << (x)[__ind] << ", ";}cerr << "] (L" << __LINE__ << ")" << endl;

const int INF=0x3f3f3f3f;

typedef long long Int;
typedef unsigned long long uInt;
typedef long double rn;

typedef pair<int,int> pii;

/*
#ifdef MYDEBUG
#include"debug.h"
#include"print.h"
#endif
*/
// }}}

int N;

int main(){
	vector<pair<int,int> > v;
	cin>>N;
	REP(i,N){
		int a;
		cin>>a;
		v.push_back({a,i});
	}
	vector<Int> ans(N,0);
	sort(ALL(v));
	reverse(ALL(v));
	int cur_i = INF;
	Int h = INF;
	Int ct = 0;
	REP(j,N){
		if(cur_i!=INF)ans[cur_i]+=ct*(h-v[j].first);
		if(v[j].second<cur_i){
			cur_i = v[j].second;
		}
		ct++;
		h = v[j].first;
	}
	ans[cur_i]+=ct*h;
	REP(i,N){
		cout<<ans[i]<<endl;
	}
	return 0;
}



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

using namespace std;

int main(int argc, char const *argv[])
{
    int n, x, ans =1;
    cin >> n >> x;
    vector<int> v;
    for (int i = 0; i < n; i++)
    {
        int temp;
        cin >> temp;
        v.push_back(temp);
    }
    int l = 0;
    for (int i = 0; i < n; i++)
    {
        l += v[i];
        if(l <= x) {
            ans++;
        } else {
            break;
        }
    }

    cout << ans << endl;
    
    
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define N 100005
#define pb push_back
#define pii pair<int,int>
#define mp make_pair

int n,m,ans;
vector<int> a[N];
priority_queue<pii> q;

int main()
{
	ios_base::sync_with_stdio(0);
	
	cin>>n>>m;
	for(int i=1;i<=n;i++)
	{
		int x,y;
		cin>>x>>y;
		a[x].pb(y);
	}
	for(int i=1;i<=m;i++)
		sort(a[i].begin(),a[i].end());
	for(int i=1;i<=m;i++)
	{
		if(a[i].size()) q.push(mp(a[i].back(),i));
		if(q.empty()) continue;
		int x=q.top().second;
		q.pop();
		ans+=a[x].back();
		a[x].pop_back();
		if(a[x].size()) q.push(mp(a[x].back(),x));
	}
	cout<<ans<<'\n';
	
	return 0;
}

Measured memory_bytes: 5760
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;

public class Main {
	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		int N = sc.nextInt();
		int max = 0;
		int ans = 0;
		for (int i = 0; i < N; i++) {
			int H = sc.nextInt();
			if (H >= max) {
				max = H;
				ans++;
			}
		}
		System.out.println(ans);
	}
}

class FastScanner {
    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() {
        if (hasNextByte())
            return buffer[ptr++];
        else
            return -1;
    }

    private static boolean isPrintableChar(int c) {
        return 33 <= c && c <= 126;
    }

    public boolean hasNext() {
        while (hasNextByte() && !isPrintableChar(buffer[ptr]))
            ptr++;
        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 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();
        }
    }

    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
            throw new NumberFormatException();
        return (int) nl;
    }

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

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

int main(){
  int n;
  cin >> n;
  map<int,int> mp;
  int free = 0;
  rep(i,n) {
    int a;
    cin >> a;
    if (a < 400) mp[0] = 1;
    else if (a < 800) mp[1] = 1;
    else if (a < 1200) mp[2] = 1;
    else if (a < 1600) mp[3] = 1;
    else if (a < 2000) mp[4] = 1;
    else if (a < 2400) mp[5] = 1;
    else if (a < 2800) mp[6] = 1;
    else if (a < 3200) mp[7] = 1;
    else free++; 
  }
  cout << (!mp.empty() ? mp.size() : 1) << " " << mp.size() + free << endl;
  return 0;
} 

Measured memory_bytes: 256
/**
 * File              : A.cpp
 * Author            : JCHRYS <jchrys@me.com>
 * Date              : 16.02.2020
 * Last Modified Date: 16.02.2020
 * Last Modified By  : JCHRYS <jchrys@me.com>
 */

#include <bits/stdc++.h>
using namespace std;

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    vector<int> v(10);
    v[a]++;v[b]++;v[c]++;
    for (int i = 0; i < 10; i++) {
        if (v[i] == 2) {
            cout << "Yes";
            return 0;
        }
    }
    cout << "No";
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath> // ??????
 
#define REP(i,n) for(int i = 0; i < n; i++)
 
using namespace std;
 
struct FourArithmeticOperationParser {
    
    int pos;
    bool div_zero;
    string Formula;
    const long long INF = 0x7fffffffffffffff;
    
    long long operator () (string F) {
        pos = 0;
        div_zero = false;
        Formula = F;
        long long ret = expr();
        return div_zero ? INF : ret;
    }
    
    long long number() {
        long long ret = 0;
        while (pos != Formula.size()) {
            if (Formula[pos] < '0' || Formula[pos] > '9') {
                break;
            } else {
                ret *= 10;
                ret += (Formula[pos++] - '0');
            }
        }
        return ret;
    }
    
    long long expr() {
        long long x = term();
        while (pos < Formula.size()) {
            switch (Formula[pos]) {
                case '+':
                    pos++;
                    x += term();
                    continue;
                case '-':
                    pos++;
                    x -= term();
                    continue;
            }
            break;
        }
        return x;
    }
    
    long long term() {
        long long x = factor();
        while (pos < Formula.size()) {
            switch (Formula[pos]) {
                case '*':
                    pos++;
                    x *= factor();
                    continue;
                case '/':
                    pos++;
                    long long div = factor();
                    if (div == 0) {
                        div_zero = true;
                    } else {
                        x /= div;
                    }
                    continue;
            }
            break;
        }
        return x;
    }
    
    long long factor() {
        if (pos < Formula.size()) {
            if (Formula[pos] == '(') {
                pos++;
                long long ret = expr();
                if (Formula[pos] == ')') {
                    pos++;
                }
                return ret;
            }
        }
        return number();
    }
    
};
 
int main() {
    
    int N; cin >> N;
    REP(i,N) {
        string s; cin >> s;
        cout << FourArithmeticOperationParser()(s.substr(0,s.size() - 1)) << endl;
    }
    
    return 0;
}

Measured memory_bytes: 3132
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
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;}
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(vec) vec.begin(),vec.end()
typedef long long ll;
typedef pair<ll,ll> l_l;
typedef pair<int,int> i_i;
const ll MOD=1e9+7;
const int INF=1<<30;

int dp[1010][1010];
vector<string> firld;

int main(){
  int H,W;
  cin >> H >> W;
  firld.resize(H);
  rep(i,H){
    cin >> firld[i];
  }
  rep(i,H){
    if(firld[i][0]=='#') break;
    dp[i][0]=1;
  }
  rep(j,W){
    if(firld[0][j]=='#') break;
    dp[0][j]=1;
  }
  for(int i=1;i<H;i++){
    for(int j=1;j<W;j++){
      if(firld[i][j]=='#') continue;
      dp[i][j]=(dp[i-1][j]+dp[i][j-1])%MOD;
    }
  }
  cout << dp[H-1][W-1] << endl;
}

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

int main(){
	int n,m,x,a[100];
  	int front=0,back=0;
	cin>>n>>m>>x;
  	for(int i=0;i<m;++i)cin>>a[i];
  	for(int i=1;i<x;++i){
    	for(int j=0;j<m;++j){
        	if(a[j]==i)++front;
        }
    }
  	for(int i=x;i<=n;++i){
    	for(int j=0;j<m;++j){
        	if(a[j]==i)++back;
        }
    }
  	cout<<min(front,back)<<endl;
  	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

#define MAX 100

int book[MAX],m,n;

bool check(int limit){
  int cnt = 0, sum = 0;

  for(int i = 0 ; i < n ; i++){
    if(book[i] > limit){
      return false;
    }

    sum += book[i];
    if(sum == limit){
      sum = 0;
      cnt++;
    }else if(sum > limit){
      sum = book[i];
      cnt++;
    }
  }

  if(sum > 0){
    cnt++;
  }

  return cnt <= m;
}

int main(){
  while(cin >> m >> n, (m|n)){
    for(int i = 0 ; i < n ; i++){
      cin >> book[i];
    }

    int lb = 0, ub = 1500000;
    while(ub - lb > 0){
      int mid = (lb + ub) / 2;

      if(check(mid)){
        ub = mid;
      }else{
        lb = mid + 1;
      }
    }
    cout << ub << endl;
  }

  return 0;
}

Measured memory_bytes: 1160
H, W= [int(x) for x in input().split()]
s_list = []
for h in range(H):
    s_list.append(input())
s_list.insert(0, "."*W)
s_list.append("."*W)

ans = []

for h in range(1, H+1):
    for w in range(W):
        count = 0
        if s_list[h][w]=="#":
            count = "#"
        else:   
            if w!=W-1:
                if s_list[h-1][w+1]=="#":
                    count += 1
                if s_list[h][w+1]=="#":
                    count += 1
                if s_list[h+1][w+1]=="#":
                    count += 1
            if w!=0:
                if s_list[h-1][w-1]=="#":
                    count += 1
                if s_list[h][w-1]=="#":
                    count += 1
                if s_list[h+1][w-1]=="#":
                    count += 1
            # ここからは上下 
            if s_list[h+1][w]=="#":
                    count += 1
            if s_list[h-1][w]=="#":
                count += 1
        
        ans.append(count)

for n in range(H):
    for a in ans[n*W:n*W+W]:
        print(a, end='')
    print()

Measured memory_bytes: 3572
#include <iostream>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <algorithm>

using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, s, n) for (int i = (s); i <= (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
typedef long long ll;

int main()
{
	string A, B, C;
	cin >> A >> B >> C;
	if ((*(A.end() - 1) == *B.begin())
		&& (*(B.end() - 1) == *C.begin())) cout << "YES" << endl;
	else cout << "NO" << endl;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ALL(A) (A).begin(), (A).end()
#define ll long long
#define rep(i, n) for (int i = 0; i < (n); i++)

using namespace std;
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 dx[] = { 0, 1, -1, 0, 1, -1, 1, -1 };  // i<4:4way i<8:8way
int dy[] = { 1, 0, 0, -1, 1, -1, -1, 1 };

const ll mod = 1e9 + 7;
const ll INF = -1 * ((1LL << 63) + 1);
const int inf = -1 * ((1 << 31) + 1);

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    int n;
    cin >> n;
    vector<vector<int>> a(n+1);
    for(int i=2;i<=n;i++){
        int x;
        cin >> x;
        a[x].push_back(i);
    }
    for(int i=1;i<=n;i++){
        cout << a[i].size() << endl;
    }
}

Measured memory_bytes: 14160
#include <iostream>
#include <string>
#include <sstream>
#include <utility>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <cmath>
#include <functional>
#include <chrono>
#include <cstring>
#include <limits.h>

using namespace std;
typedef long long lint;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef vector<lint> vl;
typedef pair<lint,lint> pll;

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

    int x, y; cin>>x>>y;

    int turleg = y - 2*x;
    if (turleg >= 0 && turleg%2 == 0 && turleg/2 <= x) cout<<"Yes";
    else cout<<"No";

}


Measured memory_bytes: 3652
# -*- coding: utf-8 -*-
import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect
import re
import queue
from decimal import *


class Scanner():
    @staticmethod
    def int():
        return int(sys.stdin.readline().rstrip())

    @staticmethod
    def string():
        return sys.stdin.readline().rstrip()

    @staticmethod
    def map_int():
        return [int(x) for x in Scanner.string().split()]

    @staticmethod
    def string_list(n):
        return [input() for i in range(n)]

    @staticmethod
    def int_list_list(n):
        return [Scanner.map_int() for i in range(n)]

    @staticmethod
    def int_cols_list(n):
        return [int(input()) for i in range(n)]


class Math():
    @staticmethod
    def gcd(a, b):
        if b == 0:
            return a
        return Math.gcd(b, a % b)

    @staticmethod
    def lcm(a, b):
        return (a * b) // Math.gcd(a, b)

    @staticmethod
    def divisor(n):
        res = []
        i = 1
        for i in range(1, int(n ** 0.5) + 1):
            if n % i == 0:
                res.append(i)
                if i != n // i:
                    res.append(n // i)
        return res

    @staticmethod
    def round_up(a, b):
        return -(-a // b)

    @staticmethod
    def is_prime(n):
        if n < 2:
            return False
        if n == 2:
            return True
        if n % 2 == 0:
            return False
        d = int(n ** 0.5) + 1
        for i in range(3, d + 1, 2):
            if n % i == 0:
                return False
        return True


class PriorityQueue:
    def __init__(self, l=[]):
        self.q = l
        heapq.heapify(self.q)
        return

    def push(self, n):
        heapq.heappush(self.q, n)
        return

    def pop(self):
        return heapq.heappop(self.q)


def pop_count(x):
    x = x - ((x >> 1) & 0x5555555555555555)
    x = (x & 0x3333333333333333) + ((x >> 2) & 0x3333333333333333)
    x = (x + (x >> 4)) & 0x0f0f0f0f0f0f0f0f
    x = x + (x >> 8)
    x = x + (x >> 16)
    x = x + (x >> 32)
    return x & 0x0000007f


MOD = int(1e09) + 7
INF = int(1e15)


def main():
    # sys.stdin = open("sample.txt")
    K, N = Scanner.map_int()
    A = Scanner.map_int()
    A.append(0)
    A.append(K)
    A.sort()
    l = [A[i + 1] - A[i] for i in range(len(A)-1)]
    ans = min(K - max(l), A[-2] - A[1])
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 104048
#include<bits/stdc++.h>
using namespace std;
#define gc getchar_unlocked
#define fo(i,n) for(int i=0;i<n;i++)
#define Fo(i,k,n) for(i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define ll long long
#define si(x)	scanf("%d",&x)
#define sl(x)	scanf("%lld",&x)
#define ss(s)	scanf("%s",s)
#define pi(x)	printf("%d\n",x)
#define pl(x)	printf("%lld\n",x)
#define ps(s)	printf("%s\n",s)
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
#define wi(t) int t;cin>>t;while(t--)
typedef pair<int, int>	pii;
typedef pair<ll, ll>	pl;
typedef vector<int>		vi;
typedef vector<ll>		vl;
typedef vector<pii>		vpii;
typedef vector<pl>		vpl;
typedef vector<vi>		vvi;
typedef vector<vl>		vvl;
mt19937_64 rang(chrono::high_resolution_clock::now().time_since_epoch().count());
int rng(int lim) {
	uniform_int_distribution<int> uid(0,lim-1);
	return uid(rang);
}
int mpow(int base, int exp); 
void ipgraph(int n, int m);
void dfs(int u, int par);

const int mod = 1000000007;
const int N = 3e5, M = N;
//=======================

vi g[N];
int a[N];

void solve()
    {
     string s;
     cin>>s;
     string ans;
      int diff=INT_MAX;
      for(int i=0;i<3;i++)
      ans+=s[i];
    diff=min(diff,abs(stoi(ans)-753));
     for(int i=3;i<s.length();i++)
     {
        ans.erase(ans.begin());
        ans.pb(s[i]);
        
           diff=min(diff,abs(stoi(ans)-753));
           
     }
     cout<<diff<<endl;
  
  
  
  
    }

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    srand(chrono::high_resolution_clock::now().time_since_epoch().count());

   // wi(t)
    {
      solve();
    }

    return 0;
}

int mpow(int base, int exp) {
  base %= mod;
  int result = 1;
  while (exp > 0) {
    if (exp & 1) result = ((ll)result * base) % mod;
    base = ((ll)base * base) % mod;
    exp >>= 1;
  }
  return result;
}

void ipgraph(int n, int m){
	int i, u, v;
	while(m--){
		cin>>u>>v;
    u--, v--;
		g[u].pb(v);
		g[v].pb(u);
	}
}

void dfs(int u, int par){
	for(int v:g[u]){
		if (v == par) continue;
		dfs(v, u);
	}
}







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

#define rep2(x,fr,to) for(int x=(fr);x<(to);x++)
#define rep(x,to) for(int x=0;x<(to);x++)
#define repr(x,fr,to) for(int x=(fr);x>=(to);x--)
#define all(c) c.begin(),c.end()
#define sz(v) (int)v.size()

using namespace std;
typedef long long ll; typedef vector<int> VI; typedef pair<int,int> pii;
typedef vector<ll> VL; const int MD = (int)1e9 + 7;
void dbg(){ cerr << "\n"; } template <typename T,typename ...T2> void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }
template <class T, class T2> void amax(T& a,T2 b){ if(a < b) a = b;}

int main()
{
	cin.tie(0); ios_base::sync_with_stdio(false);
	ll x;
	cin >>x;
	ll b =100;
	rep(i, 1000000){
		b = b + b/100;
		if(x <= b){
			cout<< i+1 <<"\n";
			break;
		}
	}
	return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define ALL(v) (v).begin(), (v).end()

using namespace std;
using ll = long long;

int main()
{
  int H, W, N; cin >> H >> W >> N;
  vector<int> a(N); REP(i, N) cin >> a[i];
  vector<int> c; REP(i, N) REP(j, a[i]) c.push_back(i+1);

  for (int i = 0; i < H; ++i) {
    for (int j = 0; j < W; ++j) {
      if (i%2==0) cout << c[i*W+j] << " ";
      else cout << c[i*W+W-(j+1)] << " ";
    }
    cout << endl;
  }

}

Measured memory_bytes: 384
#include <iostream>
#include <stdio.h>
#include <vector>
#include <numeric>

using namespace std;
typedef long long ll;

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

    vector<ll> count(500001, 0);
    for(int i=0; i<n; i++) count[a[i]]++;

    vector<ll> comb(500001, 0);
    ll sum = 0;
    for(int i=0; i<count.size(); i++){
        comb[i] = (count[i] * (count[i]-1)) / 2;
        sum += comb[i];
    }
    // ll sum = accumulate(comb.begin(), comb.end(), 0);

    for(int k=0; k<n; k++){
        ll ans = sum - count[a[k]] + 1;
        // ll ans = sum - comb[a[k]];
        // ans += ((count[a[k]] - 1) * (count[a[k]] - 2)) / 2;
        printf("%lld\n", ans);
    }

    return 0;
}

Measured memory_bytes: 11136
import sys
input = sys.stdin.readline
N=int(input())
mod=10**9+7
C=[int(input()) for i in range(N)]
M=max(C)+2
dp=[0]*(N+1)
co=[0]*M
co[C[0]]=1
for i in range(1,N+1):
    if i<N and C[i-1]==C[i]:
        continue
    dp[i]+=co[C[i-1]]
    if i<N:
        co[C[i]]+=dp[i]
        co[C[i]]%=mod
    #print(dp,co)
print(dp[-1])


Measured memory_bytes: 53084
#include <iostream>
#include <stdlib.h>
using namespace std;

class Stack {
    private:
        int store[10000];
        int head;
        int top;

    public:
        Stack() {
            head=0;
        }
 
        void push(int x) {
            head++;
            store[head]=x;
        }

        int pop(void){
            top = store[head];
            head--;
            return top;
        }
};
 
int main() {
    Stack stack;
    string str;
    int n, pre, post;

    while (cin >> str) {
        if (str == "+") {
            stack.push(stack.pop() + stack.pop());
        } else if (str == "-") {
            post = stack.pop();
            pre = stack.pop();
            stack.push(pre - post);
        } else if (str == "*") {
            stack.push(stack.pop() * stack.pop());
        } else {
            n = atoi(str.c_str());
            stack.push(n);
        }
    }

    cout << stack.pop() << endl;
    return 0;
}


Measured memory_bytes: 3192
#include<stdio.h>
int main()
{
  int n,i;
  long a[10000],min,max,sum;
  scanf("%d",&n);
  for(i=0; i<n; i++)
    {
      scanf("%ld",&a[i]);
    }
  sum=max=min=a[0];
  for(i=1; i<n; i++)
    {
      if(a[i]>max) max=a[i];
      if(a[i]<min) min=a[i];
      sum+=a[i];
    }
  printf("%ld %ld %ld\n",min,max,sum);
  return 0;
}

Measured memory_bytes: 676
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<map>
#include<string.h>
#include<complex>
#include<math.h>
#include<queue>
#include <functional>
#include<time.h>
#include <stack>
#include<iomanip>
using namespace std;
#define rep(i,a,n) for(int i=(a);i<(n);i++)
#define ll long long
#define llint long long int
#define reverse(v)  reverse(v.begin(), v.end());
#define Yes(ans) if(ans)cout<<"Yes"<<endl; else cout<<"No"<<endl;
#define YES(ans) if(ans)cout<<"YES"<<endl; else cout<<"NO"<<endl;
#define hei(a) vector<a>
#define whei(a) vector<vector<a>>
#define UF  UnionFind 
#define Pint pair<int,int>
#define keta(a)  fixed << setprecision(a)
constexpr auto INF = 1000000000;
constexpr auto mod = 1000000007;
//辞書順はnext_permutation( begin( v ), end( v ) );やで！
llint gcd(llint a, llint b) {
	if (b > a)swap(a, b);
	if (a % b == 0)return b;
	return gcd(b, a % b);
}
llint Tow(int m,int n) {//2のn乗
	if (n == 0)return 1;
	llint x = Tow(m,n / 2);
	x *= x;
	if (n % 2 == 1)x *= m;
	return x;
}
ll max(ll a, ll b) {
	if (a < b)return b;
	else return a;
}

int main() {
	int n;
	int ans = 0;
	cin >> n;
	int a[15], x[15][15], y[15][15];
	rep(i, 0, n) {
		cin >> a[i];
		rep(j, 0, a[i]) {
			cin >> x[i][j] >>y[i][j];
		}
	}
	stack<string> st;
	st.push("");
	while (!st.empty()){
		string now = st.top();
		st.pop();
		if (now.size() == n) {
			bool s = true;
			int sum = 0;
			rep(i, 0, n) {
				if (now[i] == '1') {
					sum++;
					rep(j, 0, a[i]) {
						if (now[x[i][j] - 1] == '1' && y[i][j] == 0)s=false;
						if (now[x[i][j] - 1] == '0' && y[i][j] == 1)s = false;
					}
				}
			}
			if (s)ans = max(ans, sum);
		}
		else {
			rep(i, 0, 2) {
				string k = now + to_string(i);
				st.push(k);
			}
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <climits>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#define INF_INT (INT_MAX / 2)
#define INF_LONG (LONG_MAX / 2)
//#define DEBUG true
#define DEBUG false
using namespace std;

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

  int a, b, c, x;
  cin >> a >> b >> c >> x;

  int count = 0;
  for(int i = 0; i <= a; i ++){
    for(int j = 0; j <= b; j++){
      for(int k = 0; k <= c; k++){
        if(500 * i + 100 * j + 50 * k == x) ++count;
      }
    }
  }

  cout << count << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define rep(i,a,b) for(int i = (a);i <= (b);i++)
#define pii pair<int,int>
#define pll pair<long long, long long>
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll mod = 1e9 + 7;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const int inf = 0x3f3f3f3f;
const int maxn = 2e5 + 5;
const int maxm = 1e6 + 5;
const double eps = 1e-8;
const double pi = acos(-1.0);
ll gcd(ll a,ll b){return !b?a:gcd(b,a%b);}
ll lcm(ll a,ll b){return a * b / gcd(a,b);}
ll poww(ll x,ll y,ll p){ll ans = 1;while(y){if(y & 1) ans = ans * x % p;x = x * x % p;y >>= 1;}return ans % p;}
bool isp(ll x){if(x <= 1) return 0; for(ll i = 2;i * i <= x;i++){if(x % i == 0) return 0;}return 1;}
int n,ans,x;
int main(){
 	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	cin >> n;
	int mi = inf;
	for(int i = 0;i < n;i++){
		cin >> x;
		if(mi >= x) ans++;
		mi = min(x,mi);
	}
	cout << ans << endl;
	return 0;
}
//do smt instead of nothing! never give up!
//take care of long long!
//take care of upper or lower case e.g "yes" or "YES"?
//boundary condition! e.g. n = 0?
//brute force is always the first choice!
// print the ans to look for patterns in the data!

Measured memory_bytes: 256
#include <cstring>
#include <iostream>
#define W 101
#define H 101
using namespace std;
int main() {
  int h, w, x, y;
  char m[H][W];
  bool n[H][W];
  while (cin >> h >> w && h > 0) {
    memset(m, '.', sizeof(char) * H * W);
    memset(n, 0, sizeof(bool) * H * W);
    for (y = 0; y < h; y++) {
      cin >> m[y];
    }
    x = y = 0;
    while (1) {
      if (n[y][x]) {
        cout << "LOOP" << endl;
        break;
      }
      n[y][x] = 1;
      if (m[y][x] == '^') y--;
      else if (m[y][x] == '>') x++;
      else if (m[y][x] == 'v') y++;
      else if (m[y][x] == '<') x--;
      else {
        cout << x << ' ' << y << endl;
        break;
      }
    }
  }
  return 0;
}

Measured memory_bytes: 1192
#6人、初期ポイント3、4回答した
n, k, q = map(int, input().split())
person = [int(input()) for i in range(q)]
list=[k-q for i in range(n)]
for i in person:
  list[i-1]+=1
for i in list:
  if i<=0:
    print("No")
  else:
    print("Yes")

Measured memory_bytes: 11784
#include <cstdio>
#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
using namespace std;

int main()
{
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	int sum = a + b + c + d;
	cout << (sum / 60) << endl;
	cout << (sum % 60) << endl;
}


Measured memory_bytes: 3088
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;



#define SIZE 200005

int N;
vector<string> V;
map<string,int> MAP;

int main(){

	scanf("%d",&N);

	int maximum = 0;

	for(int i = 0; i < N; i++){

		string tmp_str;

		cin >> tmp_str;

		auto at = MAP.find(tmp_str);
		if(at != MAP.end()){

			MAP[tmp_str]++;
		}else{

			MAP[tmp_str] = 1;
		}

		maximum = max(maximum,MAP[tmp_str]);
		V.push_back(tmp_str);
	}

	sort(V.begin(),V.end());
	V.erase(unique(V.begin(),V.end()),V.end());

	for(int i = 0; i < V.size(); i++){
		if(MAP[V[i]] == maximum){

			printf("%s\n",V[i].c_str());
		}
	}

	return 0;
}


Measured memory_bytes: 26736
#include <iostream>
using namespace std;
 
const int N = 1e5+5, INF = 1e9+9;
int n, k, a[N], dp[N];
 
int main()
{
  cin >> n >> k;
  for (int i = 1; i <= n; i++)
  {
    cin >> a[i];
    dp[i] = INF;
  }
  dp[1] = 0;
  for (int i = 1; i <= n; i++)
  {
    for (int j = i+1; j <= min(i+k, n); j++)
    {
      dp[j] = min(dp[j], dp[i] + abs(a[i]-a[j]));
    }
  }
  cout << dp[n];
}

Measured memory_bytes: 1024
#include<iostream>
#define _USE_MATH_DEFINES
#include<math.h>
#include<vector>
#include<array>
#include<algorithm>
#include<numeric>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<set>
#include<cstdio>
#include<cstring>
#include<string>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vector<ll>> mat;
typedef pair<ll,ll> P;
typedef map<ll,ll> MP;
typedef priority_queue<ll> PQ;
#define pb push_back
#define st first
#define nd second
#define SZ(x) ((int)(x).size())
#define FOR(i,s,n) for(int i=(int)(s); i< (int)(n); i++)
#define rep(i,n) FOR(i,0,n)
#define all(x) (x).begin(),(x).end()
#define each(x,c) for(auto x: (c))
#define LB(x,a) lower_bound(all(x), a)
#define UB(x,a) upper_bound(all(x), a)
const ll mod=1e9+7;
const ll INF=1e18;
const double EPS=1.0e-10;
const double PI=M_PI;

int main(){
    int N; scanf("%d",&N);
    vector<P> A(N);
    rep(i,N){
        scanf("%lld",&A[i].st);
        A[i].nd=i%2;
    }
    sort(all(A));
    int ans=0;
    rep(i,(N+1)/2){
        if(A[2*i].nd==1) ans++;
    }
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
#define MOD 1000000007

int main(){
    int x;
    cin >> x;
    if(x==1) cout <<"0"  << endl;
    else cout << "1" << endl;
}

Measured memory_bytes: 3628
import java.util.Scanner;
 
class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int h = sc.nextInt();
        int w = sc.nextInt();

        while(h != 0 || w != 0){
            StringBuilder sb = new StringBuilder();
            for(int i = 0; i < h; i++){
 
                for(int j = 0; j < w; j++){
                    if((i + j) % 2 == 0 ){
                        sb.append("#");
                    }else{
                        sb.append(".");
                    }
                }
                sb.append("\n");
 
            }
            System.out.println(sb);
 
            h = sc.nextInt();
            w = sc.nextInt();
        }
    }
}

Measured memory_bytes: 27724
#include <bits/stdc++.h>
using namespace std;
const int N = 88;

int n, m;
int a[N][N];
bool dp[N][N][N * 2 * 2 * N];

int main()
{
    scanf("%d%d", &n, &m);
    for (int i = 0; i < n; ++i)
    {
        for (int j = 0; j < m; ++j)
            scanf("%d", &a[i][j]);
    }
    for (int i = 0; i < n; ++i)
    {
        for (int j = 0; j < m; ++j)
        {
            int x;
            scanf("%d", &x);
            a[i][j] -= x;
        }
    }
    dp[0][0][a[0][0] + N * N * 2] = true;
    for (int i = 0; i < n; ++i)
    {
        for (int j = 0; j < m; ++j)
        {
            for (int k = 0; k < N * N * 4; ++k)
            {
                if (!dp[i][j][k])
                    continue;
                if (i + 1 < n)
                {
                    dp[i + 1][j][k + a[i + 1][j]] = true;
                    dp[i + 1][j][k - a[i + 1][j]] = true;
                }
                if (j + 1 < m)
                {
                    dp[i][j + 1][k + a[i][j + 1]] = true;
                    dp[i][j + 1][k - a[i][j + 1]] = true;
                }
            }
        }
    }
    int ans = 1000000009;
    for (int k = 0; k < N * N * 4; ++k)
    {
        if (dp[n - 1][m - 1][k])
            ans = min(ans, abs(k - N * N * 2));
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 211840