akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

#define PRIME 1000000007

using namespace std;

int a[100005];
long int dp[100005][105],sum[100005][105];

long int range(int i,int j)
{
	if(i >= 0 && j >= 0)
	return sum[i][j];
	return 0;
}

int main()
{
	int n,k;
	scanf("%d%d",&n,&k);
	for(int i=0;i<n;++i)
	scanf("%d",a+i);
	for(int i=0;i<=k;++i)
	{
		for(int j=0;j<=n;++j)
		{
			if(i == 0 && j == 0)
			dp[i][j] = 1;
			else if(i && j == 0)
			dp[i][j] = 0;
			else
			{
				if(i >= a[j-1])
				dp[i][j] = (range(i,j-1) - range(i-a[j-1]-1,j-1) + PRIME)%PRIME;
				else 
				dp[i][j] = range(i,j-1)%PRIME;
				
			}
			sum[i][j] = (dp[i][j] + range(i-1,j))%PRIME;	
		}
	}
	printf("%ld\n",dp[k][n]);
	return 0;
}


Measured memory_bytes: 164352
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define M 1000000007
#define ll long long
#define REP(i,a,b) for(ll i=a;i<b;i++)
#define REPI(i,a,b) for(ll i=b-1;i>=a;i--)
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define MT make_tuple
#define G(a,b) get<a>(b)
#define VI vector<int>
#define VLL vector<long long>

#define o_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define o_setll tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
//member functions :
//1. order_of_key(k) : number of elements strictly lesser than k
//2. find_by_order(k) : k-th element in the set

ll modI(ll a, ll m);
ll gcd(ll a, ll b);
ll powM(ll x, unsigned ll y, unsigned ll m);
void pairsort(int a[], int b[], int n);
void pairsortll(ll a[],ll b[],ll n);
ll logint(ll x,ll y);


ll gcd(ll x,ll y)
{
    if(x==0) return y;
    return gcd(y%x,x);
}

ll powM(ll x,ll y,ll m)
{
    if(y==0) return 1;
    ll p=powM(x,y/2,m)%m;
    p=(p*p)%m;
    return (y%2==0)?p:(x*p)%m;
}

ll modI(ll a, ll m)
{
    ll m0=m,y=0,x=1;
    if(m==1) return 0;
    while(a>1)
    {
        ll q=a/m;
        ll t=m;
        m=a%m;
        a=t;
        t=y;
        y=x-q*y;
        x=t;
    }
    if(x<0) x+=m0;
    return x;
}

void pairsort(int a[],int b[],int n)
{
    pair<int,int> v[n];
    REP(i,0,n)
    {
        v[i].F=a[i];
        v[i].S=b[i];
    }
    sort(v,v+n);
    REP(i,0,n)
    {
        a[i]=v[i].F;
        b[i]=v[i].S;
    }
}

void pairsortll(ll a[],ll b[],ll n)
{
    pair<ll,ll> v[n];
    REP(i,0,n)
    {
        v[i].F=a[i];
        v[i].S=b[i];
    }
    sort(v,v+n);
    REP(i,0,n)
    {
        a[i]=v[i].F;
        b[i]=v[i].S;
    }
}

ll logint(ll x,ll y)
{
    ll ans=0;
    ll a=1;
    for(ll i=0;i<=x;i++)
    {
        if(x<a)
        {
            return ans;
        }
        ans++;
        a*=y;
    }
    return -1;
}

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

    /*
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    */

    ll q=1;
    //cin>>q;
    while(q--)
    {
        ll n;
        cin>>n;
        ll a[n];
        double x;
        REP(i,0,n)
        {
            ll t;
            cin>>t;
            a[i]=t;
            x+=1.0/t;
        }
        printf("%.12f",1/x);
    }

    return 0;
}


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

int main()
{
	string s;
	cin >> s;
	ll ans = 0;
	vector<int> v(26,0);
	for(auto c:s)
	{
		//cout<<c-'a'<<endl;
		v[c-'a']++;

		for(int i = 0;i<26;i++)
		{
			if(i+'a'==c)continue;
			ans += v[i];
		}
		//cout<<ans<<endl;
	}
	cout<<ans+1<<endl;
}

Measured memory_bytes: 640
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
 


public class Main {
	static int a1[]= {0,-1,0,1};
	static int b1[]= {-1,0,1,0};
	private static         Scanner sc = new Scanner(System.in);
	//result = Math.pow(num1, num3)
	//StringBuffer str = new StringBuffer(hoge1);
	//String hoge2 = str.reverse().toString();
	//map.containsKey(A)

	//Map<String, Integer> map = new HashMap<String, Integer>(n);
	/*for ( キーのデータ型 key : マップの名前.keySet() ) {
		データのデータ型 data = マップの名前.get( key );
		
		// keyやdataを使った処理;
	}*/
	//int i = Integer.parseInt(s);
	//Queue<String> qq=new ArrayDeque<>(); //add,poll,peek
	//Deque<String> qq=new ArrayDeque<>();//push,pop,peek
	//ArrayList<String> cc = new ArrayList<>(n);
	//Collections.sort(list);
	//Array.sort(list);   cc.contains(tmp)
	//Arrays.asList(c).contains("a")
	//list.set(1,"walk");//1 1 2 3 5
	static int K,N;
	static long mod =1000000007;
	//static 	ArrayList<Integer> cc = new ArrayList<>(100);
//<60 >62
	public static void main(String[] args) {
			//String S=sc.next();
			//int N=sc.nextInt();
			//int v[]=new int[N];
			//for(int i=0;i<N;i++) {}
		int N=sc.nextInt();
		int c=0;
		for(int i=1;i<=N;i++) {
			String v=""+i;
			if(v.length()%2==1) {
				c++;
			}
			
			
		}
		p(c);
	}
	static int v(int a) {
		return a*(a-1)/2;
	}

	
	//N==S
	//E==W
//83 S 
	//69E
	//78N
	//87W
	
	//static ArrayList<Integer> cc = new ArrayList<>(10001);
	
	static void p(String ans) {System.out.println(ans);};
	static void p(int ans) {System.out.println(ans);};
	static void p() {System.out.println();};
	static void p(long ans) {System.out.println(ans);};
	static void p(double ans) {System.out.println(ans);};
	public static int gcd(int a, int b) {
        return b == 0 ? a: gcd(b, a % b);
	}
	static String nextPermutation(String s) {
		ArrayList<Character> list=new ArrayList<>();
		for(int i=0;i<s.length();i++) {
			list.add(s.charAt(i));
		}
		int pivotPos=-1;
		char pivot=0;
		for(int i=list.size()-2;i>=0;i--) {
			if(list.get(i)<list.get(i+1)) {
				pivotPos=i;
				pivot=list.get(i);
				break;
			}
		}
		if(pivotPos==-1&&pivot==0) {
			return "Final";
		}
		int L=pivotPos+1,R=list.size()-1;
		
		
		
		int minPos=-1;
		char min =Character.MAX_VALUE;
		
		for(int i=R;i>=L;i--) {
			if(pivot<list.get(i)) {
				if(list.get(i)<min) {
					min=list.get(i);
					minPos=i;
				}
			}
		}
		
		Collections.swap(list, pivotPos, minPos);
		Collections.sort(list.subList(L, R+1));
		
		
		StringBuilder sb=new StringBuilder();
		for(int i=0;i<list.size();i++) {
			sb.append(list.get(i));
		}
		return sb.toString();
	}
}
	


Measured memory_bytes: 33364
#include<iostream>
#include<string>
#include<vector>
#include<iomanip>
#include<algorithm>
#include<queue>
#include<stack>
#include<map>
using namespace std;
#define ll long long
int main(){
    ll N;
    cin >> N;
    ll dp[N][3];
    ll a[3];
    ll i,j;
    ll tmp;
    for(j=0;j<3;j++){
      cin >> dp[0][j];
    }
    for(i=1;i<N;i++){
      cin >> a[0] >> a[1] >> a[2];
      for(j=0;j<3;j++){
        dp[i][j]=dp[i-1][(j+1)%3]+a[j];
        if(dp[i][j]<dp[i-1][(j+2)%3]+a[j])dp[i][j]=dp[i-1][(j+2)%3]+a[j];
      }
    }
    ll ans=dp[N-1][0];
    for(j=1;j<3;j++){
      if(ans<dp[N-1][j])ans=dp[N-1][j];
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 2560
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		int[] array = new int[5];

			for (int i = 0; i < 5; i++) {
				array[i] = scan.nextInt();
			}

			java.util.Arrays.sort(array);

			System.out.println(array[4] +" "+ array[3] +" "+array[2] +" "+array[1] +" "+array[0]);

	}
}

Measured memory_bytes: 0
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main {
	private	static	BufferedReader	br = null;

	static {
		br = new BufferedReader(new InputStreamReader(System.in));
	}
 
    /**
     * @param args
     */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		long[]	wait = null;

		while ((wait = parseWait()) != null) {
			long	out = 0;

			for (int l = 0; l < wait.length; l++) {
				out += wait[l] * ((long)(wait.length) - 1L - (long)(l));
			}

			System.out.println(out);
		}
	}

	private static long[] parseWait() {
		int		num  = 0;
		long[]	wait = null;

		if ((num = parseNum()) != 0) {
			wait = new long[num]; 
			for (int l = 0; l < num; l++) {
				wait[l] = (long)(parseNum());
			}
			Arrays.sort(wait);
		}

		return wait;
	}

	private static int parseNum() {
		int		num = 0;
		String	str = null;

		if ((str = parseStdin()) != null) {
			num = Integer.parseInt(str);
		}

		return num;
	}

	private static String parseStdin() {
        String  stdin = null;
        
        try {
        	String  tmp = br.readLine();
        	if (tmp != null) {
            	if (!tmp.isEmpty()) {
            		stdin = tmp;
            	}
        	}
        }
        catch (IOException e) {}
 
        return stdin;
	}
}

Measured memory_bytes: 25052
from sys import stdin
s = list(stdin.readline().rstrip())
q = int(stdin.readline().rstrip())
t = []
k = []
for i in range(q):
    t.append([x for x in stdin.readline().rstrip().split()])
r = 0
for i in range(q):
    if int(t[i][0]) == 1:
        if r == 1:
            r = 0
        else:
            r = 1
    else:
        if (int(t[i][1]) + r) % 2 == 0:
            s.append(t[i][2])
        else:
            k.append(t[i][2])
k = list(reversed(k))
k.extend(s)
if r == 1:
    k = list(reversed(k))
k = ''.join(k)
print(k)

Measured memory_bytes: 32804
#include<bits/stdc++.h>
typedef long long ll;
typedef long double ld;
#define FASTIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
  
using namespace std;

const ll inf = 1e17;
const ll N = 1e6+10;
const ll bits = 62;
const ll mod = 1e9+7;

int main(){
   vector<string> arr = { "Sunny", "Cloudy", "Rainy"};
   string s;

   cin>>s;

   for(int i=0;i<3;i++){
      if(arr[i]==s){
         cout<<arr[(i+1)%3]<<"\n";
         return 0;
      }
   }
   
}

Measured memory_bytes: 256
import java.util.Scanner;
import java.util.List;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
	int a = sc.nextInt();
    if (a < 1200) {
      System.out.println("ABC");
    } else {
      System.out.println("ARC");
    }
  }
}

Measured memory_bytes: 25044
import java.util.*;
public class Main {
	public static void main(String[] args){
	
	//入力
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		//String S=sc.next();
		int a=0;		//適当に調整
		
		while(N>0){
			a+=N%10;
			N/=10;
		}
		if(a==1){
			a=10;
		}
	
	//出力
		System.out.println(a);
	}
}

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

int main(){
    int x;
    cin >> x;
    int ans = 1;
    for(int i = 2; i <= 10; i++){
        for(int j = 1; pow(j,i) <= x; j++){
            ans = max(ans, (int)pow(j,i));
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#define _DEBUG
#ifdef _DEBUG
#define _GLIBCXX_DEBUG -Wall -Wextra -Wshadow -D_GLIBCXX_ASSERTIONS -DDEBUG -ggdb3 -fmax-errors=2
#endif

#pragma warn +xxx
#include<bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define PB push_back
#define ln "\n"
#define forn(i,e) for( i=0; i<e; i++)
#define forsn(i,s,e) for( i=s; i<e; i++)
#define rforn(i,e) for( i=e; i>=0; i--)
#define vasort(v)         sort(v.begin(), v.end());
#define vdsort(v)         sort(v.begin(), v.end(),greater<int>());
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define out1(x1) cout << x1 << ln
#define out2(x1,x2) cout << x1 << " " << x2 << ln
#define out3(x1,x2,x3) cout << x1 << " " << x2 << " " << x3 << ln
#define out4(x1,x2,x3,x4) cout << x1 << " " << x2 << " " << x3 << " " << x4 << ln


#define in1(x1) cin >> x1
#define in2(x1,x2) cin >> x1 >> x2
#define in3(x1,x2,x3) cin >> x1 >> x2 >> x3
#define in4(x1,x2,x3,x4) cin >> x1 >> x2 >> x3 >> x4

#define arrin(a, n) forn(i, n) cin >> a[i];
#define arrout(a,n) forn(i,n) {cout << a[i] << " ";} cout << ln;

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int dr[] = {0,1,-1,0,1,-1,1,-1};
int dc[] = {1,0,0,-1,1,-1,-1,1};

ll exp(ll n, ll m, ll md){
        ll a = 1;
        while (m > 0){
                if (m&1) a = (a * n%md) % md;
                m /= 2;
                n = (n*n) % md;
        }
        return a % md;
}

void disp(vi v){
        for(auto u:v)
                cout<<u<<" ";
        cout<<"\n";
}

#define DEBUG
#ifdef DEBUG

#endif


void go1() {
        ll n;
        cin >> n;
        vector<char> ans;
        while(n>0) {
                if(n%26 == 0) {
                        ans.PB('z');
                }
                else ans.PB(n%26 + 'a'-1);
                n -= n%26 + 26*(n%26==0);
                n/=26;
        }
        int i;
        for(i = ans.size()-1;i>=0;i--) {
                cout << ans[i];
        }

}
void go2() {
        char c;
        cin >> c;
        if ((int) c >= 97) {
                cout << 'a';
        } else cout << 'A';
}
int main(){
        fio;
        //freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
        ll tt = 1;
/*

        cin >> tt;


        //*/
        while(tt--){
                go1();
        }

        return 0;
}

Measured memory_bytes: 3600
using System;
using System.Text;

namespace ALDS1_2_A
{
    class Program
    {
        static void Main(string[] args)
        {
            string input = Console.ReadLine();
            int N = int.Parse(input);
            int[] list = new int[N];
            input = Console.ReadLine();
            string[] num = input.Split(' ');
            for (int i = 0; i < N; i++)
            {
                list[i] = int.Parse(num[i]);
            }

            bubbleSort(list, N);

        }

        public static void bubbleSort(int[] arr, int p)
        {
            bool flag = true;
            int tmp;
            int count = 0;
            while (flag)
            {
                flag = false;
                for (int i = p - 1; i > 0; i--)
                {
                    if (arr[i] < arr[i-1])
                    {
                        tmp = arr[i - 1];
                        arr[i - 1] = arr[i];
                        arr[i] = tmp;
                        flag = true;
                        count++;
                    }
                }
            }
            string output = ArrayJoin(arr);

            Console.WriteLine(output);
            Console.WriteLine(count);
            
        }

        private static string ArrayJoin(int[] arr)
        {
            StringBuilder sb = new StringBuilder();
            for (int i = 0; i < arr.Length; i++)
            {
                if (sb.Length > 0)
                {
                    sb.Append(" ");
                }
                sb.Append(arr[i]);
            }
            return sb.ToString();
        }
    }
}

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

int n;
vector<int> v;
int ans;
int dp[100010];
int inf = 1e9+7;

int func(int x){
//	cout << x << "\n";
	if(dp[x] < inf) return dp[x];
	for(int i=0; i<v.size(); ++i)
		if(v[i] == x)
			return dp[x] = 1;
	for(int i=0; (i<v.size()&&v[i]<=x); ++i){
		dp[x] = min(dp[x], 1+func(x-v[i]));
	}
	return dp[x];
}

int main(){
//	cin.tie(0);
//	ios::sync_with_stdio(false);
	cin >> n;
	v.push_back(1);
	int a = 6;
	while(a <= n){
		v.push_back(a);
		a *= 6;
	}
	int b = 9;
	while(b <= n){
		v.push_back(b);
		b *= 9;
	}
	sort(v.begin(), v.end());
//	for(int i=0; i<v.size(); ++i)
//		cout << v[i] << "\n";
	for(int i=0; i<=n; ++i) dp[i] = inf;
	cout << func(n) << "\n";
}

Measured memory_bytes: 3712
import java.util.Scanner;
class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = sc.next();

    
    if(s.equals("SUN")) System.out.println(7);
    else if(s.equals("MON")) System.out.println(6);
    else if(s.equals("TUE")) System.out.println(5);
    else if(s.equals("WED")) System.out.println(4);
    else if(s.equals("THU")) System.out.println(3);
    else if(s.equals("FRI")) System.out.println(2);
    else if(s.equals("SAT")) System.out.println(1);
    
}
}


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

using namespace std;

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void __print(vector<bool> x){cerr<<"{";int f=x.size();for(auto i:x){cerr<<i;(--f !=0)?cerr<<",":cerr<<"";}cerr<<"}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
//void __print(vector<bool> x) {int f = 0; cerr << '{'; for (auto i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
//void _print() {cerr << "]\n";}

#ifndef ONLINE_JUDGE
#define ANTHRO(x...) cerr << "[" << #x << "] = [", _print(x)
#else
#define ANTHRO(x...)
#endif

template<typename... T>
void read(T&... args) {
	((cin >> args), ...);
}

template<typename... T>
void writ(T&&... args) {
	((cout << args << " "), ...);
}
#define ll long long
#define MOD 1000000007
#define INF (ll)1e18
#define EPS 1e-9
/*
	XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    No, nothing good starts in a getaway car
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
*/

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll k,a,b; read(k,a,b);
    for(ll i=a;i<=b;i++){
		if(i%k==0){
			cout<<"OK";
			return 0;
		}
	}
	cout<<"NG";
    return 0;
}


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

using namespace std;
using llong = long long;
using ldbl = long double;
using P = pair<llong, llong>;

#define ALL(x) x.begin(), x.end()

const llong inf = 1100100100100100ll;
const llong mod = 1e9+7;

llong N, K;
vector<vector<llong> > dp;

llong solve(llong now, llong bunkatsu) {
	if (now == 0) return dp[now][bunkatsu] = bunkatsu == 0;
	if (bunkatsu == 0) return dp[now][bunkatsu] = 0;
	if (dp[now][bunkatsu] != -1) return dp[now][bunkatsu];

	return dp[now][bunkatsu] = (solve(now-1, bunkatsu) + solve(now-1, bunkatsu-1)) % mod;
}

int main() {
	cin >> N >> K;

	dp.resize(N+1, vector<llong>(K+2, -1));
	for (int i = 0; i <= K+1; ++i) {
		solve(N, i);
		solve(N-K, i);
	}

	for (int i = 1; i <= K; ++i) {
		llong b = dp[K][i];
		llong r = (dp[N-K][i-1] + dp[N-K][i]*2 + dp[N-K][i+1]) % mod;
		cout << b*r%mod << endl;
		// cerr << dp[K][i] << " " << dp[N-K][i-1] << " " << dp[N-K][i] << " " << dp[N-K][i+1] << endl;
		// cout << dp[K][i] * (max(0ll, dp[N-K][i-1]) + max(0ll, dp[N-K][i])*2ll + max(0ll, dp[N-K][i+1])) % mod << endl;
	}

	return 0;
}


Measured memory_bytes: 31744
#include<iostream>
#include<vector>
#include<string>

using namespace std;

// vector<string> week = {"SUN","SAT","FRI","THU","WED","TUE","MON"};
vector<string> week = {"SUN","MON","TUE","WED","THU","FRI","SAT"};

int main()
{
    string S;
    cin >> S;
    for (int i=0; i<7; ++i)
    {
        if(week[i]==S) cout << 7-i << endl;
    }
    return 0;
}

Measured memory_bytes: 256
N, M = map(int, input().split())
A = list(map(lambda x: int(x)*(-1), input().split()))

import heapq
heapq.heapify(A)

for _ in range(M):
    tmp_min = heapq.heappop(A)
    heapq.heappush(A, (-1)*(-tmp_min // 2))
print(-sum(A))

Measured memory_bytes: 15020
// a -> blue, b -> red

#include <stdio.h>

int main(void)
{
  long long n, a, b;
  scanf("%lld %lld %lld", &n, &a, &b);
  if (a < 0 || b < 0)
  {  
    return 0;
  }
  
  long long div, mod, ans;
  div = n / (a + b);
  mod = n % (a + b);
  
  if (mod >= a)
  {
    ans = div * a + a;
  }
  else if (mod < a)
  {
    ans = div * a + mod;
  }
  printf("%lld", ans);
  return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<queue>
#include<stack>
#include<set>
#include<algorithm>
#include<utility>
#include<map>
using namespace std;
typedef long long ll;
const int mod = 1000000007;
const int INF = 1001001001;

ll pow_mod(ll p, ll n, ll m) {
	if (n == 0) return 1;
	else if (n == 1) return p % m;
	else if (n % 2 == 1) return p * pow_mod(p, n - 1, m) % m;
	else {
		ll tmp = pow_mod(p, n / 2, m);
		return (tmp * tmp) % m;
	}
}

ll gcd(ll x, ll y) {
	if (y == 0) {
		return x;
	}
	return gcd(y, x % y);
}

ll com_mod(ll n, ll k, ll m) {
	if (k == 0) return 1;
	else {
		ll x = 1;
		ll y = 1;
		for (ll i = 0; i < k; i++) {
			x = (x * (n - i)) % m;
			y = (y * (i + 1)) % m;
		}
		ll res = (x * pow_mod(y, m - 2, m)) % m;
		return res;
	}
}

int main() {
	int a, b, c;
	cin >> a >> b >> c;
	if (a + b == c || b + c == a || c + a == b)cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

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

int main(){
    string S; cin >>S;
    for(int i = 0; i < 1 << 3; i++){
        int sum = S[0] - '0';
        for(int j = 0; j < 3; j++){
            if(i >> j & 1) sum += (int)(S[j+1] - '0');
            else sum -= (int)(S[j+1] - '0');
        }
        if(sum == 7){
            cout << S[0];
            for(int j = 0; j < 3; j++){
                if(i >> j & 1) cout << "+";
                else cout << "-";

                cout << S[j + 1];
            }
            cout << "=7" << endl;
            return 0;
        }
    }
}

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

template <typename T>
class modCal {
private:
	T mod;
public:
	modCal(T m = 1000000007) : mod(m) {}
	void add(T &a,T b) {
		a += b;
		if (a >= mod) a -= mod;
	}

	void sub(T &a,T b) {
		a -= b;
		if (a < 0) a += mod;
	}

	T mul(T &a,T b) {
		return (T)((long long)a * b % mod);
	}

	T power(T a, long long b) {
  		T res = 1;
  		while (b > 0) {
    		if (b & 1) {
      			res = mul(res, a);
    		}
   			a = mul(a, a);
    		b >>= 1;
  		}
  		return res;
	}

	T inv(T a) {
  		a %= mod;
  		if (a < 0) a += mod;
  		T b = mod, u = 0, v = 1;
  		while (a) {
    		T t = b / a;
    		b -= t * a; swap(a, b);
    		u -= t * v; swap(u, v);
 		}
  		assert(b == 1);
  		if (u < 0) u += mod;
  		return u;
	}

	T div(T &a,T b) {
		return mul(a,inv(b));
	}

	T nCr_mod(T n,T r) {
		r = min(r,n-r);
		T v = 1;
		for (T i = 0;i < r;i++) {
			v = mul(v,mul(n-i,inv(r-i)));
		}
		return v;
	}

	vector<T> nCr_alln(T n) {
		vector<T> ret(n+1,1);
		for (T i = 0;i <= n;i++) {
			ret[i] = mul(ret[i-1],mul(n-i+1,inv(i)));
		}
		return ret;
	}

	vector<T> fact_mod(T n) {
		vector<T> fact(n+1,1);
		for (T i = 2;i <= n;i ++) fact[i] = mul(fact[i-1],i);
		return fact;
	}

	vector<T> fact_inv_mod(T n) {
		vector<T> fact_inv(n+1,1);
		for (T i = 1;i <= n;i++) fact_inv[i] = mul(fact_inv[i-1],inv(i));
		return fact_inv;
	}
};

int main(void) {
	modCal<int> md;
	int m,n;
	cin >> m >> n;
	cout << md.power(m,n) << endl;
}


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

const ll int INF = 1e18 + 5;

int main(int argc, char const *argv[])
{
	// ios_base::sync_with_stdio(false);
 //    cin.tie(NULL);
    ll int n,w;
    cin>>n>>w;
    ll int wt[n][2];
    ll int sumval = 0;
    for(ll int i=0;i<n;i++){
    	cin>>wt[i][0]>>wt[i][1];
    	sumval += wt[i][1];
    }
    // ll int dp[sumval+1] = {0};
    vector<ll int> dp(sumval+1,INF);
    // ll int val = n*1000;
    dp[0] = 0;
    for(ll int i=0;i<n;i++){
    	for(ll int j=sumval-wt[i][1];j>=0;j--){
    		dp[j+wt[i][1]] = min(dp[j]+wt[i][0],dp[j+wt[i][1]]);
    	}
    }
    ll int ans = 0;
    for(ll int i=0;i<=sumval;i++){
    	if(dp[i]<=w)
    	ans = max(ans,i);
    }
    cout<<ans;
	return 0;
}

Measured memory_bytes: 1024
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        int cnt = 0;
        int gCnt = 0;
        int n = s.length();
        if (n % 2 != 0) {
            gCnt = n / 2 + 1;
        } else {
            gCnt = n / 2;
        }
        for (int i = 0; i < n; i++) {
            if (s.charAt(i) == 'g') {
                cnt++;
            }
        }
        System.out.println(cnt - gCnt);
    }
}


Measured memory_bytes: 24228
using System;

namespace abc127B
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split();
            int A = int.Parse(str[0]);
            int B = int.Parse(str[1]);
            int C = int.Parse(str[2]);
            int[] D = new int[11];
            D[0] = C;
            for(int i = 1; i <= 10; i++)
            {
                D[i] = (D[i-1] * A) - B;
                Console.WriteLine(D[i]);
            }
        }
    }
}


Measured memory_bytes: 11092
"use strict";
const Main = (input) =>{
   let xs = input.trim().split(' ').map(v=>parseInt(v,10));
   let ans = '';
   if(xs[0]>xs[1]){
     for(let i=0; i<xs[0]; i++){
        ans += xs[1];
     }
    }else if(xs[0]<xs[1]){
      for(let i=0; i<xs[1]; i++){
         ans += xs[0];
        }
    }else{
    　for(let i=0; i<xs[0]; i++){
        　ans += xs[0];
         }
    }
    console.log(ans);
   }

Main(require('fs').readFileSync('/dev/stdin','utf8'));

Measured memory_bytes: 7372
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;

int main() {
    ll N, M;
    cin >> N >> M;
    vector<bool> row(N * M, false), col(N * M, false);
    for (ll i = 0; i < N; i++) {
        ll A;
        cin >> A;
        A--;
        if (row[A]) {
            cout << 0 << endl;
            return 0;
        }
        row[A] = true;
    }
    for (ll i = 0; i < M; i++) {
        ll B;
        cin >> B;
        B--;
        if (col[B]) {
            cout << 0 << endl;
            return 0;
        }
        col[B] = true;
    }

    ll ans = 1;
    ll both_ok = 0, row_ok = 0, col_ok = 0;
    constexpr ll MOD = 1e9 + 7;
    for (ll i = N * M - 1; i >= 0; i--) {
        if (row[i] && col[i]) {
            (both_ok += row_ok + col_ok) %= MOD;
            (++row_ok) %= MOD;
            (++col_ok) %= MOD;
        } else if (row[i]) {
            (ans *= col_ok) %= MOD;
            (++row_ok) %= MOD;
            (both_ok += (col_ok + MOD - 1)) %= MOD;
        } else if (col[i]) {
            (ans *= row_ok) %= MOD;
            (++col_ok) %= MOD;
            (both_ok += (row_ok + MOD - 1)) %= MOD;
        } else {
            (ans *= both_ok) %= MOD;
            both_ok = (both_ok + MOD - 1) % MOD;
        }
    }

    cout << ans << endl;
}

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

Measured memory_bytes: 1156
#include<iostream>
#include<cstdio>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
const double EPS = 1e-9;
typedef pair<int, int> P;
typedef unsigned int ui;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
struct magic { ll dam; ll cost; };
int main() {
	int n;
	while (cin >> n, n) {
		ll h[100]; ll ma=0;
		vector<magic> m1, m2;
		rep(i, n) {
			cin >> h[i]; ma = max(ma, h[i]);
		}
		int m; cin >> m;
		rep(i, m) {
			string x; ll c; string y; ll d;
			cin >> x >> c >> y >> d;
			if (y == "Single") {
				m1.push_back({ d,c });
			}
			else {
				m2.push_back({ d,c });
			}
		}
		ll dp1[1000000], dp2[1000000];
		fill(dp1, dp1 + 1000000, INF);
		fill(dp2, dp2 + 1000000, INF);
		dp1[0] = dp2[0] = 0;
		int len1 = m1.size();
		int len2 = m2.size();
		rep(i, len1) {
			rep(j, 1000000) {
				int nex = j + (int)m1[i].dam;
				if (nex < 1000000) {
					dp1[nex] = min(dp1[nex], dp1[j] + m1[i].cost);
				}
			}
		}
		rep(i, len2) {
			rep(j, 1000000) {
				int nex = j + (int)m2[i].dam;
				if (nex < 1000000) {
					dp2[nex] = min(dp2[nex], dp2[j] + m2[i].cost);
				}
			}
		}
		per(i, 1000000) {
			if (i > 0) {
				dp1[i - 1] = min(dp1[i - 1], dp1[i]);
				dp2[i - 1] = min(dp2[i - 1], dp2[i]);
			}
		}
		ll out = INF;
		rep(i, 1000000) {
			ll sum = dp2[i];
			if (sum == INF)continue;
			rep(j, n) {
				ll rest = h[j] - i;
				if (rest < 0)continue;
				sum += dp1[rest];
			}
			out = min(out, sum);
		}
		if (dp1[1] == INF) {
			out = dp2[ma];
		}
		cout << out << endl;
	}
	return 0;
}


Measured memory_bytes: 18816
#include <iostream>
#include <algorithm>
constexpr int N = 18;
int n;
int a[N][2];
int dp[1 << N][N];
int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    std::cin >> n;
    for (int i = 0; i < n; ++i)
        std::cin >> a[i][0];
    for (int i = 0; i < n; ++i) {
        std::cin >> a[i][1];
        if (i % 2 == 1)
            std::swap(a[i][0], a[i][1]);
    }
    for (int i = 0; i < (1 << n); ++i)
        std::fill(dp[i], dp[i] + n, -1);
    for (int i = 0; i < n; ++i)
        dp[1 << i][i] = 0;
    for (int s = 1; s < (1 << n) - 1; ++s) {
        int pos = __builtin_popcount(s) - 1;
        for (int i = 0; i < n; ++i) {
            if ((s >> i & 1) && dp[s][i] != -1) {
                int val = a[i][pos % 2];
                for (int j = 0; j < n; ++j) {
                    if ((~s >> j & 1) && a[j][(pos + 1) % 2] >= val) {
                        int t = s | 1 << j;
                        int tmp = dp[s][i] + pos + 1 - __builtin_popcount(s & ((1 << j) - 1));
                        if (dp[t][j] == -1 || dp[t][j] > tmp)
                            dp[t][j] = tmp;
                    }
                }
            }
        }
    }
    int ans = -1, s = (1 << n) - 1;
    for (int i = 0; i < n; ++i)
        if (dp[s][i] != -1 && (ans == -1 || ans > dp[s][i]))
            ans = dp[s][i];
    std::cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 18816
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int x = scan.nextInt();
		int n = scan.nextInt();
		int[] p = new int[n];
		int ans = x;
		if(n == 0) {
			System.out.println(x);
			System.exit(0);
		}
		int count = 0;
		for(int i=0;i<n;i++) {
			p[i] = scan.nextInt();
		}
		
		for(int j=0;j<=100;j++) {
			boolean b = true;
			for(int k=0;k<n;k++) {
				if(ans == p[k]) {
					b = false;
				}
			}
			if(b) {
				System.out.println(ans);
				System.exit(0);
			}
			if(j % 2 == 0) {
				ans -= j+1;
			}else {
				ans += j+1;
			}
		}

	}

}

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

using namespace std;

vector<int> G[100000], color(100000);
int c;

void dfs(int v) {
	color[v] = c;
	for (int i = 0; i < G[v].size(); ++i) {
		int e = G[v][i];
		if (!color[e]) dfs(e);
	}
}

int main() {
	int n, m; cin >> n >> m;
	while(m--) {
		int s, t; cin >> s >> t;
		G[s].push_back(t);
		G[t].push_back(s);
	}
	for (int i = 0; i < n; ++i) {
		if (!color[i]) {
			c++;
			dfs(i);
		}
	}
	int q; cin >> q;
	while (q--) {
		int s, t; cin >> s >> t;
		if (color[s] == color[t]) cout << "yes" << endl;
		else cout << "no" << endl;
	}

	return 0;
}


Measured memory_bytes: 11812
import java.util.*;


public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int s = sc.nextInt();
        int w = sc.nextInt();
        if(w >= s){
            System.out.println("unsafe");
        }else{
            System.out.println("safe");
        }
    }

}


Measured memory_bytes: 35740
import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.regex : regex;
import std.container;
import std.bigint;


void main()
{
  auto n = readln.chomp.to!int;
  auto res = new int[](n);

  immutable MAX = 55_555;

	bool[MAX] p;
	p[] = true;
	p[0..2] = false;
	foreach (i; 2..sqrt(MAX*1.0).ceil.to!int) {
		if (p[i]) {
			foreach (j; iota(i*2, MAX, i))
				p[j] = false;
		}
	}

  int i;
  int j = 2;
  while (i < n) {
    while (!p[j] || j % 5 != 1) {
      j++;
    }
    res[i] = j;
    j++;
    i++;
  }

  writefln("%(%s %)", res);
}


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

#define rep(i,n) for(long long int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(long long int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(long long int i=(a);i>(b);i--)
#define all(v) (v).begin(), (v).end()
#define pb(q) push_back(q)
#define P pair<int,int>
typedef long long ll;

using namespace std;

const int INF = 1e9,MOD = 1e9 + 7;
const ll LINF = 1e18;

//while(x!=0){
            //sum+=x%10;
           // x/=10;
        //}
        //各桁の和

//s.find(w[i])==string::npos
//findの使い方

long long int n,cnt=0,ans=0,a,b,c,cmp,data,m,h,x,y;

string s,w;

vector<int> z;

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

	cin >> a >> b;
	if((a*b)%2==0){
	    cout << "Even" << endl;
	}
	else
	{
	    cout << "Odd" << endl;
	}
return 0;
}


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

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

vector<long long > a(n);
long long  count = 1;
for (int i = 0; i < n; ++i)
{
	cin >> a[i];
}
for (int i = 0; i < n; ++i)
{
	if(a[i] == 0){
		cout << 0 <<endl;
		return 0;
	}
}
for (int i = 0; i < n; ++i)
{
	
	if(count > 1000000000000000000/a[i]){
		cout << -1 <<endl;
		return 0;
	}
	count *= a[i];
	
}

cout << count <<endl;

}

Measured memory_bytes: 4036
#ifdef DEBUG

#else

#    pragma GCC optimize("O3,no-stack-protector")
#    pragma GCC optimize("unroll-loops")

#    if __cplusplus >= 201703L
#        pragma GCC target("avx2")
#    else
#        pragma GCC target("avx")
#    endif

#endif
// 実数の場合
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define dump(x) cout << x << endl
typedef int64_t Int;
typedef long double Ld;

using namespace std;
using Graph = vector<vector<Int>>;

const double pi = M_PI;
const Int MOD = 1000000007;

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

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

    while (true) {
        c -= b;
        if (c <= 0) {
            cout << "Yes" << endl;
            return 0;
        }

        a -= d;
        if (a <= 0) {
            cout << "No" << endl;
            return 0;
        }
    }

    return 0;
}


Measured memory_bytes: 3572
from math import factorial as f

mod = 10**9+7
def comb(n,r):
    if n < 0 or n < r:
        return 0
    return (f(n)//(f(n-r)*f(r)))%mod

s = int(input())
ans = 0
for n in range(1,667):
    ans += comb(s-2*n-1,n-1)
print(ans%mod)

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

int main() {
    string s1, s2, s3;  cin>>s1>>s2>>s3;
    cout<<(char)(s1[0] -'a' + 'A')<<(char)(s2[0] -'a' + 'A')<<(char)(s3[0] -'a' + 'A')<<endl;
    
    return 0;
}

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

using namespace std;
 
int main(){
    int n;
    string str;
 
    while(cin >> n ,n){
	int field = 0 ,p[11] = {0};
	cin >> str;
	int size = str.size() ,t = 0;
	for(int i = 0 ; i < size ; i++){
	    switch(str[i]){
	    case 'M':
		++p[t++];
		break;
	    case 'S':
		field += ++p[t];
		p[t++] = 0;
		break;
	    case 'L':
		p[t++] += ++field;
		field = 0;
		break;
	    }
	    if(t == n) t = 0;
	}
	sort(p,p+n);
	for(int i = 0 ; i < n ; i++){
	    cout << p[i] << " ";
	}
	cout << field << endl;
    }
    return 0;
}

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

int up(const void *a,const void*b){
  return *(int *)a - *(int *)b;
}



int main(void){
  int n;
  scanf("%d",&n);
  
  int a[n];
  for(int i = 0;i < n;i ++){
    scanf("%d",&a[i]);
  }
  
  qsort(a,n,sizeof(int),up);
  
  int b = a[0] , count = 1 , ans = 0;

  a[n] = '\0';
  for(int i = 1;i <= n;i ++){
    if(b == a[i]){
      count ++;
    }
    else{
      if(count%2 == 1){
        ans ++;
      }
      b = a[i];
      count = 1;
    }
  }
  if(n == 1){
    ans ++;
  }
  
  printf("%d\n",ans);
  
  return 0;
}


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

int main() {
	while(1) {
		int a, b;
		cin >> a >> b;
		if (a == 0 && b == 0)
		return 0;
		int krsw[17][17] = {};
		int cross[17][17] = {};
		int n;
		cin >> n;
		for(int i = 0; i < n; i++) {
			int x, y;
			cin >> x >> y;
			krsw[x][y] = 1;
		}
		for(int i = 1; i <= a; i++) {
			for(int j = 1; j <= b; j++) {
				if(krsw[i][j])
					continue;
				cross[i][j] = cross[i - 1][j] + cross[i][j - 1];
				if(i == 1 && j == 1)
					cross[1][1] = 1;
			}
		}
		cout << cross[a][b] << endl;
	}
	return 0;
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
#define ll long long
#define Tipo int
#define ii pair<Tipo, Tipo>
#define vi vector<Tipo>
#define vii vector<ii>
#define fs first
#define sc second
#define oo 1000000009
#define N 200123

using namespace std;

int main(){
    ios_base::sync_with_stdio(0);
    int a, b, c;
    cin >> a >> b >> c;
    cout << c << ' ' << a << ' ' << b << '\n';
    return 0;
}


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

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

	
	double ans = R*2*M_PI;
	
	printf("%lf", ans);
}

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

int main(){
	int n;
	cin >> n;
	vector<int> a(n);
	vector<int> b(n);
	vector<int> c(n-1);

	rep(i, n) cin >> a.at(i);
	rep(i, n) cin >> b.at(i);
	rep(i, n-1) cin >> c.at(i);

	int ans = 0;
	rep(i, n-1){
		ans += b.at(a.at(i)-1);
		if(a.at(i)+1 == a.at(i+1)) ans += c.at(a.at(i)-1);
	}
	ans += b.at(a.at(n-1)-1);

	cout << ans << endl;

	return 0;
}


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

int main(void) {
	long n,count;
	count = 0;
	cin >> n;
	for (long i = 1; i <= n; i++)
	{
		if (to_string(i).length() % 2 == 1)
		{
			count++;
		}
	}
	cout << count;
}

Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using static System.Math;
 
public class Hello{
    public static void Main(){
/*        string[] input = ReadLine().Split(' ');
        long a = long.Parse(input[0]);
        long b = long.Parse(input[1]);
        long c = long.Parse(input[2]);
        long d = long.Parse(input[3]);*/
        string temp = ReadLine();
        int a = int.Parse(ReadLine());
//        int b = int.Parse(ReadLine());
//        int c = int.Parse(ReadLine());
//        int d = int.Parse(ReadLine());
//        string a = ReadLine();
//        string b = ReadLine();
//        string c = ReadLine();
//        string[] input = ReadLine().Split(' ');
//        string ko = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
        for(int i=0;i<temp.Length;i++){
            if(i%a==0){
                Write(temp[i]);
            }
        }
        WriteLine();
    }
}

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

int main() {
  string s;
  cin >> s;
  if (s=="AAA" || s=="BBB" ) cout << "No" << endl;
  else cout << "Yes" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#define rep(i, a, b) for(int i = a; i < (b); ++i)
using namespace std;
typedef long long ll;

vector<pair<int, int>> to[100010];
bool visited[100010];
ll dist[100010];
int main() {
    int n;
    cin >> n;
    map<int, int>mp;
    rep(i,0,n){
        int tmp;
        cin >> tmp;
        mp[tmp]++;
        mp[tmp-1]++;
        mp[tmp+1]++;
    }
    int ans = 0;
    for(auto a: mp){
        if(ans < a.second){
            ans = a.second;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 10240
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll arr[(int)1e6+5];
ll temp[3];
int main(){
	int n=3;
	bool odd=false;
	for(int i=0;i<n;i++){
		scanf("%lld",&arr[i]);
		if(arr[i]%2==1){
			odd=true;
		}
	}
	sort(arr,arr+n);
	map<pair<pair<ll,ll> ,ll> , bool>mapp;
	ll ans=0;
	mapp[make_pair(make_pair(arr[0],arr[1]),arr[2])]=1;
	while(odd==false){
		temp[0]=(arr[0]+arr[1])/2;
		temp[1]=(arr[0]+arr[2])/2;
		temp[2]=(arr[1]+arr[2])/2;
		sort(temp,temp+3);
		for(int i=0;i<3;i++){
			arr[i]=temp[i];
			if(arr[i]%2==1) odd=1;
		}
		ans++;
		if(odd){
			break;
		}
		if(mapp[make_pair(make_pair(arr[0],arr[1]),arr[2])]==1){
			ans=-1;
			break;
		}
		
		
		
	}
	
	printf("%lld\n",ans);
	
	
}

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

#define ll long long

using Graph = vector<vector<ll>>;
Graph G;

void DFS(ll v, ll p, vector<ll> &res) {
  if (p != 0) res[v] += res[p];
  for (auto e : G[v]) {
    if (e == p) continue;
    DFS(e, v, res);
  }
}


int main() {
  ll N, Q;
  cin >> N >> Q;
  
  
  G.assign(200010, vector<ll>());
  
  
  
  // 木を作る
  for (int i = 0; i < N-1; i++) {
    ll a, b;
    cin >> a >> b;
    
    G[a].push_back(b);
    G[b].push_back(a);
  }
  
  vector<ll> count(200010, 0);

  
  // DFS
  for (int i = 0; i < Q; i++) {
    int p, x;
    cin >> p >> x;
    count[p] += x;
  }
  
  DFS(1, 0, count);
  
  
  // output
  for (int i = 1; i <= N; i++) {
    cout << count[i] << " ";
  }
  cout << endl;
  
  
}

Measured memory_bytes: 25148
#include <bits/stdc++.h>
using namespace std;
 
void coordinate_compression(vector<int> &a) {
	int petr = 1; map<int, int> mp;
	for (int &i: a) {
		if (!mp[i]) {
			mp[i] = petr++;
		}
		i = mp[i];
	}
}
 
const int BLOCK_SIZE = 600;
 
struct Query {
	int l, r, idx;
	
	Query(int L, int R, int ID) {
		l = L, r = R, idx = ID;
	}
 
	bool operator<(Query other) const {
		if (l / BLOCK_SIZE != other.l / BLOCK_SIZE)
		return make_pair(l, r) < make_pair(other.l, other.r);
		return (l / BLOCK_SIZE & 1) ? (r < other.r) : (r > other.r);
	}
};
 
vector<int> Mo(vector<Query> queries, vector<int> &a) {
	vector<int> answers(queries.size());
	sort(queries.begin(), queries.end());
 
	vector<int> cnt(500001);
 
	int cur_l = 0, cur_r = -1, cur = 0;
	for (Query q : queries) {
		while (cur_l > q.l) {
			cur_l--;
			cnt[a[cur_l]]++;
			if (cnt[a[cur_l]] == 1) cur++;
		}
		while (cur_r < q.r) {
			cur_r++;
			cnt[a[cur_r]]++;
			if (cnt[a[cur_r]] == 1) cur++;
		}
		while (cur_l < q.l) {
			cnt[a[cur_l]]--;
			if (cnt[a[cur_l]] == 0) cur--;
			cur_l++;
		}
		while (cur_r > q.r) {
			cnt[a[cur_r]]--;
			if (cnt[a[cur_r]] == 0) cur--;
			cur_r--;
		}
		answers[q.idx] = cur;
	}
	return answers;
}
 
signed main() {
	ios::sync_with_stdio(0); cin.tie(0);
	
	int n, q; cin >> n >> q;
	vector<int> a(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	coordinate_compression(a);
 
	vector<Query> qr;
	for (int i = 0; i < q; i++) {
		int l, r; cin >> l >> r;
		qr.push_back(Query(l-1, r-1, i));
	}
 
	vector<int> ans = Mo(qr, a);
	for (int i: ans) cout << i << '\n';
 
	return 0;
}


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

int main(){
	int buf;
	bool stud[30];
	
	for(int i = 0; i < 30; i++){
		stud[i] = 0;
	}
	
	for(int i = 0; i < 28; i++){
		cin >> buf;
		stud[buf - 1] = 1;
	}
	
	for(int i = 0; i < 30; i++){
		if(stud[i] == 0){
			cout << i + 1 << endl;
		}
	}
	
	return 0;
}

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

int main() {
  int h, w;
  cin >> h >> w;
  vector<bool> row(h, false);
  vector<bool> col(w, false);
  vector<string> a(h);
  for (int i = 0; i < h; i++){
      cin >> a.at(i);
  }
  
  for (int i = 0; i < h; i++){
    for(int j = 0; j < w; j++){
      if(a.at(i).at(j) == '#'){
        row.at(i) = true;
        col.at(j) = true;
      }
    }
  }
  for(int i = 0; i < h; i++){
    if(row.at(i)){
      for(int j = 0; j < w; j++){
        if(col.at(j)){
          cout << a.at(i).at(j);
        }
      }
    }
    cout << endl;
  }
}*/
      

#include <iostream>
#include <string>
#include <vector>
using namespace std;

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

	vector<bool> row(h, false);
	vector<bool> col(w, false);
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			if (a[i][j] == '#') {
				row[i] = true;
				col[j] = true;
			}
		}
	}

	for (int i = 0; i < h; i++) {
		if (row[i]) {
			for (int j = 0; j < w; j++) {
				if (col[j]) {
					cout << a[i][j];
				}
			}
			cout << endl;
		}
	}
}


Measured memory_bytes: 256
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
//#include<ext/pb_ds/assoc_container.hpp>
//#include<ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
using namespace std;

#define ll long long
#define ull unsigned long long
#define ld long double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vi vector<int>
#define vll vector<ll>
#define vpll vector<pll>
#define vpii vector<pii>
#define pb push_back
#define eb emplace_back
#define mt make_tuple
#define MP make_pair
#define fs first
#define sc second
#define F first
#define S second
#define nl "\n"
#define asche cerr<<"Ekhane asche\n";
#define pf printf
#define sf scanf
#define mem(a,x) memset(a,x,sizeof(a))
#define SZ(v) (int)v.size()
#define all(v) v.begin(),v.end()
#define one(x) __builtin_popcount(x)
#define fout(x) fixed<<setprecision(x)
#define BeatMeScanf ios_base::sync_with_stdio(false)
//int dx[]={1,0,-1,0,1,-1,-1,1};
//int dy[]={0,1,0,-1,1,1,-1,-1};
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define debug(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); deb(_it, args); }
void deb(istream_iterator<string> it) {}
template<typename T, typename... Args>
void deb(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << endl;
    deb(++it, args...);
}
//template <typename T> using o_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
namespace IO
{
    #define in() ( { int a ; scanf("%d",&a); a; } )
    #define LL() ( { ll a ; scanf("%lld",&a); a; } )
       #define ULL() ( { ull a ; scanf("%llu",&a); a; } )
    #define DD() ({ double a; scanf("%lf", &a); a;})
    #define CC() ( { char a ; scanf("%c",&a); a; } )
    #define pf1(a) printf("%d\n",a)
    #define pf1ll(a) printf("%lld\n",a)
}
using namespace IO;

const int mod=1e9+7;
const int N=3e5+9;
const double eps=1e-9;
const double PI=acos(-1.0);
ll qpow(ll n,ll k) {ll ans=1;assert(k>=0);n%=mod;while(k>0){if(k&1) ans=(ans*n)%mod;n=(n*n)%mod;k>>=1;}return ans%mod;}

pii l[N],r[N];
pii yo(pii a,pii b)
{
    return MP(max(a.F,b.F),min(a.S,b.S));
}
int len(pii a)
{
    return max(0,a.S-a.F+1);
}
int check(vpii v)
{
    int n=SZ(v);
    l[0]=v[0];
    for(int i=1;i<n;i++) l[i]=yo(v[i],l[i-1]);
    r[n-1]=v[n-1];
    for(int i=n-2;i>=0;i--) r[i]=yo(r[i+1],v[i]);
    int ans=0;
    for(int i=0;i+1<n;i++){
        ans=max(ans,len(l[i])+len(r[i+1]));
        if(i&&i+1<n) ans=max(ans,len(v[i])+len(yo(l[i-1],r[i+1])));
    }
    return ans;
}
int32_t main()
{
    int n=in();
    vpii v(n);
    for(auto &x: v) x.F=in(),x.S=in();
    //for(int i=1;i<n;i++) if(v[i].S>v[0].S) swap(v[0],v[i]);
    int ans=0;
    sort(all(v));
    ans=max(ans,check(v));
    pf1(ans);
    return 0;
}
///Before submit=>
///    *check for integer overflow,array bounds
///    *check for n=1



Measured memory_bytes: 4608