akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <iostream>
#include <cassert>
#include <algorithm>    
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <cstring>
#include <cmath>
#include <bitset>
#define pb push_back
#define mk make_pair
#define eb emplace_back
#define eps 1e-8
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
// #define int long long
using namespace std;

typedef long double ld;
typedef unsigned int ui;
typedef pair<int,int> pii;
typedef unsigned long long ull; 
typedef vector<int> vii;
typedef vector<long double> vd;
const int inf = 1e9;
const int M = 1e9 + 7;
//__int128

signed main()
{
  ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
  int n, m;
  cin >> n >> m;
  static int a[300][300];
  for(int i = 0; i < n; ++i) {
  	for(int j = 0; j < m; ++j) {
  		cin >> a[i][j];
  		--a[i][j];
  	}
  }  
  bitset<300> vis;
 	int res = n;
 	int T = m;
 	while(T--) {
 		std::vector<int> c(m, 0);
 		for(int i = 0; i < n; ++i) {
 			for(int j = 0; j < m; ++j) {
 				if(!vis[a[i][j]]) {
 					c[a[i][j]]++;		
 					break;
 				}
 			}
 		}
 		res = min(res, *max_element(all(c)));
 		vis[max_element(all(c)) - c.begin()] = 1;
 	}
 	cout << res << endl;
	return 0;
}

Measured memory_bytes: 640
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) {
		FastScanner sc = new FastScanner(System.in);
		System.out.println(sc.next().equals("ABC") ? "ARC" : "ABC");
	}

	static class FastScanner {
		private BufferedReader reader;
		private StringTokenizer tokenizer;

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

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

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

			return tokenizer.nextToken("\n");
		}

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

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

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

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

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

#define pb         push_back

const int INF = 100000000;

int main(void) {
	int e;
	while(cin >> e, e){
		int x, y, z;
		int ans = INT_MAX;

		for(int i=0; i<=1000; i++){
			for(int j=0; j<=100; j++){
				x = e - i*i - j*j*j;
				if(x >= 0){
					ans = min(ans, x + i + j);
				}
			}
		}

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

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
 
/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
    sizeは(int)とキャストしよう
    ごちゃごちゃ場合分けを考える前に全探索は考えましたか？
    詰まった時に、別の分野の問題として考え直す（これdpでは？、グラフとしてみればいいのでは？）
    多くの問題はパターンマッチだが、パターンに落とし込むまでが難しく、そのための訓練としてわからない問題をあれこれ色々な角度から考察してみるのではないか
*/

const ll mod = 1e9+7;

void chmod(ll &M){
    if(M >= mod) M %= mod;
    else if(M < 0){
        M += (abs(M)/mod + 1)*mod;
        M %= mod;
    }
}

ll modpow(ll x, ll n){
    if(n == 0) return 1;

    ll res = modpow(x, n/2);
    if(n%2 == 0) return res*res%mod;
    else return res*res%mod*x%mod;
}

ll power(ll x, ll n){
    if(n == 0) return 1;

    ll res = power(x, n/2);
    if(n%2 == 0) return res*res;
    else return res*res*x;
}

int getl(int i, int N) { return i==0? N-1:i-1; };
int getr(int i, int N) { return i==N-1? 0:i+1; };

/* <--------------------------------------------> */

typedef tuple<ll, ll, ll> T;



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

    ll n; cin >> n;
    string s; cin >> s;

    ll ans = 1;
    ll cord = 0;

    for(int i=0; i<2*n; ++i){
        if(s[i] == 'W'){
            if(cord%2 == 0){
                if(cord == 0) {
                    cout << 0 << endl;
                    return 0;
                }
                else{
                    ans *= cord;
                    chmod(ans);
                    --cord;
                    if(i == 2*n-1 && cord != 0){
                        cout << 0 << endl;
                        return 0;
                    }
                }
            }
            else{
                ++cord;
                if(i == 2*n-1){
                    cout << 0 << endl;
                    return 0;
                }
            }
        }
        else{
            if(cord%2 == 0){
                ++cord;
                if(i == 2*n-1){
                    cout << 0 << endl;
                    return 0;
                }
            }
            else{
                ans *= cord;
                chmod(ans);
                --cord;
                if(i == 2*n-1 && cord != 0){
                    cout << 0 << endl;
                    return 0;
                }
            }
        }
    }
    

    for(int i=1; i<=n; ++i){
        ans *= i;
        chmod(ans);
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 720
#include <bits/stdc++.h>
    #include <cstdio>
    #include <cstring>
    #include <cmath>
    #include <cstring>
    #include <chrono>
    #include <complex>
    #define ll long long int
    #define ld long double
    #define vi vector<int>
    #define vll vector<ll>
    #define vvi vector < vi >
    #define pii pair<int,int>
    #define pll pair<long long, long long>
    #define mod 1000000007
    #define inf 1000000000000000001;
    #define all(c) c.begin(),c.end()
    #define mp(x,y) make_pair(x,y)
    #define mem(a,val) memset(a,val,sizeof(a))
    #define eb emplace_back
    #define pb push_back
    #define f first
    #define s second
    
    using namespace std;

    int main()
    {
        std::ios::sync_with_stdio(false);
        int T;
        T=1;
        // cin.ignore(); must be there when using getline(cin, s)
        while(T--)
        {
            string s;
            int n,i,x;
            cin>>n;
            cin>>s;
            
            for(i=0;i<s.length();++i)
            {
                x=s[i]-'A';
                x=(x+n)%26;
                cout<<(char)('A'+x);
            }
            cout<<endl;
        }
        return 0;
    }


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

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    int n; cin >> n;
    ld den = 0;
    for (int i = 0; i < n; i++) {
        int ai; cin >> ai;
        den += (ld)(1.0)/(ld)(ai);
    }
    den = (ld)(1.0)/den;
    cout << fixed << setprecision(10) << den << '\n';

}



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

using namespace std;

#define llong long long int
#define rep(i, n) for (int i = 0; i < n; ++i) 
#define stl_rep(itr, x) for (auto itr = x.begin(); itr != x.end(); ++itr)
#define stl_repr(itr, x) for (auto itr = x.begin(); itr != x.end(); ++itr)
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()

const static int MOD = 1000000000 + 7;
const static int inf = INT_MAX / 2;
const static llong INF = 1LL << 31;
const static int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

vector<llong> dp;

int main (int argc, char *argv[]) {
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n, m;
    cin >> n >> m;
    vector<int> A(m);
    rep(i, m) cin >> A[i];

    dp.resize(n, 0);
    for (int i = 0; i < n; ++i) {
        if (i == 0) {
            if (upper_bound(all(A), i + 1) - lower_bound(all(A), i + 1)) continue;
            else dp[i] = 1;
        } else if (i == 1) {
            if (upper_bound(all(A), i + 1) - lower_bound(all(A), i + 1)) continue;
            else dp[i] = dp[i - 1] + 1;
        } else {
            if (upper_bound(all(A), i + 1) - lower_bound(all(A), i + 1)) continue;
            dp[i] = dp[i - 1] % MOD + dp[i - 2] % MOD;
        }
    }

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

    return 0;
}

Measured memory_bytes: 1408
#include <cstdio>
#include <algorithm>
#ifdef WIN32
#define L_L "%I64d"
#else
#define L_L "%lld"
#endif
#define IL inline
#define N 100003
#define REP(a,b,c) for(a=b;a<=c;a++)
#define PER(a,b,c) for(a=b;a>=c;a--)
using namespace std;
typedef long long lol;
lol tot;
int n,m,a[N*3];lol pre[N],suf[N];
IL int rd(){
	int res=0;char c;while((c=getchar())<'0'||c>'9');
	while(c>='0'&&c<='9')res=res*10+c-'0',c=getchar();return res;
}
IL bool greater(int a,int b){return a>b;}
IL bool smaller(int a,int b){return a<b;}
struct Heap{
	int a[N],len;
	bool (*cmp)(int a,int b);
	IL void set(bool (*f)(int,int)){cmp=f;}
	IL void up(int i){
		int j=i>>1,x=a[i];
		while(j && cmp(x,a[j]))a[i]=a[j],i=j,j>>=1;
		a[i]=x;
	}
	IL void down(int i){
		int j=i<<1,x=a[i];
		while(j<=len){
			if(j<len && cmp(a[j+1],a[j]))j++;
			if(cmp(a[j],x))a[i]=a[j],i=j,j<<=1;
			else break;
		}
		a[i]=x;
	}
	IL void clear(){len=0;cmp=NULL;}
	IL void push(int b){a[++len]=b;up(len);}
	IL int pop(){int b=a[1];a[1]=a[len--];if(len)down(1);return b;}
}H;
int main(){
	n=rd(),m=n*3;int i;
	REP(i,1,m)a[i]=rd();H.set(smaller);
	REP(i,1,n)H.push(a[i]),tot+=a[i];
	pre[0]=tot;
	REP(i,1,n)H.push(a[n+i]),tot+=a[n+i]-H.pop(),pre[i]=tot;
	H.clear();H.set(greater);tot=0;
	REP(i,1,n)H.push(a[m-i+1]),tot+=a[m-i+1];
	suf[n+1]=tot;
	PER(i,n,1)H.push(a[n+i]),tot+=a[n+i]-H.pop(),suf[i]=tot;
	tot=-tot;
	REP(i,0,n)tot=max(tot,pre[i]-suf[i+1]);
	printf(L_L,tot);
  return 0;
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#define INF 1000000021
#define MOD 1000000007
#define pb push_back
#define sqr(a) (a)*(a)
#define M(a, b) make_pair(a,b)
#define F first
#define S second
#define all(x) (x.begin(), x.end())
#define deb(x) cerr << #x << " = " << x << '\n'
#define N 222222

using namespace std;
using namespace __gnu_pbds;

typedef long double ld;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;

const ld pi = 2 * acos(0.0);
template<class T> bool umin(T& a, T b){if(a>b){a=b;return 1;}return 0;}
template<class T> bool umax(T& a, T b){if(a<b){a=b;return 1;}return 0;}
template<class T, class TT> bool pal(T a, TT n){int k=0;for(int i=0;i<=n/2;i++){if(a[i]!=a[n-i-1]){k=1;break;}}return k?0:1;}

//int month[] = {0,31,28,31,30,31,30,31,31,30,31,30,31};

vi v[N];
int used[N],p[N];
int main()
{
	int n, m;
	cin >> n >> m;
	for(int i = 1; i <= m; i ++)
	{
		int x, y;
		cin >> x >> y;
		v[x].pb(y);
		v[y].pb(x);
	}
	used[1] = 1;
	queue<int> q;
	q.push(1);
	while(q.size())
	{
		int u = q.front();
		q.pop();
		for(auto it : v[u])
		{
			if(used[it])
				continue;
			p[it] = u;
			q.push(it);
			used[it] = 1;
		}
	}
	cout << "Yes\n";
	for(int i = 2; i <= n; i ++)
		cout << p[i] << '\n';





	





	getchar();
	getchar();
	return 0;
	//ios::sync_with_stdio(false);
	//cin.tie(0);
}

Measured memory_bytes: 13696
#include<bits/stdc++.h>
#define con continue
#define pb push_back
#define fi first
#define se second
#define fr front()
#define one 1.0
#define inf 1000000000000000000
#define ret return
#define all(vl) vl.begin(),vl.end()
#define sor sort 
#define cl clear()
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef map<ll,ll>::iterator itll;
typedef long double ld;
typedef map<ll,ll> mapll;
typedef double dou;
#define int ll
ll gcd(ll a,ll b)
{
	return (b == 0?a:gcd(b,a%b));
}
ll lcm(ll a,ll b)
{
	return (a*b)/gcd(a,b);
}
ll getlcm(vector<ll> vl)
{
	ll ch = 1;
	for(int i=0;i<vl.size();i++)
	{
		ch = lcm(ch,vl[i]);
	}
	return ch;
}
signed main()
{
	ll n,m;
	cin>>n>>m;
	vector<ll> vl(n);
	for(int i=0;i<n;i++)
	{
		cin>>vl[i];
		vl[i]/=2;
	} 
	ll ch = getlcm(vl); 
	ll pl = ch*2;
	ll he = ch;
	for(int i=0;i<n;i++)
	{
		if((ch/vl[i])%2 == 0)
		{
			cout<<"0\n";ret 0;
		}
	}/*
	ll cnt = 1;
	if(m<ch)
	{
		cout<<"0\n";ret 0;
	}
	cnt+=((m-ch)/pl);*/
	cout<<(m+ch)/pl<<endl;
	return 0;
}

Measured memory_bytes: 1792
n,m=map(int,input().split())
x=list(map(int,input().split()))
x.sort()
ans=[]
for i in range(m-1):
    ans.append(x[i+1]-x[i])
ans.sort()
if n<m:
    print(sum(ans[:m-n]))
else:
    print(0)

Measured memory_bytes: 13968
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.*;


public class Main {

    int A,B,C;

    private void solve() {
        A = nextInt();
        B = nextInt();
        C = nextInt();

        if (A + B >= C) {
            out.println("Yes");
        } else {
            out.println("No");
        }
    }

    public static void main(String[] args) {
        out.flush();
        new Main().solve();
        out.close();
    }

    /* Input */
    private static final InputStream in = System.in;
    private static final PrintWriter out = new PrintWriter(System.out);
    private final byte[] buffer = new byte[2048];
    private int p = 0;
    private int buflen = 0;

    private boolean hasNextByte() {
        if (p < buflen)
            return true;
        p = 0;
        try {
            buflen = in.read(buffer);
        } catch (IOException e) {
            e.printStackTrace();
        }
        if (buflen <= 0)
            return false;
        return true;
    }

    public boolean hasNext() {
        while (hasNextByte() && !isPrint(buffer[p])) {
            p++;
        }
        return hasNextByte();
    }

    private boolean isPrint(int ch) {
        if (ch >= '!' && ch <= '~')
            return true;
        return false;
    }

    private int nextByte() {
        if (!hasNextByte())
            return -1;
        return buffer[p++];
    }

    public String next() {
        if (!hasNext())
            throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = -1;
        while (isPrint((b = nextByte()))) {
            sb.appendCodePoint(b);
        }
        return sb.toString();
    }

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

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

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

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

using namespace std;

#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define INF (1LL << 55)
#define MOD (1000 * 1000 * 1000 + 7)
#define maxn 200111

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

int arr[maxn];

int main(){
	int n;
	scanf("%d", &n);
	int mx = 0;
	for(int i = 1; i <= n; i++){
		scanf("%d", arr + i);
		if(arr[mx] < arr[i])
			mx = i;
	}

	int vred = arr[mx] / 2;
	int ans = (mx != 1) ? 1 : 2;

	for(int i = 2; i <= n; i++){
		if(i == mx)
			continue;

		if(abs(vred - arr[i]) < abs(vred - arr[ans]))
			ans = i;
	}

	printf("%d %d\n", arr[mx], arr[ans]);
	return 0;
}

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

using namespace std;

int n;
const int INF = 1e9 + 7;
int t[100010];
int a[100001];
bool hugou;


int main() {

  cin >> n;

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

  fill(t,t+n-1,INF);

  for(int i = 1; i < n; i++) t[i-1] = a[i] - a[i-1];

 

  int k = 0;
  while(t[k] == 0) k++;

  if(t[k] > 0) hugou = true;

  int ans = 0;
  
  for(int i = k; i < n-1; i++) {
    if(hugou && t[i] < 0) {
      i++;
      ans++;
      while(t[i] == 0) i++;
      if(t[i] < 0) hugou = false;
    }

    else if(!hugou && t[i] > 0) {
      i++;
      ans++;
      while(t[i] == 0) i++;
      if(t[i] > 0) hugou = true;
    }
  }
    
  
  cout << ans + 1 << endl;
}


Measured memory_bytes: 1024
A, B, C, D = map(int, input().split())
ans = -1

AB = [i for i in range(A, B+1)]
CD = [i for i in range(C, D+1)]

for sec in AB:
    if sec in CD:
        ans += 1

if ans == -1:
    print(0)
else:
    print(ans)


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

int main(void) {
  int month, day;

  int days[12] = {
    31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
  };

  char names[7][10] = {
    "Thursday",
    "Friday",
    "Saturday",
    "Sunday",
    "Monday",
    "Tuesday",
    "Wednesday"
  };

  for (;;) {
    scanf("%d%d", &month, &day);

    if (month == day && !day) {
      break;
    }

    for (month--; month; month--) {
      day += days[month - 1];
    }

    printf("%s\n", names[(day - 1) % 7]);
  }

  return EXIT_SUCCESS;
}

Measured memory_bytes: 584
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<iomanip>
#include<vector>
#include<queue>
#include<deque>
#include<string>
#include<utility>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<set>
#include<map>
#include<bitset>
#include<stack>
#include<ctime>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,int> pli;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef vector<pli> vpli;
typedef vector<vi> mat;

inline ll read(){
	ll Hashimoto=0,Kanna=1;
	char I_Love=getchar();
	while(I_Love<'0'||I_Love>'9'){
		if(I_Love=='-')Kanna=-1;
		I_Love=getchar();
	}
	while(I_Love>='0'&&I_Love<='9'){
		Hashimoto=Hashimoto*10+I_Love-'0';
		I_Love=getchar();
	}
	return Hashimoto*Kanna;
}

#define I_Love_Hashimoto_Kanna main
#define fastio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define filein(s) freopen(s,"r",stdin);
#define fileout(s) freopen(s,"w",stdout);
#define file freopen("I_Love_Hashimoto_Kanna.out","w",stdout);
#define RE cout<<"I_Love_Hashimoto_Kanna"<<endl;
#define Tone(Kanna) cout<<Kanna<<endl;
#define Tall(Hashimoto,Kanna) for(int I_Love=0;I_Love<Kanna;I_Love++)cout<<Hashimoto[I_Love]<<(I_Love==Kanna-1?"\n":" ");
#define FOR(I_Love,Hashimoto,Kanna) for(int I_Love=Hashimoto;I_Love<Kanna;I_Love++)
#define MP(Hashimoto,Kanna) make_pair(Hashimoto,Kanna)
#define REV(Kanna) reverse(Kanna.begin(),Kanna.end());
#define SORT(Kanna) sort(Kanna.begin(),Kanna.end());
#define inf (int)1e9
#define linf (ll)1e18
#define mod (inf+7)

string s;
int a;

int I_Love_Hashimoto_Kanna() {
  fastio;
  cin>>s>>a;
  string ans="";
  FOR(i,0,s.size()){
  	if(i%a==0)ans.push_back(s[i]);
	}
  
  Tone(ans)
  
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
    int t,a,b;
    scanf("%d",&t);
    while (t--) {
        scanf("%d%d",&a,&b);
        int tmp = (int)sqrt(1ll*a*b);
        int ans = 2*(int)sqrt(1ll*a*b)-1;
        if (1ll*tmp*tmp == 1ll*a*b && a != b) ans--;
        if (1ll*tmp*(tmp+1) >= 1ll*a*b) ans--;
        printf("%d\n",ans);
    }
    return 0;
}

Measured memory_bytes: 256
N = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))

sm = 0

for x in a:
    if x != a[0]:
        if x == num + 1:
            sm += c[num-1]
    sm += b[x-1]

    num = x

print(sm)

Measured memory_bytes: 3064
n, t = gets.split(" ").map(&:to_i)
ary = []
n.times do
  ary << gets.split(" ").map(&:to_i)
end

min = 1001
num = -1

n.times do |i|
    if ary[i][1] <= t && ary[i][0] < min
        min = ary[i][0]
        num = i
    end
end

puts num >= 0 ? min : "TLE"


Measured memory_bytes: 1788
// In the name of God

#include <iostream>
#include <algorithm>
#include <fstream>
#include <vector>
#include <deque>
#include <assert.h>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <stdio.h>
#include <string.h>
#include <utility>
#include <math.h>
#include <bitset>
#include <iomanip>
#include <complex>

using namespace std;

#define rep(i, a, b) for (int i = (a), i##_end_ = (b); i < i##_end_; ++i)
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define mp make_pair
#define x first
#define y second
#define pb push_back
#define SZ(x) (int((x).size()))
#define ALL(x) (x).begin(), (x).end()

template<typename T> inline bool chkmin(T &a, const T &b) { return a > b ? a = b, 1 : 0; }
template<typename T> inline bool chkmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; }
template<typename T> inline bool smin(T &a, const T &b)   { return a > b ? a = b : a;    }
template<typename T> inline bool smax(T &a, const T &b)   { return a < b ? a = b : a;    }

typedef long long LL;

const int N = (int) 0, mod = (int) 0;

int main() {
	int reach;
	cin >> reach;
	int cur = 0, sum = 0;
	while (true) {
		cur++;
		sum += cur;
		if (sum >= reach) {
			cout << cur << endl;
			return 0;
		}
	}
}


Measured memory_bytes: 256
X, K, D = map(int, input().split())

X = abs(X)
time = X//D
rest = K - time

if rest <= 0:
    print(X-K*D)
elif rest%2 == 0:
    print(min(X-time*D, abs(X-(time+2)*D)))
else:
    print(min(X-(time-1)*D, abs(X-(time+1)*D)))

Measured memory_bytes: 9212
use std::io::{self, Read};

fn main() {
    let mut buffer = String::new();
    io::stdin().read_to_string(&mut buffer);

    let st: Vec<&str> = buffer.split_terminator(" ").map(|v| v.trim()).collect();

    let f = st.get(0).unwrap().parse::<f32>().unwrap();
    let s = st.get(1).unwrap().parse::<f32>().unwrap();

    println!("{}", ((s - f) / (f - (1 as f32))).ceil() + (1 as f32));
}


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

int n,m;int parent[50];int size[50];

struct Node {
  int from,to;
};

Node nodes[50];

int getparent(int id) {
  if (parent[id]==id) return id;
  else return getparent(parent[id]);
}

bool issame(int a,int b) {
  return getparent(a)==getparent(b);
}

void unite(int a,int b) {
  int parent_a=getparent(a);
  int parent_b=getparent(b);
  if (parent_a==parent_b) return;
  else {
    if (size[parent_a]<size[parent_b]) {
      parent[parent_a]=parent_b;
      size[parent_b]++;
    }
    else {
      parent[parent_b]=parent_a;
      size[parent_a]++;
    }
    return;
  }
}

int main() {
  cin >> n >> m;
  for (int i=0;i<m;i++) {
    int a,b;
    cin >> a >> b;a--;b--;
    nodes[i].from=a,nodes[i].to=b;
  }
  int count=m;
  for (int i=0;i<m;i++) {
    for (int j=0;j<n;j++) {
      parent[j]=j;
      size[j]=1;
    }
    for (int j=0;j<m;j++) {
      if (j!=i) {
        if (!issame(nodes[j].from,nodes[j].to)) {
        unite(nodes[j].from,nodes[j].to);
        }
      }
    }
    if (issame(nodes[i].from,nodes[i].to)) count--;
  }
  cout << count << endl;
}

Measured memory_bytes: 256
//Mahir Ratanpara (DA-IICT)
#include<bits/stdc++.h>
using namespace std;
#define Ff(i,a,n) for(i=a;i<n;i++)
#define Fr(i,a,n) for(i=a;i>n;i--)
#define ll long long
#define FAST ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
#define pb push_back
#define mp make_pair
#define ff first
#define ss 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++)
typedef pair<ll, ll>	pa;
typedef vector<ll>		vc;
typedef vector<pa>		vp;
typedef vector<vc>		vvc;
int mpow(int base, int exp); 
void ipgraph(int m);
void dfs(int u, int par);
const int mod = 1000000007;
const int N = 3e5, M = N;
//=======================

vc g[N];
ll a[N];

int main() {
    FAST;
    ll t, i, j, k, p, q, r, x, y, u, v, n, m;
    cin>>n;
	map<ll,ll> mp; 
	Ff(i,0,n) cin>>a[i],mp[a[i]]++;
	ll ans=0;
	tr(itr,mp)
	{
		ll b=itr->ss;
		ans+=(b*(b-1))/2;
	}

	ll cnt=0;
	Ff(i,0,n)
	{
		ll b=mp[a[i]];
		cnt=ans-(b*(b-1)/2);
		b--;
		cnt+=(b*(b-1))/2;
		cout<<cnt<<endl;
	}
    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;
		g[u-1].pb(v-1);
		g[v-1].pb(u-1);
	}
}

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

Measured memory_bytes: 18432
#include<stdio.h>
int main(void)
{
	int n,k,a,b,c=0;
	scanf("%d %d",&n,&k);
	for(a=1;a<=n;a++){
		scanf("%d",&b);
		if(k<=b){
			c++;
		}
	}
		printf("%d\n",c);
	return 0;
}

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

#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define RFOR(i, a, b) for(int i=(a); i>=(b); i--)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, n, 0)
#define CEIL(n, m) ceil(n/pow(10.0, m))*pow(10.0, m)
#define FLOOR(n, m) floor(n/pow(10.0, m))*pow(10.0, m)
#define ROUND(n, m) round(n/pow(10.0, m))*pow(10.0, m)
#define ALL(x) (x).begin(),(x).end()
#define SORT(x) sort((x).begin(),(x).end())
#define RSORT(x) sort((x).begin(),(x).end(),greater<int>())
#define SZ(x) ((int)(x).size())
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) " (L" << __LINE__ << ") " << __FILE__ << endl;

typedef long long ll;
const int mod = 1e9+7;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const int inf = 0x3f3f3f3f;

void solve()
{

  int n; cin>>n;
  vector<int> t(n, 0);
  vector<int> x(n, 0);
  vector<int> y(n, 0);
  for (int i=0; i<n; i++) {
    cin>>t[i]>>x[i]>>y[i];
  }

  string ans="Yes";
  int ct=0, cx=0, cy=0;
  for (int i=0; i<n; i++) {
    int dis = abs(x[i]-cx)+abs(y[i]-cy);
    int dt = t[i]-ct;
    if (dt < dis || (dt-dis)%2!=0) {
      ans = "No";
      break;
    }
    ct = t[i];
    cx = x[i];
    cy = y[i];
  }

  cout << ans << endl;
}

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


Measured memory_bytes: 1408
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define bit(n) (1<<(n))
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
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 const INF = 1001001001;


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

ll N,K;
cin >> N >> K;
if(K == 0) {
    cout << N*N << endl;
    return 0;
}
ll ans = 0;
for(ll b = K+1; b <= N; ++b) {
    ll p = N / b;
    ll r = N % b;
    if(r < K) ans += (b-K) * p;
    else ans += (b-K) * p + r - K + 1;
}
cout << ans << endl;
return 0;
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
// header {{{
#include <bits/stdc++.h>
using namespace std;
#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x,y) x ## y
#define ASSERT(expr...) assert((expr))
using i8  = int8_t;
using u8  = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
using f32 = float;
using f64 = double;
using f80 = __float80;
// }}}
constexpr i64 INF = 1'010'000'000'000'000'017LL;
constexpr i64 MOD = 1'000'000'007LL;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
// util {{{
#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }
template<typename T, size_t N>
i64 SIZE(const T (&)[N]) { return static_cast<i64>(N); }
template<typename T, typename U, typename Comp=less<>>
bool chmax(T& xmax, const U& x, Comp comp={}) {
    if(comp(xmax, x)) {
        xmax = x;
        return true;
    }
    return false;
}

template<typename T, typename U, typename Comp=less<>>
bool chmin(T& xmin, const U& x, Comp comp={}) {
    if(comp(x, xmin)) {
        xmin = x;
        return true;
    }
    return false;
}
// }}}

// init {{{
struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;

    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;
// }}}

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

signed main() {
    int k,x;
    cin>>k>>x;

    int l = max(x-k+1,-1000000);
    int r = min(x+k-1,+1000000);

    for(int i=l;i<=r;i++){
        cout<<i<<" ";
    }
    cout<<endl;


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

Measured memory_bytes: 256
import java.util.*;

class Main{
  public static void main(String args[]){
    Scanner s = new Scanner(System.in);
    int k=s.nextInt(),a=s.nextInt(),b=s.nextInt();
    int c=Math.max(0,k-a+1);
    System.out.print(Math.max((long)(b-a)*(c/2)+a+c%2,(long)k+1));
  }
}

Measured memory_bytes: 22740
#pragma GCC optimize(3)
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define mod 1000000007
#define int long long
#define inf (1LL << 55)
const int maxnodes=1005;
#define ll long long
#define N 100001
#define EPS 0.01

int32_t main()
{
    IOS;
 
	int n;
	cin >> n;
	int f[26];
	memset(f,0,sizeof(f));
	string s;
	cin >> s;
	for(int i = 0;i < n;i++)
	{
		f[s[i]-'a']++;
	}    
	int ans = 1;
	for(int i =0;i < 26;i++)
	{
		ans = (ans * (f[i] + 1))%mod;
	}
	ans = (ans - 1 + mod)%mod;
	cout << ans;
    return 0;
}

Measured memory_bytes: 1020
# -*- coding: utf-8 -*-
import sys
# sys.setrecursionlimit(10**6)
# buff_readline = sys.stdin.buffer.readline
buff_readline = sys.stdin.readline
readline = sys.stdin.readline

INF = 2**62-1


def read_int():
    return int(buff_readline())


def read_int_n():
    return list(map(int, buff_readline().split()))


def read_float():
    return float(buff_readline())


def read_float_n():
    return list(map(float, buff_readline().split()))


def read_str():
    return readline().strip()


def read_str_n():
    return readline().strip().split()

def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N, A):
    ans = 1
    A.sort()
    for a in A:
        ans *= a
        if ans > 10**18:
            return -1
    return ans


def main():
    N = read_int()
    A = read_int_n()
    print(slv(N, A))


if __name__ == '__main__':
    main()


Measured memory_bytes: 21800
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#include <cstring>
#include <ctime>


using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x*x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  FOR(i,0,n)
#define loop(n) FOR(i,0,n)
#define rrep(i,a,b) for(int i=(a);i>=(b);--i)
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18

int main() {

	LL x; cin >> x;
	LL ans = 0;

	ans = (x / 11)*(LL)2;

	LL ret = x % 11;

	if (ret != 0) {
		if (ret <= 6) {
			ans++;
		}
		else {
			ans += 2;
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES

#include <bits/stdc++.h> 
  
using namespace std;
  
#define $(x) (int)((x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define endl '\n'
#define x first
#define y second    
#define int long long
#define double long double       
#define vec vector            
#define pb push_back
#define pii pair<int, int>
#define pdd pair<double, double> 
#define beg begin
  
#ifdef LOCAL
    #define dbg(x) cerr << #x << " = " << x << endl;
#else 
    #define dbg(x)
#endif 
 
void solve(); signed main() {
#ifdef LOCAL
    freopen("input.txt", "r", stdin);                                       
    // freopen("output.txt", "w", stdout);
#endif
    srand(time(0));
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cout.setf(ios::fixed); cout.precision(6);    
    solve();   
    return 0;
}

const int INF = 1e18, MOD = 998244353, MAXN = 1e5 + 10;
vec<int> ps;

int check(int k, vec<int> &a) {
    int n = $(a);
    int cnt = 0;
    for (int i = 0; i < n; ++i) {
        int x = k - a[i];
        int id = lower_bound(all(a), x) - a.beg();
        cnt += (n - id);
    }
    return cnt;
}

int gt(int l, int r) {
    if (l > r) return 0;
    if (l == 0) {
        return ps[r];
    }
    else {
        return ps[r] - ps[l - 1];
    }
}

void solve() {
    int n, m;
    cin >> n >> m;
    vec<int> a(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    sort(all(a));
    
    int l = 0, r = INF;
    while (r - l > 1) {
        int mid = (r + l) / 2;
        int cnt = check(mid, a);
        if (cnt >= m) {
            l = mid;
        }
        else {
            r = mid;
        }
    }   

    ps.resize(n);
    ps[0] = a[0];
    for (int i = 1; i < n; ++i) {
        ps[i] = ps[i - 1] + a[i];
    }

    int k = l, cnt = check(k, a);
    int sum = 0, mn = INF;
    for (int i = 0; i < n; ++i) {
        int x = k - a[i];
        int id = lower_bound(all(a), x) - a.beg();
        sum += (gt(id, n - 1) + (n - id) * a[i]);
        if (id <= n - 1) {  
            mn = min(mn, a[i] + a[id]);
        }
    }

    sum -= (cnt - m) * mn;
    cout << sum << endl;
}

Measured memory_bytes: 1792
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


def dfs(start):
    q = [start]
    d0 = 0
    d1 = 0
    while q:
        u = q.pop()
        if u>=0:
            if seen[u]:
                continue
            seen[u] = d0
            d0 += 1
            q.append(~u)
            for v in ns[u]:
                if seen[v] is None:
                    q.append(v)
        else:
            if ns[~u]:
                done[~u] = max(done[v] for v in ns[~u]) + 1
            else:
                done[~u] = 0

n,m = map(int, input().split())
from collections import defaultdict
ns = defaultdict(set)
for i in range(m):
    u,v = map(int, input().split())
    u -= 1
    v -= 1
    ns[u].add(v)

# 行きがけ順
seen = [None] * n
# 帰りがけ順
done = [None] * n
    
for i in range(n):
    if seen[i] is not None:
        continue
    dfs(i)
print(max(done))

Measured memory_bytes: 115120
#include <bits/stdc++.h>
using namespace std;
const int MXN = 3e5+7;
long long FT[MXN];
void add(int idx,long long amt){
	while(idx < MXN){
		FT[idx] += amt;
		idx += idx & -idx;
	}
}
long long sum(int idx){
	long long ret = 0ll;
	while(idx > 0){
		ret += FT[idx];
		idx -= idx & -idx;
	}
	return ret;
}
int main(){
	#ifdef REDIRECT_IO
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	#endif
	int n;
	scanf("%d",&n);
	vector<int> dat1,dat2,dat3,com;
	com.push_back(-1e9);
	for(int i = 0; i < n; i++){
		int x;
		scanf("%d",&x);
		dat1.push_back(x);
		com.push_back(x);
	}
	for(int i = 0; i < n; i++){
		int x;
		scanf("%d",&x);
		dat2.push_back(x);
		com.push_back(x);
	}
	for(int i = 0; i < n; i++){
		int x;
		scanf("%d",&x);
		dat3.push_back(x);
		com.push_back(x);
	}
	sort(com.begin(),com.end());
	com.resize(unique(com.begin(),com.end()) - com.begin());
	for(int i = 0; i < n; i++){
		int x = lower_bound(com.begin(),com.end(),dat1[i]) - com.begin();
		add(x,1);
	}
	vector<pair<int,long long> > v;
	for(int i = 0; i < n; i++){
		int x = lower_bound(com.begin(),com.end(),dat2[i]) - com.begin();
		v.emplace_back(x,sum(x-1));
	}
	memset(FT,0,sizeof(FT));
	for(int i = 0; i < n; i++){
		add(v[i].first,v[i].second);
	}
	long long ans = 0ll;
	for(int i = 0; i < n; i++){
		int x = lower_bound(com.begin(),com.end(),dat3[i]) - com.begin();
		ans += sum(x-1);
	}
	printf("%lld",ans);
	return 0;
}

Measured memory_bytes: 8556
program main
    use,intrinsic :: iso_fortran_env
    implicit none
    integer(int32):: n,i,j,ans
    character(10),allocatable:: s(:)


    read*, n
    allocate(s(n))
    do i=1,n
        read*, s(i)
    end do
    call character_sort(s,1,n)
    ans=1
    do i=2,n
        if (s(i) /= s(i-1)) ans=ans+1
    end do
    print*, ans

contains
    recursive subroutine character_sort(ar, fst, lst)
        character(10),intent(inout):: ar(:)
        integer(int32),intent(in):: fst,lst
        integer(int32):: mdl

        if (lst-fst < 2) then
            if (ar(fst) > ar(lst)) call swap(ar(fst),ar(lst))
            return
        end if

        mdl = (fst+lst)/2
        call character_sort(ar, fst, mdl)
        call character_sort(ar, mdl+1, lst)
        call merge_(ar, fst, mdl, lst)
    end subroutine

    subroutine merge_(ar, fst, mdl, lst)
        character(10),intent(inout):: ar(:)
        integer(int32),intent(in):: fst, mdl, lst
        character(10),allocatable:: tmp(:)
        integer(int32):: li, ri, ti

        allocate(tmp(lst-fst+1))

        li=fst
        ri=mdl+1   
        ti=1

        do while (li <= mdl .and. ri <= lst)
            if (ar(li) <= ar(ri)) then
                tmp(ti) = ar(li)
                li=li+1
            else
                tmp(ti) = ar(ri)
                ri=ri+1
            end if
            ti=ti+1
        end do

        if (li <= mdl) then
            tmp(ti:) = ar(li:mdl)
        else
            tmp(ti:) = ar(ri:lst)
        end if

        ar(fst:lst) = tmp(:)
        deallocate(tmp)
    end subroutine

    subroutine swap(x,y)
        character(10),intent(inout):: x,y
        character(10):: tmp
        tmp = x
        x = y
        y = tmp
    end subroutine
end program 

Measured memory_bytes: 7432
#include<iostream>
#include<map>
#define ii pair<int,int>
using namespace std;
int r,c;
ii haha[2005][2005];
char mm[2005][2005];
int m_id[2005][2005];
int main(){
	cin>>r>>c;
	for(int i = 0;i<r;i++){
		for(int j = 0;j<c;j++){
			cin>>mm[i][j];
		}
	}
	for(int i = 0;i<=r;i++) for(int j = 0;j<=c;j++) m_id[i][j] = -1;
	// col
	map<int,int> temp;
	for(int i = 0;i<r;i++){
		int id = 0,ct = 0;
		for(int j = 0;j<c;j++){
			if(mm[i][j]=='#'){
				temp[id] = ct;
				id++;ct = 0;
			}else{
				m_id[i][j] = id;
				ct++;
			}
		}
		temp[id] = ct;
		
		for(int j = 0;j<c;j++){
			if(mm[i][j]!='#'){
//				cout<<temp[m_id[i][j]]<<" ";
				haha[i][j].first = temp[m_id[i][j]];
			}
//			else cout<<"# ";
		}
//		cout<<"\n";
		temp.clear();
	}
	
	for(int i = 0;i<=r;i++) for(int j = 0;j<=c;j++) m_id[i][j] = -1;
	// row
	for(int i = 0;i<c;i++){
		int id = 0,ct = 0;
		for(int j = 0;j<r;j++){
			if(mm[j][i]=='#'){
				temp[id] = ct;
				id++;ct = 0;
			}else{
				m_id[j][i] = id;
				ct++;
			}
		}
		temp[id] = ct;
		for(int j = 0;j<r;j++){
//			cout<<"in\n";
			if(mm[j][i]!='#'){
//				cout<<temp[m_id[j][i]]<<" ";
				haha[j][i].second = temp[m_id[j][i]];
			}
//			else cout<<"# ";
		}
//		cout<<"\n";
		temp.clear();
	}
	int ans = 0;
	for(int i = 0;i<r;i++){
		for(int j = 0;j<c;j++){
			ans = max(ans, haha[i][j].first + haha[i][j].second -1);	
		}
	}
	cout<<ans<<"\n";
	return 0;
}

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

int main(void) 
{
	int n;
	vector<int> h;
	for (int i = 0; i < 10; i++)
	{
		cin >> n;
		h.push_back(n);
	}
	sort(h.begin(), h.end());
	for (int i = 9; i >= 7; i--)
	{
		cout << h.at(i) << endl;
	}

	return 0;
}

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

int main()
{
  int n, k;
  cin >> n >> k;
  vector<int> l(n);
  for(auto& i : l) cin >> i;
  
  sort(l.begin(), l.end(), greater<int>());
  int ans = 0;
  for(int i = 0; i < k; ++i) ans += l[i];
  cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.*;
import java.lang.*;


public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int y = sc.nextInt();
        int z = sc.nextInt();
        x -= z;
        System.out.println(x / (y + z));
    }
}

Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s,t;
  int i;
  cin>>s>>t;
  for(i=0;i<s.length();i++) if(s.at(i)!=t.at(i)) break;
  if(i==s.length()) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}

Measured memory_bytes: 3596
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

int main(){
	int n, m, p;
	while(cin >> n >> m >> p, n || m || p){
		vector<int> x(n);
		int bet = 0;
		
		for(int i = 0; i < n; i++){//input
			cin >> x[i];
			bet += x[i];
		}

		bet = bet * (100 - p);
		if(x[m-1] == 0){
			cout << 0 << endl;
		}else{
			double tmp = bet/x[m-1];
			cout << (int)tmp << endl;
		}
	}

	return 0;
}


Measured memory_bytes: 3080
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC129A
{
    class Program
    {
        static void Main(string[] args)
        {

            int a, b, c, p, q, r;

            var word = Console.ReadLine().Split(' ');
            p = int.Parse(word[0]);
            q = int.Parse(word[1]);
            r = int.Parse(word[2]);

            a = p + q;
            b = q + r;
            c = p + r;

            if ((a < b) && (a < c))
                Console.WriteLine(a);
            else if ((b < a) && (b < c))
                Console.WriteLine(b);
            else if ((c < a) && (c < b))
                Console.WriteLine(c);

            else if ((a == b) && (a < c))
                Console.WriteLine(a);
            else if ((a == b) && (a > c))
                Console.WriteLine(c);

            else if ((a == c) && (a < b))
                Console.WriteLine(a);
            else if ((a == c) && (a > b))
                Console.WriteLine(b);

            else if ((c == b) && (a < c))
                Console.WriteLine(a);
            else if ((c == b) && (a > c))
                Console.WriteLine(c);

            else if ((a == b) && (b == c))
                Console.WriteLine(a);

            Console.ReadKey();
        }
    }
}


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

int n,g;
int p[20],d[20];

int main()
{
	scanf("%d%d",&n,&g);
	g/=100;
	int ans=0;
	for (int i=0;i<n;i++)
	{
		scanf("%d%d",&p[i],&d[i]);
		ans+=p[i];
		d[i]/=100;
	}
	int all=1<<n;
	for (int i=0;i<all;i++)
	{
		int qwq=0;
		int ha=0;
		for (int j=0;j<n;j++)
		if (i&(1<<j))
		{
			qwq+=p[j]*(j+1)+d[j];
			ha+=p[j];
		}
		for (int j=n-1;j>=0;j--)
		if (!(i&(1<<j)))
		{
			if (qwq>=g)	break;
			if (qwq+p[j]*(j+1)>=g)
			{
				ha+=(g-qwq+j)/(j+1);
				break;
			}
			qwq+=p[j]*(j+1);
			ha+=p[j];
		}
		//printf("%d %d\n",i,ha);
		if (ha<ans)	ans=ha;
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define FORD(i,a,b) for(int i=a;i>=b;i--)
#define FORL(i,x) for(int i=head[x];i;i=nxt[i])
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define PB push_back
#define MP make_pair
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; }

ll gcd(ll x, ll y)
{
    ll temp;
    while (y != 0) {
        temp = y;
        y = x % y;
        x = temp;
    }
    return (x);
}

int main() {
  ll t1,t2;
  cin >> t1 >> t2;
  ll a1,a2;
  cin >> a1 >> a2;
  ll b1,b2;
  cin >> b1 >> b2;

  ll num = gcd(t1,t2);
  num = gcd(num,a1);
  num = gcd(num,a2);
  num = gcd(num,b1);
  num = gcd(num,b2);

  t1 /= num; t2 /= num; a1 /= num; a2 /= num; b1 /= num; b2 /= num;

  ll p,q;
  p = (a1-b1)*t1;
  q = (a2-b2)*t2;

  if(p>0){
    p *= -1;
    q *= -1;
  }

  if(p+q<0){
    cout << 0 << endl;
    return 0;
  }
  else if(p+q==0){
    cout << "infinity" << endl;
    return 0;
  }

  ll s = -p / (p+q);
  ll t = -p % (p+q);

  if(t==0) cout << s*2 << endl;
  else cout << s*2 + 1 << endl;



}



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


int main() {
	
	vector <int> v={};
	unsigned int N, Q, l,r, contador=0;
	string adn;
	
	cin>>N;
	cin>>Q;
	cin>>adn;
	
	for (int i=0;i<adn.size()-1;i++)
		{
			if(adn[i]=='A' )
			{
				if (adn[i+1]=='C')
				{
					v.push_back(i+1);
					
				}
			}
		}
	
	for (int m=0; m<Q;m++)
	{
		cin>>l;
		cin>>r;

		
		for (int i=0; i<v.size();i++)
		{
			
			if (l<=v[i] && v[i]<r)
			contador++;
		}
		
		cout<<contador<<endl;
		contador=0;
		
	}
	
	
	return 0;
}

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

#define ll long long
#define ld long double
#define ull unsigned long long

#define db(x) cerr << #x << " = " << x << endl
#define db2(x, y) cerr << "(" << #x << ", " << #y << ") = (" << x << ", " << y << ")\n"
#define db3(x, y, z) cerr << "(" << #x << ", " << #y << ", " << #z << ") = (" << x << ", " << y << ", " << z << ")\n"

using namespace std;

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

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

    if (b - a == c - b)
        cout << "YES\n";
    else
        cout << "NO\n";

    return 0;
}

Measured memory_bytes: 256