akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <random>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
typedef map<int, int> mii;
typedef set<int> si;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define STLL(s) strtoll(s.c_str(), NULL, 10)
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int
#define endl '\n';
#define fi first
#define se second
#define NONVOID [[nodiscard]]
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
template <class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;} return 0;}
template <class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;} return 0;}
inline string getline(){string s; getline(cin,s); return s;}
inline void yn(const bool b){b?fin("yes"):fin("no");}
inline void Yn(const bool b){b?fin("Yes"):fin("No");}
inline void YN(const bool b){b?fin("YES"):fin("NO");}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;
const double EPS = 1e-9;



int main() {
    
    int n,m;
    cin>>n;
    vi v(n);
    rep(i,n)cin>>v[i];
    int q;
    cin>>q;
    rep(i,q){
        int b,e,t;
        cin>>b>>e>>t;
        for(int i=0;i<e-b;i++){
            swap(v[b+i],v[t+i]);
        }

    }
    rep(j,n){
        if(!j)cout<<v[0];
        else cout<<" "<<v[j];
    }cout<<endl;
}




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

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

Measured memory_bytes: 3712
import java.util.Scanner;

public class Main {
    
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        sc.nextLine();
        String S = sc.nextLine();
        
        int max = 0;
        for (int i = 1; i < N; i++) {
        	int overlapCount = 0;
        	String subStr = S.substring(i);
        	boolean[] memo = new boolean[26];
        	for(int j = 0; j < i; j++) {
        		char c = S.charAt(j);
        		boolean overlap = subStr.contains(String.valueOf(c));
        		if (overlap && !memo[(int)c - 97]) {
        			memo[(int)c - 97] = true;
        			overlapCount++;
        		}
        		
        		max = Math.max(max, overlapCount);
        	}
        }
        
        System.out.println(max);
    }
}


Measured memory_bytes: 21844
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>

using namespace std;

//typedef
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<LL, LL> PLL;

//conversion
inline LL toLong(string s) {LL 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;}

//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) LL((a).size())
#define EACH(i,c) for(auto i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define UNTIL(p) while(!(p))

//constant
const double EPS = 1e-5;
const double PI  = acos(-1.0);

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

#define PUTS(x) cout << (x) << endl;

LL n,m;
vector<VL> link(100005);
LL s,t;
LL ans = -1;
int visited[100005][3] = {0};

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin>>n>>m;
    REP(i,m){
        LL u,v;
        cin>>u>>v;
        link[u].PB(v);
    }
    cin>>s>>t;
    LL cnt = 1;
    
    deque<LL> q(1);
    q[0] = s;
    UNTIL(q.empty()){

        REP(ken,3){
            LL sz = q.size();   
            REP(i,sz){
                LL node = q.front();
                q.pop_front();
                if(visited[node][ken])continue;
                visited[node][ken] = 1;
                REP(j,link[node].size()){
                    q.PB(link[node][j]);
                }
            }
        }
        REP(i,q.size()){
            if(q[i] == t){
                ans = cnt;
                q.clear();
                break;
            }
        }
        cnt++;
    }
    PUTS(ans);
}

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

const int MAXH = 11;
const int MAXW = 11;
const string D = "RDLU";
const int di[] = {0,1,0,-1};
const int dj[] = {1,0,-1,0};

int H, W, N;
char G[MAXH][MAXW];
string ans;

bool isin(int i, int j) {
  return ( 0 <= i && i < H &&
           0 <= j && j < W );
}

bool dfs(int i, int j, int d, int depth) {
  if(depth == N) {
    ans = "";
    return true;
  }
  for(int k = 0; k < 4; ++k) {
    if((k+2)%4 == d) continue;
    int pi = i + di[k];
    int pj = j + dj[k];
    while(isin(pi, pj) && G[pi][pj] != 'o') {
      pi += di[k];
      pj += dj[k];
    }
    if(!isin(pi, pj)) continue;
    G[pi][pj] = '.';
    if(dfs(pi, pj, k, depth + 1)) {
      ans = D.substr(k, 1) + ans;
      return true;
    }
    G[pi][pj] = 'o';
  }
  return false;
}

int main() {
  while(cin >> H >> W) {
    N = 0;
    int si, sj, sd;
    for(int i = 0; i < H; ++i) {
      for(int j = 0; j < W; ++j) {
        cin >> G[i][j];
        int k = D.find(G[i][j]);
        if(k != string::npos) {
          G[i][j] = '.';
          si = i;
          sj = j;
          sd = k;
        }
        if(G[i][j] == 'o') ++N;
      }
    }
    dfs(si, sj, sd, 0);
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 1208
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef pair<ll,ll> P;
 
long long int INF = 3e18;
double Pi = 3.1415926535897932384626;
 
//vector<ll> G[550010];
//vector<P> tree[500010];
priority_queue <ll> pql;
priority_queue <P> pqp;
//big priority queue
priority_queue <ll,vector<ll>,greater<ll> > pqls;
priority_queue <P,vector<P>,greater<P> > pqps;
//small priority queue
//top pop
 
int dx[8]={1,0,-1,0,1,1,-1,-1};
int dy[8]={0,1,0,-1,1,-1,-1,1};
char dir[] = "DRUL";
//ll bit[500005];
//↓,→,↑,←
 
 
#define p(x) cout<<x<<"\n";
#define el cout<<endl;
#define pe(x) cout<<(x)<<" ";
#define ps(x) cout<<fixed<<setprecision(25)<<x<<endl;
#define pu(x) cout<<(x);
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define CLEAR(a) a = decltype(a)(); 
 
 
ll mod = 1000000007;
/*
2000000011 is prime
2000000033 is prime
*/

ll rui(ll number1,ll number2){
 
    if(number2 == 0){
        return 1;
    }else{
        ll number3 = rui(number1,number2 / 2);
        number3 *= number3;
        number3 %= mod;
        if(number2%2==1){
            number3 *= number1;
            number3 %= mod;
        }
        return number3;
    }
}
ll gcd(ll number1,ll number2){
 
    if(number1 > number2){
        swap(number1,number2);
    }
    if(number1 == 0 || number1 == number2){
        return number2;
    }else{
        return gcd(number2 % number1,number1);
    }
}
void YES(bool condition){
 
    if(condition){
        p("YES");
    }else{
        p("NO");
    }
    return;
}
void Yes(bool condition){
 
    if(condition){
        p("Yes");
    }else{
        p("No");
    }
    return;
}


ll fact[800005],rfact[800005];

void c3_init(){
    fact[0] = rfact[0] = 1;
    for(ll i=1; i<=800000; i++){
        fact[i] = (fact[i-1]*i) % mod;
    }
    rfact[800000] = rui(fact[800000],mod - 2);
    for(ll i=800000; i>=1; i--){
       rfact[i-1] = rfact[i] * i;
       rfact[i-1] %= mod;
    }
    return;}
ll c3(ll n,ll r){
    return (((fact[n] * rfact[r]) % mod) * rfact[n-r]) % mod;}

 
ll n,m,num,sum,a,b,c,d,e,g,h,w,i,j,q,r;
ll k,ans;
ll x[500005],y[500005],z[500005];
char s[500005];
bool dp[500005];



int main(){
    cin >> n;
    for(i=0;i<n;i++){
        cin >> x[i];
        sum += x[i];
    }
    ans = INF;
    for(i=0;i<n;i++){
        a += x[i];
        sum -= x[i];
        ans = min(ans, abs(sum - a));
    }
    p(ans);
    return 0;
}






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

int gcd(int a, int b)
{
    if (!b) {
        return a;
    }
    return gcd(b, a % b);
}

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

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

    std::vector<int> l(n, 0), r(n + 1, 0);

    for (int i = 1; i < n; i++) {
        l[i] = gcd(l[i - 1], a[i - 1]);
    }

    for (int i = n - 1; i >= 0; i--) {
        r[i] = gcd(r[i + 1], a[i]);
    }

    int ans = 0;
    for (int i = 0; i < n; i++) {
        ans = std::max(ans, gcd(l[i], r[i + 1]));
    }

    std::cout << ans << std::endl;
}


Measured memory_bytes: 1408
#include<iostream>
#include<map>

using namespace std;

int main(){
  	int N;
	cin >> N;
        
	map<string,int> A;
	string B;
	for(int i=1;i<=N;i++){
		cin >> B;
		A[B] = 1;
	}
	cout << A.size();
	return 0;
}





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



int main(){
	int n,a,b,sum,cnt=0;
	cin >> n >> a >> b;
	sum=b;
	while(1){
		if(n<sum+a+b) break;
		sum+=a+b;
		cnt++;
	}
	
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 256
#include <cstring>
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <cmath>
#include <queue>
#include <iomanip>
#include <fstream>
#define rep(i,a,b) for (long long i = a; i < b; i++)
using namespace std;
long long n;

// long long bf(long long p, long long pp , long long sum, vector <long long>& fec){
    
//     if(dp[p]!=-1){
//         return dp[p];
//     }
//     if (pp==n-1){
//         //cout << sum  << endl;
//         return sum;
//     } else if(pp>=n){
//         return 1000000000;
//     }
//     //cout << abs(fec[pp]-fec[p]) << "  " << p << "   " << pp << endl;
//     return dp[p]= min(bf(p+1, p, sum + abs(fec[pp]-fec[p]), fec) , bf(p+2, p, sum + abs(fec[pp]-fec[p]), fec));
// }

int main(){
    long long k;
    cin >> n >> k;
    long long dp[n+2][k+2];
    //dp.assign(n+k+k,10000000000000);
    memset(dp,0, sizeof (dp));
    long long fector[n+2][2];
    memset(fector,0, sizeof (fector));
    rep(i,0,n){
        rep(j,0,2){
            cin >> fector[i][j];
        }
    }
    
    rep(i,0,n){
        rep(w,0,k+1){
            if(w-fector[i][0]>=0){
                dp[i+1][w] = max(dp[i][w],dp[i][w-fector[i][0]]+fector[i][1]);
            } else{
                dp[i+1][w] = dp[i][w];
            }
        }
    }
    long long answer = 0;
    rep(i,0,k+1){
        //cout << dp[n][i] << "       " ;
        answer = max(answer, (long long)dp[n][i]);
    }
    cout << answer << "\n";
    //cout << bf(0, 0, 0, fector) << endl;

}

Measured memory_bytes: 80000
IDENTIFICATION                   DIVISION.
PROGRAM-ID.                      ABC_101_C.
ENVIRONMENT                      DIVISION.
DATA                             DIVISION.
WORKING-STORAGE                  SECTION.
    01 INP    PIC X(14).
    01 INP2   PIC X(700000).
    01 maxlen PIC 9(1)  VALUE 2.
    01 cur    PIC 9(2)  VALUE 1.
    01 i      PIC 9(18) VALUE 1.
    01 j      PIC 9(18).
    01 len    PIC 9(2).
    01 ans    PIC Z(18).
    01 X      PIC 9(6).
    01 R      PIC 9(6).
    01 NK1.
        03 NK11 OCCURS 2.
            05 NK PIC 9(6).
PROCEDURE                        DIVISION.
MAIN.
    ACCEPT INP.
    ACCEPT INP2.

    PERFORM maxlen TIMES

        PERFORM VARYING j FROM cur BY 1
            UNTIL INP(j:1) = SPACE
        END-PERFORM

        COMPUTE len = j - cur

        MOVE INP(cur:len) TO NK(i)

        COMPUTE cur = j + 1

        ADD 1 TO i

    END-PERFORM.

*> N <= K + (K - 1) * (G - 1)
*> (N - K) / (K - 1) + 1

    SUBTRACT NK(2) FROM NK(1).
    SUBTRACT 1 FROM NK(2).

    DIVIDE NK(2) INTO NK(1) GIVING X REMAINDER R.

    IF R NOT = 0 THEN
       ADD 1 TO X
    END-IF.

    ADD 1 TO X.
    MOVE X TO ans.

    DISPLAY ans.
    STOP RUN.


Measured memory_bytes: 1024
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.NoSuchElementException;
import java.util.Random;

class Main {
	public static void main(String[] args) {
		new Main().run();
	}
	
	void run() {
		FastScanner sc=new FastScanner();
		PrintWriter pw=new PrintWriter(System.out);
		int[] a=new int[3];
		for(int i=0;i<a.length;++i)a[i]=sc.nextInt();
		int d=sc.nextInt();
		pw.println(Math.abs(a[0]-a[2])<=d||(Math.abs(a[0]-a[1])<=d&&Math.abs(a[1]-a[2])<=d)?"Yes":"No");
		pw.close();
	}

	
	static void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}

}


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 int nextInt() {
    	return Integer.parseInt(next());
    }
    
    public long nextLong() {
    	return Long.parseLong(next());
    }
}

Measured memory_bytes: 22484
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class AtCoderA
{
    static void Main()
    {
        var sc = new Scanner();

        string s = sc.Next();

        string answer = s.Substring(0, s.Length - 8);

        Console.WriteLine(answer);
    }

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}


Measured memory_bytes: 25864
// Oh boi here we go again
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

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

#define all(s) s.begin(), s.end()
#define ok puts("ok")
#define ll long long
#define pb push_back
#define mk make_pair
#define fr first
#define sc second
#define vi vector < int >
#define pi pair < int, int >
#define pii pair < int, pi >
#define next next123
#define left left123

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

ll a, b;

main(){
    cin >> a >> b;
    if (500 * a < b)
        puts("No");
    else
        puts("Yes");

}


Measured memory_bytes: 256
#include<stdio.h>
void bubbleSort(int*,int); //(A[100],n)
int main(){
  int n,A[100];
  int i;
  scanf("%d",&n);
  for(i=0;i<n;i++){
  scanf("%d",&A[i]);
  }
  bubbleSort(A,n);
  return 0;
}
void bubbleSort(int *A,int n){
  int i,flag=1,b,c=0;
  while(flag==1){
    flag=0;
    for(i=n-1;0<i;i--){
      if(A[i]<A[i-1]){
	b=A[i];
	A[i]=A[i-1];
	A[i-1]=b;
	flag=1;
	c++;
      }
    }
  }
    printf("%d",A[0]);
    for(i=1;i<n;i++){
      printf(" %d",A[i]);
    }
    printf("\n%d\n",c);
}



Measured memory_bytes: 2140
#include<cstdio>

int main(){
        int a,b;
        scanf("%d %d", &a, &b);
        if(a < b){
                printf("a < b\n");
        }else if(a > b){
                printf("a > b\n");
        }else{
                printf("a == b\n");
        }
        return 0;
}

Measured memory_bytes: 1008
#include <cstdio> 
using namespace std; //This makes the code much more cleaner

int main()
{

	int x, y;
	scanf("%d %d",&x,&y);
	
	if (x+y>=x-y and x+y>=x*y)
	{
		printf("%d",x+y);
	}
	else if (x-y>=x+y and x-y>=x*y)
	{	
		printf("%d",x-y);
	}
	else
	{
		printf("%d", x*y);
	}



	return 0;

}

Measured memory_bytes: 128
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Linear Search
n ????????´??°???????????°??? S ??¨???q ????????°????????´??°???????????°??? T ??????????????????
T ?????????????????´??°????????§ S ?????????????????????????????° C ???????????????????????°????????????????????????????????????
"""

def main():
    """ ????????? """
    n = int(input())
    S = list(input().split())
    q = int(input())
    T = list(input().split())

    cnt = {}
    for i in range(n):
        for j in range(q):
            if S[i] == T[j]:
                cnt[T[j]] = 1
                break
    print(len(cnt))


if __name__ == '__main__':
    main()

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

int main(){ 
  cin.tie(0);
  ios::sync_with_stdio(false); 
  int n;
  cin>>n;
  vector<int> a(n+1); 
  a[0]=0; 
  for(int i=1;i<=n;i++){ 
    cin>>a[i]; 
  } 
  int trip=0; 
  for(int i=0;i<n;i++){ 
    trip+=abs(a[i]-a[i+1]); 
  } 
  trip+=abs(a[n]-a[0]); 
  for(int i=1;i<n;i++){ 
    int tmp=trip;
    tmp-=abs(a[i]-a[i+1])+abs(a[i-1]-a[i]);
    tmp+=abs(a[i-1]-a[i+1]);
    cout<<tmp<<endl; 
  } 
  trip-=abs(a[n]-a[0])+abs(a[n-1]-a[n]); 
  trip+=abs(a[0]-a[n-1]);
  cout<<trip;


  return 0; 
}


Measured memory_bytes: 1664
#include <iostream>
#include <cstring>

using namespace std;

int main(void){
	string str;
  	cin >> str;
  	int i;
  	int tmp = 0;
  	int max = 0;
  	for(i=0;i<11;i++){
    	if(str[i] == 'A'||str[i] == 'C'||str[i] == 'G'||str[i] == 'T'){
        	tmp++;
        } else {
        	if(tmp > max ){
              max = tmp;
              tmp = 0;
            }
        }
    }
  	cout << max << endl;
	return 0;
}

Measured memory_bytes: 256
MOD=10**9+7
n,m=map(int,input().split())
a=set([int(input()) for _ in range(m)])
if n==1:
  print(1)
  exit()
if 1 in a and 2 in a:
  print(0)
  exit()
elif 1 in a:
  ans=[0,1]
elif 2 in a:
  ans=[1,0]
else:
  ans=[1,2]

for i in range(2,n):
  if i+1 in a:
    ans.append(0)
  else:
    s=(ans[-1]+ans[-2])%MOD
    ans.append(s)
print(ans[-1]%MOD)

Measured memory_bytes: 19120
<?php

fscanf(STDIN, '%d', $n);
$tree = new \SplFixedArray($n);
for ($i = 0; $i < $n; $i++) {
    $obj = new stdClass;
    $obj->children = array();
    $tree[$i] = $obj;
}

for ($i = 0; $i < $n; $i++) {
    $line = trim(fgets(STDIN));
    $arr = explode(' ', $line);
    $id = (int)array_shift($arr);
    array_shift($arr);

    foreach ($arr as $node) {
        $node = (int)$node;
        $tree[$id]->children[] = $node;
        $tree[$node]->parent = $id;
    }
}

for ($i = 0; $i < $n; $i++) {
    $obj = $tree[$i];
    $children = implode(', ', $obj->children);

    if (!isset($obj->parent)) {
        printf("node %d: parent = -1, depth = 0, root, [%s]\n", $i, $children);
        continue;
    }

    $parent = $obj->parent;
    $j = $parent;
    $depth = 1;
    while (isset($tree[$j]->parent)) {
        $depth++;
        $j = $tree[$j]->parent;
    }

    $type = $children !== '' ? 'internal node' : 'leaf';
    printf("node %d: parent = %d, depth = %d, %s, [%s]\n", $i, $parent, $depth, $type, $children);
}

Measured memory_bytes: 112560
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
typedef long long ll;
#define re_ return

ll e[19];

ll DFS(ll n, ll m, char k)
{
//    printf("%lld %lld\n", n, m);
    n=abs(n);
    if(m==-1) re_ !n;
    if(!m) re_ n? 0: 10;
    int i=n/e[m];
    if(i>9) re_ 0;
    if((n+i)%10==0)
        re_ max(10-i-k, 0)*DFS((n-i*e[m]+i)/10, m-2, 0);
    else if((n+i+1)%10==0)
        re_ max(10-i-1-k, 0)*DFS((n-(i+1)*e[m]+i+1)/10, m-2, 0);
    re_ 0;
}

int main()
{
    ll n, i, r=0;
    scanf("%lld", &n);
    for(i=e[0]=1; i<19; ++i) e[i]=e[i-1]*10;
//    printf("%lld\n", e[18]);
    for(i=1; i<19; ++i) r+=DFS(n, i, 1);
//    DFS(n, 8, 1);
    printf("%lld\n", r);
    re_ 0;
}


Measured memory_bytes: 128
import java.util.*;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String[] vowel = {"a","i","u","e","o"};
		String C = sc.next();
		for(int i=0;i<vowel.length;i++){
			if(C.equals(vowel[i])){
				System.out.println("vowel");
				break;
			}
			if(i==vowel.length-1)System.out.println("consonant");
		}
	}
}

Measured memory_bytes: 23124
#include <bits/stdc++.h>
#include <string>
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <bitset>
typedef long long ll;
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
 
const int mod = 1000000007;
//const int mod = 998244353;
 

struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }
 
  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}
 
 
struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
} c(200005);
 
// M * (M-1)^(N-1-K) * N-1 C K
int main(int argc, const char * argv[]) {
    ll X,Y;
    cin >> X >> Y;
    for(ll i=0;i<=200;i++){
        for(ll j=0;j<=200;j++){
            ll sum_x = i+j;
            ll sum_y = 2*i + 4*j;
            if(sum_x == X && sum_y == Y){
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    
    cout << "No" << endl;
    return 0;
}



Measured memory_bytes: 6228
def judge(string):
    s_li = [x for x in string]
    if "A" in s_li:
        s_li.remove("A")

    if "C" in s_li:
        s_li.remove("C")

    return string[0] == "A" and string[2:-1].count("C") == 1 and str(s_li).islower()


s = input()
print("AC") if judge(s) else print("WA")


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

public class Main{
	static Tree tree;
	static boolean[] visited;
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int q = sc.nextInt();
		tree = new Tree(n);
		for (int i = 0; i < n - 1; i++) {
			tree.union(sc.nextInt() - 1, sc.nextInt() - 1);
		}
		for (int i = 0; i < q; i++) {
			tree.node[sc.nextInt() - 1].value += sc.nextInt();
		}
		visited = new boolean[n];
		visited[0] = true;
		dfs(0);
		for (int i = 0; i < n - 1; i++) {
			System.out.print(tree.node[i].value + " ");
		}
		System.out.println(tree.node[n - 1].value);
	}
	static void dfs(int n) {
		visited[n] = true;
		for (int key : tree.node[n].list) {
			if (!visited[key]) {
				visited[key] = true;
				tree.node[key].value += tree.node[n].value;
				dfs(key);
			}
		}
	}
}

class Node {
	ArrayList<Integer> list;
	int value;
	Node() {
		list = new ArrayList<>();
		value = 0;
	}
}

class Tree {
	Node[] node;
	Tree(int n) {
		node = new Node[n];
		for (int i = 0; i < n; i++) {
			node[i] = new Node();
		}
	}
	void union(int n, int m) {
		node[n].list.add(m);
		node[m].list.add(n);
	}
}


Measured memory_bytes: 233212
import java.util.Scanner;
public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String[] a = s.split("");
		String ans = "Good";
		for(int i = 1; i < 4; i++) {
			if(a[i-1].equals(a[i])) {
				ans = "Bad";
			}
		}
		System.out.println(ans);
		sc.close();
	}


}


Measured memory_bytes: 21844
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner stdIn = new Scanner(System.in);
		
		int A = stdIn.nextInt();
		int B = stdIn.nextInt();
		int C = stdIn.nextInt();
		int D = stdIn.nextInt();
		
		if((A+B) > (C+D))
		{
			System.out.println("Left");
		}
		else if((A+B) < (C+D))
		{
			System.out.println("Right");
		}
		else
		{
			System.out.println("Balanced");
		}

	}

}


Measured memory_bytes: 35544
import sys
input = sys.stdin.readline

N = int(input())
A = list(map(int, input().split()))

x = [0] * N
S = sum(A)
x[0] = S - 2 * (sum(A[1:N:2]))
for i in range(1, N):
    x[i] = 2 * A[i-1] - x[i-1]

for i in range(N-1):
    print(x[i], end=" ")
print(x[N-1])

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

#define endl "\n"
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
const int mod = 1e9 + 7;
const int maxn = 1e6 + 5;
const int inf = 0x3f3f3f3f;
const ll INF = 0x3f3f3f3f3f3f3f3f;

void header() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}

int a[maxn];

void solve() {
    int h, n;
    cin >> h >> n;
    ll sum = 0;
    for (int i = 1; i <= n; i++) cin >> a[i], sum += a[i];
    cout << (sum >= h ? "Yes" : "No") << endl;
}

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


Measured memory_bytes: 640
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Comparator;
import java.util.PriorityQueue;
import java.util.StringTokenizer;

public class Main {

	public static void main(String args[]) {
		FastScanner cin = new FastScanner();
		PrintWriter cout = new PrintWriter(System.out);
		solve(cin, cout);
		cout.flush();
	}

	private static void solve(FastScanner cin, PrintWriter cout) {
		int n = cin.nextInt();
		int[][] xs = new int[n][];
		int[][] ys = new int[n][];
		for (int i = 0; i < n; i++) {
			xs[i] = new int[] { cin.nextInt(), i };
			ys[i] = new int[] { cin.nextInt(), i };
		}

		long ans = solve(n, xs, ys);
		cout.println(ans);
	}

	private static long solve(int n, int[][] xs, int[][] ys) {
		// editorialと他人の解答を参考
		// 速度・メモリを調整中

		PriorityQueue<int[]> edges = new PriorityQueue<>(Comparator.comparingInt((edge) -> edge[0]));

		Arrays.sort(xs, Comparator.comparingInt((vi) -> vi[0]));
		Arrays.sort(ys, Comparator.comparingInt((vi) -> vi[0]));
		for (int[][] vis : new int[][][] { xs, ys })
			for (int i = 1; i < n; i++)
				edges.add(new int[] { Math.abs(vis[i - 1][0] - vis[i][0]), vis[i - 1][1], vis[i][1] });

		// 最小全域木
		// https://ja.wikipedia.org/wiki/%E5%85%A8%E5%9F%9F%E6%9C%A8
		// https://en.wikipedia.org/wiki/Kruskal%27s_algorithm
		long ans = 0;

		rt = new int[n];
		Arrays.fill(rt, -1);

		while (!edges.isEmpty()) {
			int[] edge = edges.remove();
			int w = edge[0];
			int fr = edge[1];
			int to = edge[2];
			if (!unite(fr, to))
				continue;
			ans += w;
		}
		return ans;
	};

	private static int[] rt;

	private static int root(int operand) {
		if (rt[operand] < 0)
			return operand;
		return rt[operand] = root(rt[operand]);
	}

	private static boolean unite(int fr, int to) {
		int a = root(fr);
		int b = root(to);
		if (a == b)
			return false;
		if (rt[a] > rt[b]) {
			int tmp = a;
			a = b;
			b = tmp;
		}
		rt[a] += rt[b];
		rt[b] = a;
		return true;
	}

	/**
	 * How to read input in Java — tutorial <br />
	 * By Flatfoot<br />
	 * http://codeforces.com/blog/entry/7018
	 */
	static class FastScanner {
		private BufferedReader br;
		private StringTokenizer st;

		FastScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreElements())
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					throw new IllegalStateException(e);
				}
			return st.nextToken();
		}

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

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

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				throw new IllegalStateException(e);
			}
			return str;
		}

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

}


Measured memory_bytes: 54428
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <vector>
#include <math.h>
#include <queue>
#include <map>
#define ll long long
const int MOD = 1e9+7;
using namespace std;


int main(){
	int n, k, ans = 0;
	cin >> n >> k;
	vector<int> h(n);
	for (int i = 0; i < n; i++){
		cin >> h[i];
		if (h[i] >= k) ans++;
	}
	cout << ans << endl;
	return 0;
}




Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <math.h>
#include <stack>
#include <queue>
#include <deque>
#include <vector>
using namespace std;
using ll = long long;
using graph = std::vector<std::vector<long long>>;
using wgraph = std::vector<std::vector<std::pair<long long,long long>>>;
int main(){
    int H,W;
    cin >> H >> W;
    wgraph G(10);
    ll d[10][10];
    for(int i = 0; i < 10; i++){
        G[i] = std::vector<std::pair<long long,long long>>(0);
    }
    for(int i = 0; i < 10; i++){
        for(int j = 0; j < 10; j++){
            d[i][j] =1ll < 50;
            ll tmp;
            cin >> tmp;
            G[i].push_back(make_pair(j,tmp));
            d[i][j] = tmp;

        }
    }
    for(int i = 0; i < 10; i++){
        for(int j = 0; j < 10; j++){
            for(int k = 0; k < 10; k++){
                d[j][k] = min(d[j][k],d[j][i] + d[i][k]);
            }
        }
    }
    ll c = 0;
    for(int yi = 0; yi < H; yi++){
        for(int xi = 0; xi < W; xi++){
            ll tmp;
            cin >> tmp;
            if(tmp == -1){
                continue;
            }
            c += d[tmp][1];
        }
    }
    cout << c << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define int long long
#define ar array
#define db long double
#define pow pw
const db pi = 3.14159265358979323846;
int pw(int a,int b){
    int ans=1;
    while(b){
    if (b%2) ans*=a;
    a*=a;
    b/=2;
    }
    return(ans);
}
const int mxn=1e3+7,du=1e9+7;
int m,n;
char a[mxn][mxn];
int dp[mxn][mxn];
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin>>m>>n;  
    for (int i=1;i<=m;i++) for (int j=1;j<=n;j++) cin>>a[i][j];
    dp[1][1]=1;
    for (int i=1;i<=m;i++)
    for (int j=1;j<=n;j++) 
    {
    if (i==1&&j==1) continue;
    if (a[i][j]=='.') dp[i][j]=(dp[i-1][j]+dp[i][j-1])%du;
    else dp[i][j]=0;
    }
    cout<<dp[m][n];
    return 0;
}

Measured memory_bytes: 12464
N=int (input())
while N != 0:
    Jcou = 0
    JUE=[]
    for i in range(N):
        JUE.append(list(map(int, input().split())))
    M=int(input())
    RO=[10,10]
    for j in range(M):
        m1=list(map( str,input().split()))
        if(m1[0]=="N"):
            for k in range(int(m1[1])):
                RO[1]+=1
                if RO in JUE:
                    JUE.remove(RO)
                    Jcou+=1
        elif(m1[0]=="S"):
            for k in range(int(m1[1])):
                RO[1]-=1
                if RO in JUE:
                    JUE.remove(RO)
                    Jcou+=1
        elif(m1[0]=="E"):
            for k in range(int(m1[1])):
                RO[0]+=1
                if RO in JUE:
                    JUE.remove(RO)
                    Jcou+=1
        elif(m1[0]=="W"):
            for k in range(int(m1[1])):
                RO[0]-=1
                if RO in JUE:
                    JUE.remove(RO)
                    Jcou+=1
    if (Jcou == N):
        print("Yes")
    else :
        print("No")


    
    N=int(input())


Measured memory_bytes: 5628
// Undone
#include <bits/stdc++.h>
#define int long long
#define double long double
#define INF 1e18
#define MOD 1000000007
using namespace std;
signed main() {
  int AB, BC, CA;
  cin >> AB >> BC >> CA;
  cout << AB*BC/2 << endl;  
}



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

int k, x;

int main() {
    scanf("%d%d", &k, &x);
    if (k * 500 >= x) printf("Yes\n");
    else printf("No\n");
}

Measured memory_bytes: 888
import java.util.Scanner;


public class Main {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int [] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i]= in.nextInt();
        }
        int b = 0;
        for (int i = 0; i < n; i++) {
            if (a[i]== i +1){
                b ++;
                i++;
            }
            
        }
        System.out.println(b);

    }
}














Measured memory_bytes: 50844
#include <cstdio>
#include <climits>
#include <cassert>
#include <cmath>
#include <iostream>
#include <string>
#include <algorithm>
#include <numeric>
#include <functional>
#include <tuple>
#include <list>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <vector>
#include <iterator>
#include <regex>

#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
#define FOR(x,xs) for(auto &x: xs)

using namespace std;
typedef long long ll;
typedef pair<int,int> PI;
typedef pair<ll,ll> PL;
typedef vector<int> VI;
typedef vector<ll> VL;

template <class T, template <class, class> class C, class charT = char>
void vdump(const C<T, allocator<T>> &v, const charT* delimiter = ", ",
           ostream &stream = cout) {
  copy(v.begin(), v.end(), ostream_iterator<T>(stream, delimiter));
  stream << endl;
}

int main() {
  ios::sync_with_stdio(false);
  int a, b;
  cin >> a >> b;
  vector<string> fld(100, string(100, '#'));
  REP(i,50,100) {
    REP(j,0,100) {
      fld[i][j] = '.';
    }
  }
  int i = 0;
  int j = 0;
  for(a--; a > 0; a--) {
    fld[i][j] = '.';
    j += 2;
    if(j >= 100) {
      j = 0;
      i += 2;
    }
  }
  i = 52;
  j = 0;
  for(b--; b > 0; b--) {
    fld[i][j] = '#';
    j += 2;
    if(j >= 100) {
      j = 0;
      i += 2;
    }
  }
  cout << "100 100" << endl;
  FOR(v,fld) {
    cout << v << endl;
  }

  return 0;
}


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

using namespace std;

int main() {
    int N, K;scanf("%d%d", &N, &K);
    char in[55];
    scanf("%s", in);
    in[K-1]+=32;
    printf("%s\n", in);
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
using namespace std;
int main()
{
    long long int n, k;
    pair<long long int, long long int> a[100001];
    cin >> n >> k;
    for (int i = 0; i < n; i++)
    {
        cin >> a[i].first >> a[i].second;
    }
    sort(a, a + n);
    long long int i = 0, c = 0;
    while (c < k)
    {
        c += a[i].second;
        i++;
    }
    cout << a[i - 1].first << endl;
    return 0;
}

Measured memory_bytes: 1792
def head_clf(N, A):
    import itertools
    head = ['M', 'A', 'R', 'C', 'H']
    head_cnt = [0 for _ in range(5)]
    for _ in range(N):
        S = input()
        if S[0] in head:
            A.append(S)
    A = list(set(A))
    for a in A:
        ind = head.index(a[0])
        head_cnt[ind] += 1   
    com =  list(itertools.combinations(head_cnt,3))
    ans = 0
    for i in com:
        ans += i[0]*i[1]*i[2]
    return ans

def main():
    N = int(input())
    A = []
    print(head_clf(N, A))

if __name__ == '__main__':
    main()

Measured memory_bytes: 16044
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using V = vector<int>;
using VV = vector<vector<int>>;
using VVV = vector<vector<vector<int>>>;
using VL = vector<ll>;
using VVL = vector<vector<ll>>;
using VVVL = vector<vector<vector<ll>>>;
using pq = priority_queue<int>;
template<class T>
using P = pair<T, T>;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define REP(i,k,n) for(int i=(k);i<(n);i++)
#define all(a) (a).begin(),(a).end()
#define output(x,y) cout << fixed << setprecision(y) << x << endl;
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; }
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
int under = (1 << 31);
int upper = under - 1;
ll UNDER = (1LL << 63);
ll UPPER = UNDER - 1;
const int MOD = 1e9 + 7;
const long double pi = 3.141592653589793;
int main() {
	int a, b, c;
	cin >> a >> b >> c;
	int A, B, C;
	A = a % 2;
	B = b % 2;
	C = c % 2;
	int ans = 0;
	if (A != B || B != C || C != A) {
		int x = A ^ B ^ C;
		if (A != x) a++;
		if (B != x) b++;
		if (C != x) c++;
		ans++;
	}
	int M = max({ a,b,c });
	ans += (M - a) / 2;
	ans += (M - b) / 2;
	ans += (M - c) / 2;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
    int A,B;
    cin>>A>>B;
    if(A==B)
        {
            cout<<"Draw"<<endl;
        }
    else if(A==1&&B!=1)
        {
            cout<<"Alice"<<endl;
        }
    else if(A!=1&&B==1)
        {
            cout<<"Bob"<<endl;
        }

    else if(A>B){
        cout<<"Alice"<<endl;
    }
    else
    {
        cout<<"Bob"<<endl;
    }
        return 0;
}



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

int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  vector<int> ans(n);

  rep(i, n) cin >> a[i];

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

  rep(i, n) cout << ans[i] << " ";

  cout << endl;

  return 0;
}


Measured memory_bytes: 1664
from sys import setrecursionlimit


def get_node_id(i, j, node_id_db):
    if i < j:
        return node_id_db[i][j]
    else:
        return node_id_db[j][i]


def dfs(node_id, edges, dp):
    t = dp[node_id]
    if t >= 0:
        return t
    dp[node_id] = 0
    result = 0
    for n in edges[node_id]:
        t = dfs(n, edges, dp)
        if t == 0:  # looped
            print(-1)
            exit()
        if t > result:
            result = t
    result += 1
    dp[node_id] = result
    return result


def main():
    N = int(input())
    A = [[int(e) - 1 for e in input().split()] for _ in range(N)]

    node_id_db = [[0] * N for _ in range(N)]
    v = 0
    for i in range(N):
        for j in range(i + 1, N):
            node_id_db[i][j] = v
            v += 1

    start_nodes = []
    edges = [[] for _ in range(N * (N - 1) // 2)]
    for i in range(N):
        Ai = A[i]
        from_id = get_node_id(i, Ai[0], node_id_db)
        if i < Ai[0]:
            start_nodes.append(from_id)
        for j in range(1, N - 1):
            to_id = get_node_id(i, Ai[j], node_id_db)
            edges[from_id].append(to_id)
            from_id = to_id

    dp = [-1] * (N * (N - 1) // 2)
    print(max(dfs(n, edges, dp) for n in start_nodes))


setrecursionlimit(10 ** 6)
main()


Measured memory_bytes: 137368
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Math;
using static System.Console;
using static exMath;
using static exReadLine;


class Program
{
    static void Main(string[] args)
    {
        int H, W, N;
        intReadLine(out H);
        intReadLine(out W);
        intReadLine(out N);
        if(N % Max(H, W) == 0)
        {
            WriteLine(N / Max(H, W));
        }
        else
        {
            WriteLine((N / Max(H, W)) + 1);
        }
        ReadLine();
    }
}

static class exReadLine
{
    public static void intReadLine(out int a)
    {
        a = int.Parse(ReadLine());
    }
    public static void intReadLine(out int a, out int b)
    {
        int[] input = ReadLine().Split().Select(int.Parse).ToArray();
        a = input[0];
        b = input[1];
    }
    public static void intReadLine(out int a, out int b, out int c)
    {
        int[] input = ReadLine().Split().Select(int.Parse).ToArray();
        a = input[0];
        b = input[1];
        c = input[2];
    }
    public static void intReadLine(out int a, out int b, out int c, out int d)
    {
        int[] input = ReadLine().Split().Select(int.Parse).ToArray();
        a = input[0];
        b = input[1];
        c = input[2];
        d = input[3];
    }

    public static void longReadLine(out long a)
    {
        a = long.Parse(ReadLine());
    }
    public static void longReadLine(out long a, out long b)
    {
        long[] input = ReadLine().Split().Select(long.Parse).ToArray();
        a = input[0];
        b = input[1];
    }
    public static void longReadLine(out long a, out long b, out long c)
    {
        long[] input = ReadLine().Split().Select(long.Parse).ToArray();
        a = input[0];
        b = input[1];
        c = input[2];
    }
    public static void longReadLine(out long a, out long b, out long c, out long d)
    {
        long[] input = ReadLine().Split().Select(long.Parse).ToArray();
        a = input[0];
        b = input[1];
        c = input[2];
        d = input[3];
    }
}

static class exMath
{
    // 最大公約数
    public static int Gcd(int a, int b)
    {
        if (a < b) return Gcd(b, a);
        while (b != 0)
        {
            var r = a % b;
            a = b;
            b = r;
        }
        return a;
    }
    public static long Gcd(long a, long b)
    {
        if (a < b) return Gcd(b, a);
        while (b != 0)
        {
            var r = a % b;
            a = b;
            b = r;
        }
        return a;
    }

    // 最小公倍数
    public static long Lcm(int a, int b)
    {
        return BigMul(a, b) / Gcd(a, b);
    }
    public static long Lcm(long a, long b)
    {
        return a * b / Gcd(a, b);
    }
}

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


int main(){

  int N,x,tmp,num;
  vector<int> a;
  
  cin >> N >> x;
  for(int i=0;i<N;i++){
    cin >> tmp;
    a.push_back(tmp);
  }

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

  num=0;
  for(int i=0;i<N;i++){
    if((x<a.at(i)) || ( i==N-1  && x > a.at(i) )){
      break;
    }else{
      num++;
      x -= a.at(i);
    }
  }

  cout << num << endl;

}


Measured memory_bytes: 3628
#include <stdio.h>
int main(void){
    // Your code here!
    char tenki[8];
    int rain=0;
    int rain_max=0;
    int i;
    
    scanf("%s", tenki);
    
    for(i=0;i<3;i++){
        if(tenki[i]=='R'){
            rain++;
            if(rain>rain_max){
                rain_max = rain;
            }
        }
        else{
            rain=0;
        }
    }
    
    printf("%d\n", rain_max);
    
    return 0;
}


Measured memory_bytes: 1732
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();
		int ans = 1;
		for(int i = 0; i < n; i++) {
			if(ans > k) {
				ans += k;
			}else {
				ans += ans;
			}
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 23124